Class GameObjectID

From TrainzOnline
Revision as of 10:54, 5 February 2018 by Pguy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


  • 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

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.


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.


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.


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.


Personal tools