Squirrel/Server/Functions/Objects/VirtualWorld
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|Object.VirtualWorld}} This ''Object'' class member returns or sets the virtual world for the object. == Syntax == You can either return or set a new value usin…') |
Latest revision as of 13:49, 31 July 2011
This Object class member returns or sets the virtual world for the object.
[edit] Syntax
You can either return or set a new value using this member:
int Object.VirtualWorld
Object.VirtualWorld = int world
[edit] Arguments
- world - This is the new virtual world of the object.
[edit] Example 1. Returning
This example will message the player with the virtual world for an object with an ID of 0.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "objectworld" ) { local object = FindObject( 0 ); if(obj) MessagePlayer( "Object 0's virtual world is " + object.VirtualWorld + ".", player ); return 1; } }
[edit] Notes
The function FindObject and event onPlayerCommand were used in this example. More info about them in the corresponding pages.
[edit] Example 2. Setting
This example will change the virtual world of object 0 to ID 2 when a player uses the command '/setworld'.
function onPlayerCommand( player, cmd, text ) { if(cmd == "setworld") { local object = FindObject( 0 ); if(object) { object.VirtualWorld = 2; MessagePlayer("Object 0's virtual world changed to world 2.", player); } return 1; } }
[edit] Notes
The function FindObject and event onPlayerCommand was used in this example. More info about it in the corresponding page.