Vp object get: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
Sleepy E (talk | contribs)
m Added reference number attribute
Sleepy E (talk | contribs)
mNo edit summary
 
Line 5: Line 5:
   {{sdk parameter row|int|id|ID of the object}}
   {{sdk parameter row|int|id|ID of the object}}
|attributes=
|attributes=
   {{sdk attribute row|int|REFERENCE_NUMBER|Will be passed to the callback to identify for which method call it is fired}}
   {{sdk attribute row|int|REFERENCE_NUMBER|Is passed to the callback to identify for which method call it is fired}}
|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}}

Latest revision as of 23:11, 31 July 2018

Method call snippet vp_object_get(instance, id);

Gets the attributes of a single object in-world by its ID.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for
int
id
ID of the object

Used attributes

This method uses data set in these attributes when called:

Attribute Usage
VP_REFERENCE_NUMBER Is passed to the callback to identify for which method call it is fired

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

Behavior

This is a non-blocking call that requires a callback to be set for VP_CALLBACK_OBJECT_GET. The callback will either return the object's data or an error reason code.

Caveats

This call is only useful for single objects the bot does not know about. After getting an object's data once, it should cache the result and monitor changes using VP_EVENT_OBJECT_CHANGE.

Examples

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

See also