Squirrel/Server/Functions/Objects/VirtualWorld

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

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:

  1. int Object.VirtualWorld
  1. 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.

  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.  

[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'.

  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.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox