Object.VirtualWorld

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This Object class member returns or sets the virtual world for the object.

Syntax

You can either return or set a new value using this member:

  1. int Object.VirtualWorld
  1. Object.VirtualWorld = int world

Arguments

  • world - This is the new virtual world of the object.

Example 1. Returning

This example will message the player with the virtual world for an object with an ID of 0.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "objectworld" )
  5. {
  6. local object = FindObject( 0 );
  7. if(obj) MessagePlayer( "Object 0's virtual world is " + object.VirtualWorld + ".", player );
  8.  
  9. return 1;
  10. }
  11. }
  12.  

Notes

The function FindObject and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Example 2. Setting

This example will change the virtual world of object 0 to ID 2 when a player uses the command '/setworld'.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if(cmd == "setworld")
  5. {
  6. local object = FindObject( 0 );
  7. if(object)
  8. {
  9. object.VirtualWorld = 2;
  10. MessagePlayer("Object 0's virtual world changed to world 2.", player);
  11. }
  12.  
  13. return 1;
  14. }
  15. }
  16.  

Notes

The function FindObject and event onPlayerCommand was used in this example. More info about it in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox