[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/options_handler.c

This handler deals will the options a player has. It will return the list of options, set options and control how the options can be set.

Written by Pinkfish

Started Thu Jun 8 17:13:47 PDT 2000

Includes

This class includes the following files /include/error_handler.h, /include/ls.h, /include/cmds/options.h, /include/cmds/teach.h, /include/terrain_map.h, /include/creator.h, /include/top_ten_tables.h, /include/obj_parser.h, /include/localtime.h, /include/player.h, /include/am_time.h, /include/colour.h, /include/newbiehelpers.h, /include/options_handler.h, /include/clubs.h and /include/playtesters.h

Method index

Public Functions

These are functions that everyone can access.

convert_birthday
string convert_birthday(string str)
is_option
int is_option(object player,
string name)

This method checks to see if the specified option path exists. This will only return true if it is an actual option, not an option group.

Parameters:
player - the player this is relative to
name - the option path to check

Returns:
1 if it is an option, 0 if not


is_option_group
int is_option_group(object player,
string name)

This method checks to see if the specified option group path exists. This will only return true if it is an option group, not an actual option.

Parameters:
player - the player this is relative to
name - the option path to check

Returns:
1 if it is an option group, 0 if not


query_all_options
mapping query_all_options()
query_option_behaviour
mixed query_option_behaviour(object player,
string name)

This function returns the types of the options in this category. It should correspond to the value returned by query_option_values().

Parameters:
player - the player this is relative to
name - the name of the option

Returns:
the allowed parameters


query_option_help
string query_option_help(object player,
string path)

This method returns the help string of the specified option.

Parameters:
player - the player to find the value on
path - the path to the option


query_option_value
string query_option_value(object player,
string path)

This method returns the value of the specified option.

Parameters:
player - the player to find the value on
path - the path to the option


query_option_values
string * query_option_values(object player,
string name)

This method returns the different values this option can be set to.

Parameters:
player - the player this is relative to
name - the name of the option

Returns:
the allowed parameters


query_sub_options
string * query_sub_options(object player,
string name)

This method returns all the sub options and option groups at this level.

Parameters:
player - the player this is relative to
name - the path to return the suboptions of

Returns:
the sub options of the path


set_option_value
int set_option_value(object player,
string path,
string value)

This method sets an option value on the player.

Parameters:
player - the player to find the value on
path - the path to the option
value - the value directly from the command line


set_timezone_name
int set_timezone_name(object player,
string tz_name)
set_timezone_offset
int set_timezone_offset(object player,
float tz_offset)
valid_birthday
int valid_birthday(object person,
string str)

Protected Functions

These are functions that only objects inheriting the class can access.

add_option
int add_option(string name,
mixed type,
int cre_only,
function set_function,
function query_function,
string help)

This method adds in an option for the player to be able to set. The set function will be called with two parameters, the value to set it to and the variable being set. The set function must return 1 if the value was successfuly set.

int set_function(variable, value);

Parameters:
name - the name of the option eg: "output look"
type - the type of the option eg: OPTIONS_TYPE_BRIEF
cre_only - 1 if cre only, 0 if available for all
set_function - the function to call to set the option
query_function - the function to call to query the option
help - a short notice to what the option manipulates

Returns:
1 if successful, 0 if not


add_option_to_mapping
void add_option_to_mapping(mapping array,
string name,
mixed type,
int cre_only,
function set_function,
function query_function,
string help)

This method adds in an option for the player to be able to set to a mapping. This method should be used by all the dynamic tree methods to create leaves.

Parameters:
array - the mapping to add the elements to
path - the path to the option eg: ({ "output", "look" })
type - the type of the option eg: OPTIONS_TYPE_BRIEF
set_function - the function to call to set the option
query_function - the function to call to query the option

Returns:
1 if successful, 0 if not