backIndex

Xelagot action script

Sending messages: Reply, Say, Whisper, ConMsg, Secret, Say/Whisper/ConMsgText.

Placeholders ON|OFF version 3.425
Allows (default) or disallows substitution of placeholders like {p} and others when broadcasting text. To be set to OFF when relaying chat or broadcasting chat as console messages. Functions affected:
Say, Whisper, Secret, ConMsg, ConMsgAll, Reply, in their different variants. Placeholders, if allowed, are treated as explained in the Language page.
ReplyCWithName ON|OFF version 3.503
This statement forces all ReplyC variations (ReplyC, ReplyCConcat, ReplyCText) to prepend the name of the bot to the console messages it sends, just like chat and whisper do, if set to ON; it is OFF by default.
ConMsgWithName ON|OFF version 3.503
This statement forces all ConMsg variations (ConMsg, ConMsgConcat, ConMsgAll, ConMsgAllConcat, ConMsgText, ConMsgAllText) to prepend the name of the bot to the console messages it sends, just like chat and whisper do, if set to ON; it is OFF by default.
Reply and ReplyText
introduced gradually as from in X1 2.9999950 and Av99Bot/SrvcXlgBot 1.66
Reply $message
ReplyS $message
ReplyW $message


3.3 Caretaker bot
ReplyC $message
must be used inside an event handler or in a Sub called by the event handler

Reply is a generic statement which selects automatically the destination and mode of reply, depending on the event handler. Reply, ReplyS and ReplyW are identical except in the Chat event handler, and in the non-chatting event handlers. If $message is a string literal, it must not be enclosed in quotes (see Say, Whisper).

ReplyC is a 3.3 statement reserved for Caretaker bots. It replies with a Console Message that uses the colour and style set by the following statements:
ConMsgColor %red %green %blue, using values from 0 to 255
ConMsgStyle %bold %italics, a non-zero value sets the attribute.
If the bot is not Caretaker, or the world server can't handle this message, ReplyC defaults to ReplyW, i.e. whisper.

event handler mode and destination
Chat if the chat message was said aloud, Reply says its $message aloud (using Say); if it was a whisper, Reply whispers back the $message (using Whisper). ReplyS always answers aloud, ReplyW always whispers back. ReplyC sends as Console Message or as Whisper.
BotMessage, BotChat, BotHear, BotAnswer sends the $message to the ChatPerson (a bot in the same application) using MessageToBot. The destination bot must trap this message in a BotMessage event handler.
UIChat (old BossChat) sends the $message to the screen, using Secret.
CLMessage, CLHear, CLAnswer uses CLWrite to send the $message to the bot client. The receiver must trap this in a CLMessage event handler.
DBMessage, DBHear (Av99Bot and SrvcXlgBot) writes the $message to file in the Bot2DB folder using the DBWriteToBot Answer command.
AvatarAdd, AvatarChange, AvatarClick, ObjectClick, ObjectSelect,

(3.301)
AvatarScan
Reply and ReplyW send the $message to the avatar using Whisper; ReplyS uses Say, ReplyC sends as Console Message or as Whisper.

In AvatarClick, you can select the destination by specifying:
ReplySource
ReplyTarget
before using Reply, ReplyS, ReplyW, ReplyC.

ReplyConcat elements
ReplySConcat elements
ReplyWConcat elements

3.3 Caretaker bot
ReplyCConcat $message
must be used inside an event handler or in a Sub called by the event handler

these statements work like the previous statements, but allow concatenating strings and variables.

elements (i.e. list of elements) is as explained in string operation Concat.

ReplyText %a $t [$g]
ReplySText %a $t [$g]
ReplyWText %a $t [$g]
3.3 Caretaker bot
ReplyCText %a $t [$g]
 
ReplyText %a /s_t [$g]
ReplySText %a /s_t [$g]
ReplyWText %a /s_t [$g]
3.3 Caretaker bot
ReplyCText %a /s_t [$g]

must be used inside an event handler or in a Sub called by the event handler

points to a text field labelled $t (variable or literal), reads the text into the bot's text buffer; or points to a string list /s_t, reads the contents into the text buffer. Executes the Reply command as described above for each line of text at a given pace, indicated by the numeral %a (variable or literal): a value of 1 sets a normal pace, less than 1 is faster (e.g. 0.8), greater than one is slower (e.g. 1.2). Tag $g is optional and defaults to an empty string. Triggers event Text Complete when text has been said, it passes back tag $g.

