Difference between revisions of "HTTP API/Bot Commands/parcel info update"
From SmartBots Developers Docs
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE: parcel_info_update}} | {{DISPLAYTITLE: parcel_info_update}} | ||
− | <onlyinclude>Update parcel details</onlyinclude> | + | <onlyinclude>Update parcel details, including the name, description and selling options</onlyinclude> |
+ | |||
+ | <syntaxhighlight lang="lsl"> | ||
+ | // See "LSL Helper Functions" page for this function | ||
+ | smartbotsAPI("parcel_info_update", [ | ||
+ | "x", 30, | ||
+ | "y", 60, | ||
+ | "name", "The new name of the parcel", | ||
+ | "sale", "on", | ||
+ | "saleprice", 1500, | ||
+ | "sellto", "cd93067e-7c4e-41c0-ba91-be01f4bafe35" | ||
+ | ]); | ||
+ | </syntaxhighlight> | ||
{{API Variables Table}} | {{API Variables Table}} | ||
Line 9: | Line 21: | ||
{{API Variable|x|no}} the X coordinate of the parcel (default - at bot's position) | {{API Variable|x|no}} the X coordinate of the parcel (default - at bot's position) | ||
{{API Variable|y|no}} the Y coordinate of the parcel (default - at bot's position) | {{API Variable|y|no}} the Y coordinate of the parcel (default - at bot's position) | ||
− | {{API Variable| | + | {{API Variable|name|no}} The parcel name |
− | {{API Variable| | + | {{API Variable|description|no}} The parcel description |
− | {{API Variable| | + | {{API Variable|musicurl|no}} The parcel music URL |
+ | {{API Variable|sale|no}} Set to "on" to set land for sale, "off" to stop selling | ||
+ | {{API Variable|saleprice|no}} The selling price | ||
+ | {{API Variable|sellto|no}} The person UUID allowed to purchase this parcel | ||
+ | {{API Variable|sellobjects|no}} Set to "on" to allow selling objects with the parcels ("off" to disallow) | ||
+ | {{API Variable|snapshot|no}} The UUID of the picture to be set as a parcel image | ||
+ | {{API Variable|landingpoint|no}} The parcel landing point, format: "X/Y/Z" | ||
+ | {{API Variable|landingrouting|no}} The landing restrictions on the parcel, one of: | ||
+ | |||
+ | * Direct - land anywhere | ||
+ | * LandingPoint - teleport to landing point only | ||
+ | * None - teleport is blocked | ||
{{API Variable Group|Output}} | {{API Variable Group|Output}} | ||
Line 18: | Line 41: | ||
{{API Variables Table End}} | {{API Variables Table End}} | ||
− | == | + | == Permissions == |
− | + | Your bot has to own the parcel, or have some of the permissions: | |
− | + | * Parcel identity > "Change parcel name, description, and 'Moderate Content' setting" | |
− | + | * Parcel settings > "Change music & media settings" | |
+ | * Parcel Management > "Set land for sale info" | ||
− | |||
− | |||
− | + | [[Image:Parcel permissions.png|center|link=]] | |
− | : | + | |
− | |||
− | |||
− | + | '''IMPORTANT:''' SL requires you to re-log avatar when you change the parcel group abilities. Thus, relog bot after changing them. | |
− | : | + | |
− | + | == Selling parcel == | |
− | + | ||
− | + | This function is being used to set the sell price of the parcel: | |
− | + | ||
− | + | <syntaxhighlight lang="lsl"> | |
− | + | // See "LSL Helper Functions" page for this function | |
+ | smartbotsAPI("parcel_info_update", [ | ||
+ | // No x and y given, this sell parcel under the bot | ||
+ | "sale", "on", | ||
+ | "saleprice", 1500, | ||
+ | // This is an optional parameter: | ||
+ | "sellto", "cd93067e-7c4e-41c0-ba91-be01f4bafe35" | ||
+ | ]); | ||
− | + | == Checking parcel update results == | |
− | + | ||
− | + | SL does not notify bot if parcel update was successful. | |
− | + | ||
− | + | Thus, to ensure the results, bot | |
− | + | ||
− | + | # updates the parcel, | |
+ | # then re-reads the parcel details from SL and compares them with expected values. | ||
− | + | If your bot lacks any permissions (for example, "Set landing point and set teleport routing"), then expected parcel data won't match the actual parcel details. And you get an error from API. | |
− | + | == Return values == | |
− | + | Use [https://www.mysmartbots.com/api/testing.html API testing suite] to test this API function. | |
− | + | ||
− | + | ||
− | + | [[Image:Parcel update api.png|center|link=]] | |
− | |||
− | The command returns | + | The command returns |
+ | |||
+ | result=OK | ||
+ | |||
+ | if parcel update succeed. | ||
{{HTTP API Bot - standard footer}} | {{HTTP API Bot - standard footer}} |
Latest revision as of 16:47, 16 January 2020
Update parcel details, including the name, description and selling options
// See "LSL Helper Functions" page for this function
smartbotsAPI("parcel_info_update", [
"x", 30,
"y", 60,
"name", "The new name of the parcel",
"sale", "on",
"saleprice", 1500,
"sellto", "cd93067e-7c4e-41c0-ba91-be01f4bafe35"
]);
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 | = parcel_info_update | ||
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: | ||||
x | optional | the X coordinate of the parcel (default - at bot's position) | ||
y | optional | the Y coordinate of the parcel (default - at bot's position) | ||
name | optional | The parcel name | ||
description | optional | The parcel description | ||
musicurl | optional | The parcel music URL | ||
sale | optional | Set to "on" to set land for sale, "off" to stop selling | ||
saleprice | optional | The selling price | ||
sellto | optional | The person UUID allowed to purchase this parcel | ||
sellobjects | optional | Set to "on" to allow selling objects with the parcels ("off" to disallow) | ||
snapshot | optional | The UUID of the picture to be set as a parcel image | ||
landingpoint | optional | The parcel landing point, format: "X/Y/Z" | ||
landingrouting | optional | The landing restrictions on the parcel, one of:
| ||
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. |
Permissions
Your bot has to own the parcel, or have some of the permissions:
- Parcel identity > "Change parcel name, description, and 'Moderate Content' setting"
- Parcel settings > "Change music & media settings"
- Parcel Management > "Set land for sale info"
IMPORTANT: SL requires you to re-log avatar when you change the parcel group abilities. Thus, relog bot after changing them.
Selling parcel
This function is being used to set the sell price of the parcel:
// See "LSL Helper Functions" page for this function
smartbotsAPI("parcel_info_update", [
// No x and y given, this sell parcel under the bot
"sale", "on",
"saleprice", 1500,
// This is an optional parameter:
"sellto", "cd93067e-7c4e-41c0-ba91-be01f4bafe35"
]);
== Checking parcel update results ==
SL does not notify bot if parcel update was successful.
Thus, to ensure the results, bot
# updates the parcel,
# then re-reads the parcel details from SL and compares them with expected values.
If your bot lacks any permissions (for example, "Set landing point and set teleport routing"), then expected parcel data won't match the actual parcel details. And you get an error from API.
== Return values ==
Use [https://www.mysmartbots.com/api/testing.html API testing suite] to test this API function.
[[Image:Parcel update api.png|center|link=]]
The command returns
result=OK
if parcel update succeed.
{{HTTP API Bot - standard footer}}
{{NavMenu}}
__NOTOC__