Vp console message: Difference between revisions

From Virtual Paradise Wiki
Jump to navigation Jump to search
Roy Curtis (talk | contribs)
draft commit
 
Sleepy E (talk | contribs)
Added example, updated text, VP_TEXT_EFFECT...
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
|paramex=session, name, message, effects, red, green, blue
|paramex=session, name, message, effects, red, green, blue
|parameters=
|parameters=
   {{sdk parameter row|int  |session|Target session}}
   {{sdk parameter row|int  |session|Session ID to send the message to. Zero to send to everyone}}
   {{sdk parameter row|string|name  |Name to attach to the message}}
   {{sdk parameter row|string|name  |Name to use for the chat message. Empty string to hide name.}}
   {{sdk parameter row|string|message|Message body}}
   {{sdk parameter row|string|message|Chat message contents}}
   {{sdk parameter row|int  |effects|Bitfield of message formatting}}
   {{sdk parameter row|int  |effects|Text effects (combination of [[vp_text_effect]] flags)}}
   {{sdk parameter row|uchar |red    |Message color red value}}
   {{sdk parameter row|uchar |red    |Red component of the text color(0-255)}}
   {{sdk parameter row|uchar |green  |Message color green value}}
   {{sdk parameter row|uchar |green  |Green component of the text color(0-255)}}
   {{sdk parameter row|uchar |blue  |Message color blue value}}
   {{sdk parameter row|uchar |blue  |Blue component of the text color(0-255)}}
|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 14: Line 14:
   {{sdk return code row|STRING_TOO_LONG|Name or message exceeds 255 characters in length}}
   {{sdk return code row|STRING_TOO_LONG|Name or message exceeds 255 characters in length}}
|behavior=
|behavior=
* <i>effects</i> can be 0, or any combination of VP_TEXT_EFFECT_BOLD and VP_TEXT_EFFECT_ITALIC.
|caveats=
|caveats=
|examples=
This will output "<font color="red"><b><i>Postman: You have a letter</i></b></font>" in chat.
<syntaxhighlight lang="c">
vp_console_message(sdk, 0, "Postman", "You have a letter", VP_TEXT_EFFECT_BOLD | VP_TEXT_EFFECT_ITALIC, 255, 0, 0);
</syntaxhighlight>
|seealso=
|seealso=
* {{sdk method|chat}}
* {{sdk method|say}}
}}
}}

Latest revision as of 21:55, 13 December 2016

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