CasperLet/API: Difference between revisions

From CasperTech Wiki
Jump to navigation Jump to search
(Created page with "= '''<span style="color:#00528c">API Documentation</span>''' = == V1 API == Here's the V1 API. This is supported by all CasperLET versions. Our linked message is as follows...")
 
mNo edit summary
Line 1: Line 1:
{|align=right
  |__TOC__
  |}
= '''<span style="color:#00528c">API Documentation</span>''' =
= '''<span style="color:#00528c">API Documentation</span>''' =


Line 44: Line 47:
You can use these as follows:
You can use these as follows:


===PAY===
==== PAY ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-PAY", PAYER_KEY );  
llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-PAY", PAYER_KEY );  
Line 58: Line 61:
BE WARNED: This WILL SIMULATE PAYMENT.  Which means, if the payment is rejected, money will be REFUNDED.
BE WARNED: This WILL SIMULATE PAYMENT.  Which means, if the payment is rejected, money will be REFUNDED.


===SAFEPAY===
==== SAFEPAY ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-SAFEPAY", PAYER_KEY );  
llMessageLinked( LINK_THIS, AMOUNT_PAID, "CLAPI-SAFEPAY", PAYER_KEY );  
Line 70: Line 73:
This provides a way to simulate payment to the unit, but WITHOUT any refunds, profit shares, or messages to the user.
This provides a way to simulate payment to the unit, but WITHOUT any refunds, profit shares, or messages to the user.


===UPDATE===
==== UPDATE ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-UPDATE", NULL_KEY );  
llMessageLinked( LINK_THIS, 0, "CLAPI-UPDATE", NULL_KEY );  
Line 82: Line 85:
This triggers the unit to spit out the linked messages and data on channel 77777. The integer can be any number.
This triggers the unit to spit out the linked messages and data on channel 77777. The integer can be any number.


===Reset===
==== RESET ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Reset", NULL_KEY );  
llMessageLinked( LINK_THIS, 0, "CLAPI-Reset", NULL_KEY );  
Line 94: Line 97:
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.
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===
==== TOUCH ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-TOUCH", TOUCHER_KEY );  
llMessageLinked( LINK_THIS, 0, "CLAPI-TOUCH", TOUCHER_KEY );  
Line 106: Line 109:
This triggers the unit to give the user indicated by TOUCHER_KEY the standard dialog menu.
This triggers the unit to give the user indicated by TOUCHER_KEY the standard dialog menu.


===Info===
==== INFO ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Info", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Info", USER_KEY);  
Line 121: Line 124:
This command is synonymous to the user indicated by USER_KEY pressing the Info button, except it won't deliver the notecard.
This command is synonymous to the user indicated by USER_KEY pressing the Info button, except it won't deliver the notecard.


===TimeLeft===
==== TIMELEFT ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-TimeLeft", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-TimeLeft", USER_KEY);  
Line 135: Line 138:
This command is synonymous to the user indicated by USER_KEY pressing the TimeLeft button
This command is synonymous to the user indicated by USER_KEY pressing the TimeLeft button


===Evict===
==== EVICT ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Evict", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Evict", USER_KEY);  
Line 150: Line 153:




===Refund===
==== REFUND ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Refund", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Refund", USER_KEY);  
Line 164: Line 167:
This command is synonymous to the user indicated by USER_KEY pressing the Refund button
This command is synonymous to the user indicated by USER_KEY pressing the Refund button


===Prim Count===
==== PRIM COUNT ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Prim Count", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Prim Count", USER_KEY);  
Line 178: Line 181:
This command is synonymous to the user indicated by USER_KEY pressing the Prim Count button
This command is synonymous to the user indicated by USER_KEY pressing the Prim Count button


===Won't Renew===
==== WON'T RENEW ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Won't Renew", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Won't Renew", USER_KEY);  
Line 192: Line 195:
This command is synonymous to the user indicated by USER_KEY pressing the Won't Renew button
This command is synonymous to the user indicated by USER_KEY pressing the Won't Renew button


===Reminders===
==== REMINDERS ====
<lsl>
<lsl>
llMessageLinked( LINK_THIS, 0, "CLAPI-Reminders", USER_KEY);  
llMessageLinked( LINK_THIS, 0, "CLAPI-Reminders", USER_KEY);  
Line 206: Line 209:
This command is synonymous to the user indicated by USER_KEY pressing the Reminders button
This command is synonymous to the user indicated by USER_KEY pressing the Reminders button


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

Revision as of 18:40, 6 July 2013

API Documentation

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

<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

<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

<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

<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

<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

<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

<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

<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

<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