Say
Say $a sends a chatline to the world server. $a is a string variable or literal which the bot will say aloud. If it is a string literal, it will be processed 'as is' including all quotes, but may not begin with the $ symbol.
SayConcat elements sends a chatline. elements (i.e. list of elements) is as explained in string operation Concat.
Example:
SayConcat "I like " $s " when it snows at " %r " o'clock"
Whisper
Whisper &p $a whispers a chatline to an avatar. &p is a person variable with valid parameters, $a is as in Say. Placeholders are treated as explained in the Language page.
Whisper %s $a
Whisper $n $a
whispers a chatline to an avatar. %s is the session number (numeric variable only) or $n is the name of the avatar whispered to (string variable only), and $a has the same meaning as in Say. Note: introduced in X1 2.9999951, Av99Bot/SvrcXlgBot 1.67. As from this version, the double notation Whisper %s $n $a may not be used, and must be changed to either Whisper %s $a or Whisper $n $a.
WhisperConcat &p elements whispers a chatline to an avatar. &p is a person variable with valid parameters. elements (i.e. list of elements) is as explained in string operation Concat.
WhisperConcat %s elements
WhisperConcat $n elements
whispers a chatline to an avatar. %s is the session number (numeric variable only) or $n is the name of the avatar whispered to (string variable only). elements (i.e. list of elements) is as explained in string operation Concat. Note: introduced in X1 2.9999951, Av99Bot/SvrcXlgBot 1.67. As from this version, the double notation WhisperConcat %s $n elements may not be used, and must be changed to either WhisperConcat %s elements or Whisper $n elements.
ConMsg
3.3 Caretaker bots

These statements send a Console Message that uses the colour and style set by the following statements:
ConMsgColor %red %green %blue, using values from 0 to 255
ConMsgStyle %bold %italics, a non-zero value sets the attribute.
If the bot is not Caretaker, or the world server can't handle this message, they default to Whisper.

ConMsg &p $a
ConMsg %session $a
ConMsg $name $a
Sends a Console Message to an avatar (or, if not available, a whisper). &p is a person variable with valid parameters, $a is as in Say. You can also use the session number or avatar name instead of person &p.

As from version 3.430, you can send a console message to all by putting the session number to zero:
ConMsg 0 "This is a message to all"
This works differently than ConMsgAll (which sends one separate message to each of the avatars on the presence list): here only one message is sent to the world server, and the world server broadcasts it to all (including the bot).
ConMsgConcat &p elements
ConMsgConcat %session elements
ConMsgConcat $name elements
Sends a Console Message to an avatar (or, if not available, a whisper). &p is a person variable with valid parameters. You can also use the session number or avatar name instead of person &p. elements (i.e. list of elements) is as explained in string operation Concat.

As from version 3.430, you can send a console message to all by putting the session number to zero:
ConMsgConcat 0 "This is a message to all"
This works differently than ConMsgAllConcat (which sends one separate message to each of the avatars on the presence list): here only one message is sent to the world server, and the world server broadcasts it to all (including the bot).
ConMsgAll $a Sends a Console Message to all avatars on its presence list (or, if not available, a whisper). If the bot is in GlobalMode, then that includes all avatars in the world. Note that a separate message is sent to the world server for each avatar.

As from version 3.430, you can better use ConMsg as explained there, as it is more efficient.
ConMsgAllConcat elements Sends a Console Message to all avatars on its presence list (or, if not available, a whisper). If the bot is in GlobalMode, then that includes all avatars in the world. elements (i.e. list of elements) is as explained in string operation Concat. Note that a separate message is sent to the world server for each avatar.

