Vp enter: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
(Created page with "{{sdk method page|enter|Enters a bot into a world. |paramex=world |parameters= {{sdk parameter row|string|world|Name of an online world to enter}} |returncodes= {{sdk ...")
 
(Added reason codes and callback)
Line 5: Line 5:
|returncodes=
|returncodes=
   {{sdk return code row|NOT_INITIALIZED  |SDK not initialized with {{sdk method|init}} yet}}
   {{sdk return code row|NOT_INITIALIZED  |SDK not initialized with {{sdk method|init}} yet}}
   {{sdk return code row|CONNECTION_ERROR |Error connecting to the world server}}
   {{sdk return code row|STRING_TOO_LONG  |World name was longer than 255 bytes}}
   {{sdk return code row|TIMEOUT          |Connection attempt to the world server timed out (e.g. firewalled server)}}
   {{sdk return code row|CONNECTION_ERROR |Disconnected from universe while sending, or connecting to the world failed}}
   {{sdk return code row|WORLD_NOT_FOUND  |No such world is connected to the [[universe]]}}
   {{sdk return code row|WORLD_NOT_FOUND  |No such world is connected to the [[universe]]}}
   {{sdk return code row|WORLD_LOGIN_ERROR|Could not login to world (e.g. incorrect world address configured) or banned (not yet implemented)}}
   {{sdk return code row|WORLD_LOGIN_ERROR|Could not login to world (e.g. incorrect world address configured) or banned (not yet implemented)}}
  {{sdk return code row|TIMEOUT          |Connection attempt to the world server timed out (e.g. firewalled server)}}
  {{sdk return code row|NOT_IN_UNIVERSE  |Bot is not currently connected to universe}}
|behavior=
|behavior=
* If the bot was already in a world, it will automatically leave that world
*If a {{sdk callback|ENTER}} callback is set this function will return immediately and return the result using the callback, otherwise it will call {{sdk method|wait}} in a loop until done.
* If the bot was already in a world, it will automatically leave that world.
|caveats=
|caveats=
The bot will not have a visible "presence" in the world (e.g. will not appear to other users or bots') until {{sdk method|state_change}} is called at least once.
*The bot will not have a visible "presence" in the world (e.g. will not appear to other users or bots') until {{sdk method|state_change}} is called at least once.
*World names are case-sensitive.
|seealso=
|seealso=
* {{sdk callback|ENTER}}
* {{sdk method|state_change}}
* {{sdk method|state_change}}
* {{sdk method|leave}}
* {{sdk method|leave}}
}}
}}

Revision as of 21:41, 13 December 2016

Method call snippet vp_enter(instance, world);

Enters a bot into a world.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for
string
world
Name of an online world to enter

Returns

This method returns a return code integer, which indicates whether the call was successful or errored for any reason:

Return code Cause
VP_RC_SUCCESS Successful call (for methods that have a registered callback, it only means the request has been sent)
VP_RC_NOT_INITIALIZED SDK not initialized with vp_init() yet
VP_RC_STRING_TOO_LONG World name was longer than 255 bytes
VP_RC_CONNECTION_ERROR Disconnected from universe while sending, or connecting to the world failed
VP_RC_WORLD_NOT_FOUND No such world is connected to the universe
VP_RC_WORLD_LOGIN_ERROR Could not login to world (e.g. incorrect world address configured) or banned (not yet implemented)
VP_RC_TIMEOUT Connection attempt to the world server timed out (e.g. firewalled server)
VP_RC_NOT_IN_UNIVERSE Bot is not currently connected to universe

Behavior

  • If a VP_CALLBACK_ENTER callback is set this function will return immediately and return the result using the callback, otherwise it will call vp_wait() in a loop until done.
  • If the bot was already in a world, it will automatically leave that world.

Caveats

  • The bot will not have a visible "presence" in the world (e.g. will not appear to other users or bots') until vp_state_change() is called at least once.
  • World names are case-sensitive.

Examples

This method has no usage examples; please add at least one to this page

See also