Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Retrieve a game object based on it's ID... |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
var gameObj = objFromId(idObj); // use with care!! |
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
idObj | Object | An object that has an .id property who's value is the ID of the object you wish to retrieve. For example, if you want to retrieve object #63, you'd pass in: You could also pass in a cached Game object to get a fresh copy of that game object (all game objects have an .id property). | 3.1 Beta 2 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
<gameObj> | Game object | A Droid object, Structure object or Feature object that has the specified object id. | 3.1 Beta 2 |
null | Null | The object was not found. | 3.1 Beta 2 |
<error> | Error | Due to bugs, if object is not found an error is usually thrown. | 3.1 Beta 2 |
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
var lookingFor = {id:63}; var found; try { found = objFromId(lookingFor); } catch(e) { found = null; } if (found) { // do stuff with 'found' game object } |
Div | ||
---|---|---|
| ||
This function is deprecated as of Warzone 3.2. |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
Replaced by:
Older Earlier versions:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|