Vp object get: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
Roy Curtis (talk | contribs)
Created page with "{{sdk method page|object_get|Gets the attributes of a single object in-world by its ID. |version=0.3.37 |paramex=id |parameters= {{sdk parameter row|int|id|ID of the object}..."
 
Sleepy E (talk | contribs)
m Added reference number attribute
Line 4: Line 4:
|parameters=
|parameters=
   {{sdk parameter row|int|id|ID of the object}}
   {{sdk parameter row|int|id|ID of the object}}
|attributes=
  {{sdk attribute row|int|REFERENCE_NUMBER|Will be 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}}
Line 12: Line 14:
* {{sdk method|query_cell}}
* {{sdk method|query_cell}}
* {{sdk event|object_click}}
* {{sdk event|object_click}}
* {{sdk callback|object_get}}
}}
}}

Revision as of 23:08, 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 Will be 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