Stats

The Stats include contains wrapper functions provided by the SRL Stats API. The functions contained are meant for ease of use for implementation into scripts.

The source for this file can be found here.

var User-set Variables

The variables that need to be set in any script that uses the SRL stats system.

  • statsUsername: The username of the stats user. The same username used to login to stats.villavu.com.
  • statsPassword: The password of the stats user. The same password used to login to stats.villavu.com.
  • statsScriptID: The ID of the current script. Script ID’s can be found here.

statsSetup

procedure statsSetup(scriptID: integer; username, password: string);

Initializes all variables necessary for SRL stats to function. Username and password are not case sensitive. If stats username and password are not set, the global variables are set to Anonymous.

Note

  • by Nava2
  • Last Updated: 05 August 2013 by Coh3n

Example:

statsSetup(64, 'SRL-Developers', 'SRLSRLSRL');

__statsInitVariable

__statsInitVariable(VarName: String; InitValue: Integer);

Helper method to clean up code in the include. Removes some repeating code internally.

Note

  • by Nava2
  • Last Updated: 05 August 2013 by Coh3n

Warning

Use of this method outside of this include may lead to multiple variables of the same name. It does not check to see if the variable is already present.

__statsInitVariable('coal', 0);

statsSetVariable

statsSetVariable(VarName: string; NewValue: Integer);

Sets the passed variable to the new value regardless of old value. This method behaves much like __statsInitVariable but checks for the variable present first.

Note

  • by Nava2
  • Last Updated: 05 August 2013 by Coh3n

Example:

statsSetVariable('runite', 10);

statsIncVariable

procedure statsIncVariable(VarName: string; Value: integer);

Increments a variable by the value passed.

Note

  • by Nava2
  • Last Updated: 05 August 2013 by Coh3n

Example:

statsIncVariable('cod', 69);

statsCommit

function statsCommit: Boolean;

Sends all the information currently stored in the system to the server. Returns true if commit was successful, displays error messages. One should note that the stats variables are set to 0 on commit.

Note

  • by Nava2
  • Last Updated: 05 August 2013 by Coh3n

Example:

if (statsCommit) then
  WriteLn('We are success.');