vp_callback_set
Method call snippet
vp_callback_set(instance, callbackname, callback);
Sets handler for a specific callback.
Parameters
These are the parameters that this method requires:
Parameter | Usage |
---|---|
VPInstance instance |
Pointer to the instance this method call is intended for |
vp_callback_t callbackname |
Callback to set handler for |
VPCallbackHandler callback |
Callback handler |
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
- There is no special behavior for this method
Examples
void handle_login(VPInstance sdk, int rc, int ref)
{
if (rc)
printf("Error logging into universe (reason %d)\n", rc);
}
int main(int argc, const char* argv[])
{
//...
vp_callback_set(sdk, VP_CALLBACK_LOGIN);
if (rc = [[vp_login]](sdk, Username, Password, Botname))
{
printf("Couldn't login (reason %d)", rc);
return 1;
}
//...
}