Difference between revisions of "TotalControl for LSL/Events/BOT COMMAND FAILED"
From SmartBots Developers Docs
m (Gg moved page AdminBot for Bots/Events/BOT COMMAND FAILED to TotalControl LSL/Events/BOT COMMAND FAILED) |
(Correction) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{DISPLAYTITLE: | + | {{DISPLAYTITLE:BOT_COMMAND_FAILED}} |
<onlyinclude>Raised when command error occurs.</onlyinclude> | <onlyinclude>Raised when command error occurs.</onlyinclude> | ||
{{API Event Table}} | {{API Event Table}} | ||
{{API Variable Group|''event'' object properties}} | {{API Variable Group|''event'' object properties}} | ||
− | {{API Variable|str}} first line - [[ | + | {{API Variable|str}} first line - [[Usage/Status_Codes|command status code]]<br>second line - text explanation |
{{API Variable|id}} --- | {{API Variable|id}} --- | ||
Line 12: | Line 12: | ||
<syntaxhighlight lang="lsl"> | <syntaxhighlight lang="lsl"> | ||
− | link_message(integer sender,integer | + | link_message(integer sender,integer num, string str, key id) { |
/////////////////// Bot command failed event | /////////////////// Bot command failed event | ||
− | if( | + | if(num==BOT_COMMAND_FAILED) { |
// We split the string parameter to the lines | // We split the string parameter to the lines | ||
− | list parts=llParseString2List( | + | list parts=llParseString2List(str,["\n"],[]); |
− | // The first line is a status code, and second line is the | + | // The first line is a status code, and second line is the reason |
string code=llList2String(parts,0); | string code=llList2String(parts,0); | ||
string explain=llList2String(parts,1); | string explain=llList2String(parts,1); | ||
// Inform user | // Inform user | ||
− | llOwnerSay(" | + | llOwnerSay("TotalControl bot command failed:\n"+ |
"error code: "+code+"\n"+ | "error code: "+code+"\n"+ | ||
− | " | + | "explanation: "+explain); |
} | } | ||
} | } |
Latest revision as of 17:02, 20 March 2019
Raised when command error occurs.
Reference
This event comes with the following event object:
Variable | Required | Description | |
---|---|---|---|
event object properties: | |||
str | first line - command status code second line - text explanation | ||
id | --- |
Example
link_message(integer sender,integer num, string str, key id) {
/////////////////// Bot command failed event
if(num==BOT_COMMAND_FAILED) {
// We split the string parameter to the lines
list parts=llParseString2List(str,["\n"],[]);
// The first line is a status code, and second line is the reason
string code=llList2String(parts,0);
string explain=llList2String(parts,1);
// Inform user
llOwnerSay("TotalControl bot command failed:\n"+
"error code: "+code+"\n"+
"explanation: "+explain);
}
}