View Single Post
Old 06-13-2007, 12:16 PM   #10
Scruffy Englishman
Pavlos's Avatar
Join Date: Sep 2005
Location: The real world/ivory towers
Posts: 1,973
Current Game: Viking Warrior Poets
Originally Posted by tk102
Interesting. I wonder where these two functions are used. I suppose they make it possible to store a reference to an object as a global variable.
As far as I can tell it allows you to 'wield' your object as an integer (i.e. access the actual IDs that the game uses to identify objects).

Edit: Yeah, that seems to be it;

Originally Posted by Rich Taylor
The ObjectToInt() script funciton is just data conversion. The 'object' engine type in the scripting language is really just an unsigned int. Converting the 'object' type to 'int' type doesn't do anything special other than let you now manipulate the object ID as an int.

For example:

object oPC = GetFirstPC();
int nPC = ObjectToInt( oPC ); //nPC now equals the PC's object ID
string sPC = IntToString( nPC );//sPC is now a string that equates to the PC's object ID.

If you copy an object, then that object has a new ID, so ObjectToInt() on the new copy will return a different numeric value.

All this function really does is give you script access to the actual IDs that uniquely identify objects.

I hope this helps explain it a little.

Last edited by Pavlos; 06-13-2007 at 12:27 PM.
Pavlos is offline   you may: quote & reply,