As from version 3.430, you can better use ConMsgConcat as explained there, as it is more efficient.
Secret
Secret $a sends a chatline to the User Interface only, $a has the same meaning as in Say.
SecretConcat elements sends a chatline to the User Interface only, elements (i.e. list of elements) is as explained in string operation Concat.
SayText
SayText %a [&p] $t [$g] points to a text field labelled $t (variable or literal), reads the text into the bot's Say-buffer. Executes the say command at a given pace, indicated by the numeral %a (variable or literal): a value of 1 sets a normal pace, less than 1 is faster (e.g. 0.8), greater than one is slower (e.g. 1.2). The person variable &p is optional, tag $g is optional and defaults to an empty string. Triggers event Text Complete when text has been said, it passes back tag $g.
SayText %a [&p/s_t [$g] similar to the previous one, but reads the text from a string list rather than from a text field. Triggers event Text Complete when text has been said, it passes back tag $g.
3.3
IfSayTo &p statement1
Else statement2

older (still valid)
IfSaysTo &p statement1
Else statement2
checks if there is text in the Say buffer for person &p.
3.3
KillSayTo &p
kills text in the Say buffer for person &p. Triggers event Text Complete and passes back tag $g.
3.3
IfSayToAny statement1
Else statement2

older (still valid)
IfSaysToAny statement1
Else statement2
checks if there is text in the Say buffer for anyone.
3.3
KillSay
kills all text in the Say buffer. Triggers event Text Complete for each buffer element it deletes and passes back tag $g.
WhisperText
WhisperText %a &p $t [$g] points to a text field labelled $t (variable or literal), reads the text into the bot's Whisper-buffer. Executes the whisper command at a given pace, indicated by the numeral %a (variable or literal): a value of 1 sets a normal pace, less than 1 is faster, greater than one is slower. The person variable &p is required, tag $g is optional and defaults to an empty string. Triggers event Text Complete when text has been said, it passes back tag $g.
WhisperText %a &p /s_t [$g] similar to the previous one, but reads the text from a string list rather than from a text field. Triggers event Text Complete when text has been said, it passes back tag $g.
3.3
IfWhisperTo &p statement1
Else statement2

older (still valid)
IfWhispersTo &p statement1
Else statement2
checks if there is text in the Whisper buffer for person &p.
3.3
KillWhisperTo &p
kills text in the Whisper buffer for person &p. Triggers event Text Complete and passes back tag $g.
3.3
IfWhisperToAny statement1 Else statement2
older (still valid)
IfWhispersToAny statement1 Else statement2
checks if there is text in the Whisper buffer for anyone.
3.3
KillWhisper
kills all text in the Whisper buffer. Triggers event Text Complete for each buffer element it deletes and passes back tag $g.
ConMsgText
3.3 Caretaker bots

These statements send a Console Message that uses the colour and style set by the following statements:
ConMsgColor %red %green %blue, using values from 0 to 255
ConMsgStyle %bold %italics, a non-zero value sets the attribute.
If the bot is not Caretaker, or the world server can't handle this message, they default to WhisperText.

ConMsgText %a &p $t [$g]
ConMsgText %a %session $t [$g]
ConMsgText %a $name $t [$g]
points to a text field labelled $t (variable or literal), reads the text into the bot's ConMsg-buffer. Executes the Console Message command at a given pace, indicated by the numeral %a (variable or literal): a value of 1 sets a normal pace, less than 1 is faster, greater than one is slower. The person variable &p is required (or a session number or a name in a string variable), tag $g is optional and defaults to an empty string. Triggers event Text Complete when text has been said, it passes back tag $g.

As from version 3.430, you can send a console message text to all by putting the session number to zero:
ConMsgText 1.2 0 "myTextField"
This works differently than ConMsgAllText (which sends one separate message to each of the avatars on the presence list): here only one message is sent to the world server, and the world server broadcasts it to all (including the bot), so it is more efficient.
ConMsgText %a &p /s_t [$g]
ConMsgText %a %session /s_t [$g]
ConMsgText %a $name /s_t [$g]
similar to the previous one, but reads the text from a string list rather than from a text field. Triggers event Text Complete when text has been said, it passes back tag $g.

As from version 3.430, you can send a console message text to all by putting the session number to zero:
ConMsgText 1.2 0 /s_MyList
This works differently than ConMsgAllText (which sends one separate message to each of the avatars on the presence list): here only one message is sent to the world server, and the world server broadcasts it to all (including the bot), so it is more efficient.
ConMsgAllText %a $t [$g] points to a text field labelled $t (variable or literal), reads the text into the bot's ConMsg-buffer. Executes the Console Message command at a given pace, indicated by the numeral %a (variable or literal): a value of 1 sets a normal pace, less than 1 is faster, greater than one is slower. This message is sent to all avatars on the bot's presence list (to all in the world if the bot is in GlobalMode). tag $g is optional and defaults to an empty string. Triggers event Text Complete when text has been said, it passes back tag $g. Note that a separate message is sent to the world server for each avatar.

As from version 3.430, you can better use ConMsgText as explained there, as it is more efficient.
ConMsgAllText %a /s_t [$g] similar to the previous one, but reads the text from a string list rather than from a text field. Triggers event Text Complete when text has been said, it passes back tag $g. Note that a separate message is sent to the world server for each avatar.

As from version 3.430, you can better use ConMsgText as explained there, as it is more efficient.
IfConMsgTo &p statement1
Else statement2
checks if there is text in the ConMsg buffer for person &p.
KillConMsgTo &p
kills text in the ConMsg buffer for person &p. Triggers event Text Complete and passes back tag $g.
IfConMsgToAny statement1 Else statement2 checks if there is text in the ConMsg buffer for anyone.
KillConMsg kills all text in the ConMsg buffer. Triggers event Text Complete for each buffer element it deletes and passes back tag $g.
Other Text statements
KillTextTo &p Clears all text Say/Whisper/ConMsg buffers to person &p. Triggers event Text Complete for each buffer element it deletes and passes back tag $g.
KillText Clears all text Say/Whisper/ConMsg buffers. Triggers event Text Complete for each buffer element it deletes and passes back tag $g.

Note (version 2.9999950): the strings sent with Reply, ReplyS, ReplyW, ReplyC, ReplyConcat, ReplySConcat, ReplyWConcat, ReplyCConcat, Say, SayConcat, Whisper, WhisperConcat, ConMsg, ConMsgConcat may contain a null character (ascii 0). This character will split the following text from the preceding text in 2 sentences. To imbed such a character #0 in string $a, do this
Concat $a "This is the first sentence" #0 "This is the second"

You can also surround a line with #0
Concat $a #0 "This is the first sentence" #0 "This is the second" #0
this makes sure each line is on its own.

Since the 3.3 Caretaker bot Console Messaging allows some kind of formatting, you can insert a #9 in the message to cause a tab. For Example:
ConMsgColor 0 255 0
ConMsgStyle 0 0
ConMsgConcat &p "Building Inspector:" #9 "You are not allowed to walk on the grass!"

will introduce a new Building Inspector annoyance!


backIndex