| API Configuration
To enable to API on solitaire games you must set a API channel in the configuration notecard located inside the machine. Make sure that this value is only configured once in each machine, in the event of multiple entries the machine will load the last one.
APIChannel,-7144665
APIPassword,test
The APIChannel must be a negative number and be -2 or lower, -1 will disable the API.
Once enabled reset the game, if configured correctly the game will notify you of the API configuration like this:
"Warning, an API Channel Has Been Configured as -7144665.
If you are not using this channel for a third party device you should change it to -1 to disable this feature."
Messages sent by the game
The game will send messages on the channel configured after each game. Each message will be a comma separated value string (CSV). The order of the messages is as follows:
0) Security Password (not encrypted)
1) Player name
2) Player key
3) Game type (klondike, yukon,...)
4) Game Number Of ReDeals (-1 = unlimited)
5) Amount paid by the player
6) Amount won by the player
7) Score reached (number of cards (doublets each match = 2, spiderette each set = 13)
8) Score to beat (-1 if pay per card)
9) Payout per card (in linden dollars [divide by #5 to get %], -1 if all or nothing)
10) Payout Multiplier (pot for freeplay, -1 if ppc)
11) Payout Type (0 = PPC, 1 = AON, 2 = FREEPLAY)
12) Length of game in seconds
13) Number of moves made by the player during the game
Receiving the messages
Messages sent from the game use the llRegionSay() command. If you intend on using games in multiple regions you must setup a method of repeating the messsages across sim borders. The following code will capture the message and format it into a list.
integer APIChannel = -7144665;
list data;
default
{
state_entry()
{
llListen( APIChannel, "", NULL_KEY, "" );
}
listen( integer channel, string name, key id, string message )
{
if ( channel == APIChannel )
{
data = llCSV2List(message);
//do somthing with the data here
}
}
}
|