Class GameObjectID
From TrainzOnline
(Difference between revisions)
(Created page with "*API Hierarchy **GSObject ***GameObjectID <br> *GameObjectID is a class to implement a unique identifier for a specific...") |
m (Change link to library reference, not language reference) |
||
Line 1: | Line 1: | ||
− | *[[TrainzScript | + | *[[TrainzScript Library Reference|API Hierarchy]] |
**[[Class GSObject|GSObject]] | **[[Class GSObject|GSObject]] | ||
***GameObjectID | ***GameObjectID |
Latest revision as of 23:38, 28 December 2020
- API Hierarchy
- GSObject
- GameObjectID
- GSObject
- GameObjectID is a class to implement a unique identifier for a specific game script object.
- This unique identifier is persistant across game instances and suitable to be saved/loaded within GetProperties/SetProperties.
- GameObjectID is intended to replace the unique legacy ID of GameObjects, obsolete since Tane SP2, which was not persistant across successive game session instances.
- This class is available since Tane SP2 (4.5)
- final game class GameObjectID isclass GSObject
Contents |
[edit] DoesMatch
public native bool DoesMatch(GameObjectID otherID);
- Parameters
- otherID = other GameObjectID instance passed to be checked if it matches initial GameObjectID instance.
- Returned Value
- bool
- Syntax
bool isSameObject = gameObjectID1.DoesMatch(gameObjectID2);
- Notes
- Returns whether this GameObjectID matches the ID passed. GameObjectIDs MUST be equality tested using this function. Testing using standard operators ('==' and '!=') will not work.
[edit] DoesMatch
public native bool DoesMatch(GSObject otherObject);
- Parameters
- otherObject = the object to test. This must be a GameObject.
- Returned Value
- bool
- Syntax
bool isSameObject = gameObjectID1.DoesMatch(otherObject);
- Notes
- Returns whether this GameObjectID matches the object passed.
[edit] GetDebugString
public native string GetDebugString(void);
- Parameters
- none - method has no parameters
- Returned Value
- string
- Syntax
string debugString = gameObjectID.GetDebugString();
- Notes
- Returns a string describing the contents of this ID, for use in debug logs. The format of this string is not guaranteed, do not attempt to machine parse it.
[edit] SerialiseToString
public native string SerialiseToString(void);
- Parameters
- none - method has no parameters
- Returned Value
- string
- Syntax
string serialString = gameObjectID.SerialiseToString();
- Notes
- Returns a machine-readable string representing this GameObjectID, and parseable by Router.SerialiseGameObjectIDFromString(). This allows a GameObjectID to be temporarily stored in a html link or similar.