Author: Jonathan Kelley
Keywords: Palace Server; Palace Client; Palace Community; Communities.com; The Palace; ThePalace; IptStats
Date: 2005-03-22

IptStats v0.2.3 README

Preface
Copyright © 2004-2006 Paul Taylor

IptStats is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

The IptStats plugin and plugin source is distributed in the hope that it will be useful; but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should be able to get a copy of the GNU General Public License at:

- http://www.gnu.org/copyleft/gpl.html

But, if this site does not work, you can obtain a copy by writing a letter to:

- The Free Software Foundation
  59 Temple Place - Suite 330
  Boston, MA 02111-1307, USA.

What is IptStats?
IptStats is a FREE Palace Server plugin that allows a server owner to create scripts that'll Load/Save user information to the server. Think of it in terms of a server side 'cookie'.

Change Log

- Version Legend:
  - [+] - ADDED
  - [-] - DROPED
  - [*] - FIXED
  - [^] - CHANGED
  - [?] - BETA
- Version 0.2.3:
  - [*] Wouldn't compile with GNU's C Compiler 2.9x before, now she will! - All variables in GCC 2.9x must be declared at the top of a { block }.
- Version 0.1.2:
  - [-] a line ( optimized ) in cvtS2H( )
    [+] `else break;` to cvtH2S( )
- Version 0.0.1:
  - [?] Official Release!

Table of Contents
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: If necessary, create a `"plugins"` directory in the `palace/bin` directory. Put the `iptstats.so` file in the `palace/bin/plugins` directory. Create or modify the `palace/palace/psdata/plugin.conf` file which describes the active server plugins. Include a line for the IptStats Server Plugin: `../bin/plugins/iptstats.so` If you already have plugins on your server, you don't need to do the following step. Edit server/bin/start-palace replace: `$root/bin/pserver -f $root/$instance/psdata/pserver.conf` with: `$root/bin/pserver -f $root/$instance/psdata/pserver.conf -s $root/$instance/psdata/plugin.conf` NOTE: Make sure that this is just a single line in the file! This is particularly an issue when using an editor such as pico or nano.