vp_console_message

From Virtual Paradise Wiki
Jump to navigation Jump to search
Method call snippet vp_console_message(instance, session, name, message, effects, red, green, blue);

Makes a bot send a custom named and/or formatted message to the world or a specific session in-world.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for
int
session
Session ID to send the message to. Zero to send to everyone
string
name
Name to use for the chat message. Empty string to hide name.
string
message
Chat message contents
int
effects
Text effects (combination of vp_text_effect flags)
uchar
red
Red component of the text color(0-255)
uchar
green
Green component of the text color(0-255)
uchar
blue
Blue component of the text color(0-255)

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_NOT_IN_WORLD Bot is not currently in a world
VP_RC_STRING_TOO_LONG Name or message exceeds 255 characters in length

Behavior

  • effects can be 0, or any combination of VP_TEXT_EFFECT_BOLD and VP_TEXT_EFFECT_ITALIC.

Examples

This will output "Postman: You have a letter" in chat.

vp_console_message(sdk, 0, "Postman", "You have a letter", VP_TEXT_EFFECT_BOLD | VP_TEXT_EFFECT_ITALIC, 255, 0, 0);

See also