[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/soul_categories.c

A handler to categorise souls (and some words) so NPCs can easily respond to or use certain types.

Written by Kaylar

Started June 2006

Method index

Public Functions

These are functions that everyone can access.

get_souls
string * get_souls(string category,
                   int a_r_t_w)

This method gets an array of souls of the desired category.

Parameters:
category - The category of souls. You can choose either sub categories like "happiness_laugh" or full categories like "happiness". A list can be seen with query_soul_categories(). There are a few special categories not listed including "touch", "nice" and "nasty".
a_r_t_w - Set this to 1 if you want the souls to have the "@" in front that they need for an add_respond_to_with, and 0 for just the souls.

Returns:
An array of the souls matching the category.

See also:
query_soul_categories.c, get_words.c and query_word_categories .c

Example:
 string *souls;

 souls = ("/obj/handlers/soul_categories")->get_souls( "laughter", 1 );

 if( sizeof( souls ) ) {
   add_respond_to_with( ({ souls }), "you" }), "'Stop laughing at me!" );
 }

get_words
string * get_words(string category)

This method gets an array of words of the desired category.

Parameters:
category - The category of words. You can choose either sub categories like "greetings_weird" or full categories like "greetings". A list can be seen with query_word_categories()

Returns:
An array of the words matching the category.

See also:
query_word_categories.c, get_souls.c and query_soul_categories .c

Example:
 string *words;

 words = ("/obj/handlers/soul_categories")->get_words( "greetings", 1 );

 if( sizeof( words ) ) {
   add_respond_to_with( ({ "@say", words }), "greet $hname$" );
 }

is_soul_in_category
int is_soul_in_category(string soul,
                        string category)
is_word_in_category
int is_word_in_category(string word,
                        string category)
query_soul_categories
string * query_soul_categories()

This method queries all the categories of souls.

Returns:
An array of all soul categories.

See also:
get_souls .c


query_word_categories
string * query_word_categories()

This method queries all the categories of words.

Returns:
An array of all word categories.

See also:
get_words .c


set_souls
void set_souls()
set_words
void set_words()