Atrinik Client 2.5
Functions | Variables
client/scripts.c File Reference
#include <global.h>
#include <sys/wait.h>

Go to the source code of this file.

Functions

static void script_dead (int i)
static void script_process_cmd (int i)
static int script_by_name (const char *name)
static void script_send_item (int i, const char *head, const object *it)
void script_load (const char *cparams)
void script_list ()
void script_process ()
int script_trigger_event (const char *cmd, const uint8 *data, const int data_len, const enum CmdFormat format)
void script_send (const char *params)
void script_killall ()
void script_autoload ()
void script_unload (const char *params)

Variables

static struct scriptscripts = NULL
static int num_scripts = 0

Detailed Description

Implements client side scripting support.

Definition in file scripts.c.


Function Documentation

void script_autoload ( )

Automatically load selected scripts on startup of the client, read from file.

Definition at line 1167 of file scripts.c.

static int script_by_name ( const char *  name) [static]

Find a script by name.

Parameters:
nameName of the script. Can be numeric in which case it is compared against the number of loaded scripts.
Returns:
ID of the script, -1 if none found.

Definition at line 1127 of file scripts.c.

static void script_dead ( int  i) [static]

Free resources used by a script, and remove it from the scripts list.

Parameters:
iID of the script to remove.

Definition at line 1093 of file scripts.c.

void script_killall ( )

Kill all loaded scripts. Used by Win32 build of the client when exiting the client.

Definition at line 1078 of file scripts.c.

void script_list ( )

Print currently running scripts.

Definition at line 330 of file scripts.c.

void script_load ( const char *  cparams)

Load a script.

Parameters:
cparamsParameters. Includes path to the file and after that parameters to pass to the script.

Definition at line 92 of file scripts.c.

void script_process ( )

Process loaded scripts.

Definition at line 358 of file scripts.c.

static void script_process_cmd ( int  i) [static]

Process script command.

Parameters:
iID of the script.

Definition at line 437 of file scripts.c.

void script_send ( const char *  params)

Send a message by player to a running script.

Parameters:
paramsThe script name to find and send the message to.

Definition at line 1033 of file scripts.c.

static void script_send_item ( int  i,
const char *  head,
const object it 
) [static]

Send information about an item to script.

Parameters:
iID of the script.
headWhat to prefix the information with.
itThe item.

Definition at line 719 of file scripts.c.

int script_trigger_event ( const char *  cmd,
const uint8 data,
const int  data_len,
const enum CmdFormat  format 
)

Trigger a script event.

Parameters:
event_idID of the event.
void_dataData.
data_lenLength of the data.
Returns:
Always returns 0.

Definition at line 739 of file scripts.c.

void script_unload ( const char *  params)

Unload a script.

Parameters:
paramsScript name or ID. Uses script_by_name() to find the real script ID.

Definition at line 1199 of file scripts.c.


Variable Documentation

int num_scripts = 0 [static]

Number of scripts.

Definition at line 45 of file scripts.c.

struct script* scripts = NULL [static]

List of scripts.

Definition at line 42 of file scripts.c.