Difference between revisions of "HTTP API/Bot Commands/give money object"
From SmartBots Developers Docs
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE: give_money_object}} | {{DISPLAYTITLE: give_money_object}} | ||
− | <onlyinclude>Commands bot to send money (L$) to a specific object.</onlyinclude> Also see [[ | + | <onlyinclude>Commands bot to send money (L$) to a specific object.</onlyinclude> Also see [[HTTP API/Bot Commands/give_money|give_money command]]. |
{{API Variables Table}} | {{API Variables Table}} | ||
Line 42: | Line 42: | ||
], "&"); | ], "&"); | ||
− | llHTTPRequest(" | + | llHTTPRequest("https://api.mysmartbots.com/api/bot.html", |
[HTTP_METHOD,"POST"], params); | [HTTP_METHOD,"POST"], params); | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 14:08, 7 September 2017
Commands bot to send money (L$) to a specific object. Also see give_money command.
Variables
The following table shows input values (you send them with the API call) and returned output values.
Variable | Required | Description | ||
---|---|---|---|---|
Input basic parameters: | ||||
action | yes | = give_money_object | ||
apikey | yes | Your personal developer's API key. | ||
botname | yes | Your bot's SL login. | ||
secret | yes | Bot access code of your bot. | ||
dataType | optional | Set to "json" to get JSON reply instead of URL-encoded string | ||
custom | optional | The custom data (string) to be passed back to caller script. This value will be returned back to the caller in HTTP response. | ||
Input: | ||||
object_uuid | yes | The object UUID. | ||
amount | yes | The amount of money to send. | ||
object_name | (optional) Object name. | |||
Output: | ||||
(to be received in http_response LSL event, see docs for details) | ||||
result | OK - command completed successfully FAIL - command failed | |||
resulttext | Detailed reason for the failure. | |||
custom | The value from input "custom" parameter. See above. |
Comments
SL requires that the object name be sent along with the query. However, as of 2015/04/02, the function works even if no object name specified.
Note: Bot and object have to reside in the same sim.
Error messages
Bot returns either result=OK on a successful transaction, or result=FAIL&resulttext=text-string to indicate the problem occurred (usually a low bot's balance).
Example
The following example sends L$10 to a mysterious object in-world:
string params = llDumpList2String([
"action=" + "give_money_object",
"apikey=" + llEscapeURL(sbApiKey),
"botname=" + llEscapeURL(sbBotName),
"secret=" + llEscapeURL(sbBotAccessCode),
"object_uuid=" + "6e4f1662-19ec-b06c-7625-2c0c2595060f",
"amount=" + "10",
"object_name=" + ""
], "&");
llHTTPRequest("https://api.mysmartbots.com/api/bot.html",
[HTTP_METHOD,"POST"], params);
<< return back to Bot commands
(Miss an API call or parameter? Submit your request in forum)