00.0 | Setting the variables for use |
01.0 | Saving a variable from Palace to a user |
02.0 | Returning a variable from Palace back to user. |
03.0 | Script Examples |
A-0 | Plugin Installation |
00.0 Setting the variables for use |
IptStats only supports variables that you specify as a security measure. To define a variable that PalStats can use, just add them seperated by spaces in the plugin.conf file when you install the plugin. e.g.: ../iptstats.so variable1 variable2 varibale3 blahvariable This would create the variables variable1 variable2 variable3 and blahvariable. All variables will be deleted after 5 days if the user does not log on. |
01.0 Saving a variable from Palace to a user |
Say I wanted to save the variable "variable1" to a user using iptscrae? It's simple! All I'd do is make a door (in this example ID 1) with the name SetStats-variable1. Then I could set a number to the variable by executing 23831 2 setspotstate. This would set variable1 to 23831 in the plugin. You wrote 23831 to door ID 2, which the plugin monitors, and in turn, the plugin set 23831 to variable1. This will be saved to the iptstats.ini in the following format: [<REGHASH>:<TIMESTAMP>] variable1=23831 |
02.0 Returning a variable from Palace back to user |
To retrieve the variable 23831 from the user, you'll now need to make another door. Let's say the doorid is 5, you'll make the doorname "GetStats-variable". When the user with the saved variable logs back in, the spotstate SHOULD change to 23831. If it doesn't, you did something wrong.
It's that simple! |
03.0 Script Examples |
Load the plugin:
../iptstats.so Variable If you have game stats you'd like to Load at SIGNON, apply this to a spot/door named GetStats-Variable. ON SIGNON { ME GETSPOTSTATE Variable DUP GLOBAL = } If you have game stats you'd like to Save on SELECT, apply this to a spot/door named SetStats-Variable. ON SELECT { Variable DUP GLOBAL ME SETSPOTSTATE } A good Iptscrae scripter might be wondering, since Iptscrae integers are 4 bytes wide ( -2147483648 < 0 < 2147483647 ), and spot states are 2 bytes wide ( -32768 < 0 < 32767 ). How can you 'squeeze' Iptscrae into a spot states? Simple! Try naming your variables something like VarHigh and VarLow ( High bytes vs Low bytes ). Spot/Door name SetStats-VarHigh ON SELECT { VarHigh 32767 / DUP GLOBAL ME SETSPOTSTATE } Spot/Door name SetStats-VarLow ON SELECT { VarLow 32767 % DUP GLOBAL ME SETSPOTSTATE } That right there will seperate the 2 upper bytes from the 2 lower bytes, and allow you to save both. Then to restore both halfs... Spot/Door name GetStats-VarHigh ON SIGNON { ME GETSPOTSTATE 32767 * VarHigh DUP GLOBAL = } Spot/Door name GetStats-VarLow ON SIGNON { ME GETSPOTSTATE VarLow DUP GLOBAL += } Many more applications for this plugin exist and are still out there! If you have the talent to create them, then I wish you luck! |
A-0 Plugin Installation |
Assuming the server is installed in the standard directory called "palace", perform the following steps:
|