CasperLet/API: Difference between revisions

From CasperTech Wiki
Jump to navigation Jump to search
Line 182: Line 182:


==== PRIM COUNT ====
==== PRIM COUNT ====
{{Warning|This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.}}
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Prim Count", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Prim Count", USER_KEY);  

Revision as of 09:35, 14 October 2015

API Documentation

API Works Only For System Owner

Please note: The API commands will only work from scripted objects owned by the same avatar that owns the copy of CasperLet they are being used on.

As most of you already know, it would be a security risk to allow the API commands to be used by anyone who's not the system owner.

V1 API

Here's the V1 API. This is supported by all CasperLET versions.

Our linked message is as follows:

<lsl>llMessageLinked(LINK_SET, (integer)timeLeft, "RTIME", rentedBy);</lsl>

rentedBy is the key of the current renter, timeLeft is the amount of time left in seconds.

If rentedBy == NULL_KEY then it means there is no renter, and the unit is available.

You can detect rental events by storing the last message. If the last message was NULL_KEY, and then the next one isn't, it means that someone rented the unit, and vice versa.

V2 API

The V2 API adds several new messages to provide extended information.

The first is REXTR:

REXTR|<time left>|<renter key or NULL_KEY if not rented>|<locked? 0 or 1>|<reserved key or NULL_KEY if not reserved>|<price per week>|<number of prims>|<is tenant over limit? 0 or 1>|<Unix timestamp on which the unit was rezzed>

We also provide some additional messages which provide useful information (both linked messages and broadcast on channel 77777.) The "string" value of the linked message will identify the message type, as described below.
ADDTNTS@userkey1#username1#userkey2#username2#userkey3#username3#userke.. (etc)
MANAGERS@managerkey1#managerkey2#managerkey3#managerkey4.. (etc)

Note the use of different delimiters on these messages, this is due to technical limitations.

All of the above information is also broadcasted on channel 77777. The following messages are only provided in linked messages:

String: BUTTONS Key: pricebox|paybutton1|paybutton2|paybutton3|paybutton4 (to correspond with llSetPayPrice)
String: TEXT Key: the floating text that is shown on the unit

As before, THERE IS NO GUARANTEE WHEN THE INFORMATION WILL BE SENT - So check for changes, rather than just reacting to the message.

In addition to this, the unit also accepts certain linked messages, as well as chat messages on channel -77777.

You can use these as follows:

PAY

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-PAY", PAYER_KEY ); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-PAY|"+(string)PAYER_KEY+"|"+(string)AMOUNT_PAID); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> This provides a way to simulate payment to the unit.

BE WARNED: This WILL SIMULATE PAYMENT. Which means, if the payment is rejected, money will be REFUNDED.

SAFEPAY

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-SAFEPAY", PAYER_KEY ); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-SAFEPAY|"+(string)PAYER_KEY+"|"+(string)AMOUNT_PAID); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> This provides a way to simulate payment to the unit, but WITHOUT any refunds, profit shares, or messages to the user.

UPDATE

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-UPDATE", NULL_KEY ); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-UPDATE|UPDATE|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> This triggers the unit to spit out the linked messages and data on channel 77777. The integer can be any number.

RESET

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Reset", NULL_KEY ); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Reset|"+NULL_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> This triggers the unit to reset. Please use this ONLY when absolutely necessary - if a unit restarts too often, it will be blocked from the network.

TOUCH

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-TOUCH", TOUCHER_KEY ); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-TOUCH|"+TOUCHER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> This triggers the unit to give the user indicated by TOUCHER_KEY the standard dialog menu.

INFO

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Info", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Info|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl>

Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Info button, except it won't deliver the notecard.

TIMELEFT

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-TimeLeft", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-TimeLeft|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the TimeLeft button

EVICT

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Evict", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Evict|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Evict button

REFUND

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Refund", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Refund|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Refund button

PRIM COUNT

This command is handed by the CasperTech servers. Do not make unreasonably frequent or repeated requests.

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Prim Count", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Prim Count"+USER_KEY+"|"+ id +"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Prim Count button

WON'T RENEW

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Won't Renew", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Won't Renew|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Won't Renew button

REMINDERS

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Reminders", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Reminders|"+USER_KEY+"|0" ); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl> Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Reminders button

LOCK / UNLOCK

<lsl> llMessageLinked( LINK_THIS, 0, "CLAPI-Lock/Unlock", USER_KEY); </lsl>

.. or ..

<lsl> llRegionSayTo( KEY_OF_UNIT, -77777, "CLAPI"+KEY_OF_UNIT+"-Lock/Unlock|"+USER_KEY+"|0"); // where KEY_OF_UNIT is the uuid of the rental box/meter </lsl>

Please pay attention to the case of the command above.

This command is synonymous to the user indicated by USER_KEY pressing the Lock/Unlock button

FAQ / Troubleshooting

Q. Is there a way to get the unit to spit out any data on additional tenants?
A. This information is only sent when there are additional tenants added or removed. If there are never additional tenants added or removed, you won't get a message. (If you don't get a message even AFTER you add additional tenants, then file a bug ticket @ Casper's bug ticketing system).
Q. The API documentation says:
  llRegionSay( -77777, "CLAPI-UPDATE"+KEY_OF_UNIT+"|UPDATE|0" );    
  // where KEY_OF_UNIT is the uuid of the rental box/meter
but when I stand next to the box and say this in local chat, nothing happens:
  -77777 CLAPI-UPDATE|5194ac0b-4a9f-5c4b-d24e-e0a374533f1d|UPDATE|123
A. Rental units do NOT respond to avatars. The command will need to be coming from a scripted object.