[Package Index | Mudlib Index | Effect Index]

File /obj/crafts/pottery/wheel_inherit.c

An inherit for a pottery wheel. It can be cloned and the description customised, as well as what sorts of pots can be made on it. It would be better to create a separate file which inherits this rather than cloning on the fly in a room. If added as a hidden object, the room that contains the wheel must be set. Once the pot has been created its description cannot be changed, so ensure that your add_pot details are free of typos.

Written by Kaylar

Started June 2005

Inherits

This class inherits the following classes /std/surface.c

Includes

This class includes the following files /include/tasks.h, /include/crafts/crafts_rewards.h and /include/crafts/pottery.h

Method index

Public Functions

These are functions that everyone can access.

add_pot
void add_pot(string key,
             string name,
             string pot_type,
             string * longs,
             string difficulty,
             int use_colour)

This function adds a pot to the pots that can be made on this wheel.

Parameters:
key - The key used to add the pot to the mapping, this must be unique to each pot. It will be used in the list of allowable pots and as the short description of the pot. (Don't forget that an adjective will also be added to the short, so it should suit ).
name - The name of the pot, it will be used as the name of the final product it should be one word.
pot_type - The type of pot as defined in "/include/crafts/pottery.h" Pots that can act as furniture will be automatically more difficult to mould.
longs - An array of long descriptions in the order of marginal, normal, exceptional, critical successes, marginal and normal failures. As exceptional and critical failures result in no pot being created, you cannot set a long for them. For those too lazy to write six different descriptions, just write one that could apply to all conditions (still in an array though). Note: The long description should be a string without the "\n" on the end. If you want an adjective or adverb shown, use $adjective$ or $adverb$ respectively and $a_adjective$ and $a_adverb$ for the add_a-ised version. The adjective will be used in the short whether you use it in the long or not.
difficulty - How difficult it is to make the pot, either "easy", "medium", "difficult", or "expert".
use_colour - Set this to 1 if you want the colour of the glaze to show in the short description before the last word, 2 if you want the colour to show before the last two words and 0 if you don't want it in the short at all. " Djelian vase" would have use_colour set to 2 " traditional vase" would have use_colour set to 1 " bud vase" would have use_colour set to 0

See also:
set_result_adjectives() and set_result_adverbs()

Example:
 add_pot( "pyramid bowl", "bowl", MEDIUM_SQUARE, ({ "This is a vaguely "
   "pyramid-shaped bowl crafted from clay.", "This $adjective$ bowl "
   "is shaped like a pyramid.", "$a_adverb$ hand-made copy of a classic "
   "Klatchian style of bowl.  It looks rather like a pyramid with "
   "the top cut off as the sides rise from its square base obliquely.",
   "This bowl has been so well crafted in a classical Klatchian style "
   "that it looks like a minature pyramid.  One could imagine tiny "
   "sarcophagi entombed within it for all time.", "This $adverb$ crafted "
   "bowl looks somewhat like a distorted pyramid.", "This bowl can "
   "politely be described as \"uninspired\", it can be impolitely "
   "described as many other things." }), "expert", 2 );

do_mould
int do_mould(object * obs,
             string dir_match,
             string indir_match,
             mixed * args,
             string pattern)
do_throw
int do_throw(object * obs,
             string dir_match,
             string indir_match,
             mixed * args,
             string pattern)
make_pot
void make_pot(int left,
              mixed args)
query_in_use
int query_in_use()

Returns whether the wheel is in use (moving).

Returns:
1 if the wheel is moving, 0 if not.


query_pots
mapping query_pots()

Returns a mapping of the pots that can be made on this wheel.

Returns:
a mapping of the pots, the key is the label displayed to the player in the mould command, the value is an array of the name, pot_type, longs, and difficulty.


set_cannot_be_used_reason
void set_cannot_be_used_reason(string reason)

This function sets the reason given if the wheel cannot be used (useful for quests and the like). For this to work you should also have a function called cannot_be_used( object player ) which will be passed the player and should return a 1 if the wheel cannot be used and a 0 if it can.

Parameters:
reason - The reason.


set_result_adjectives
void set_result_adjectives(mixed * adjectives)

This function allows you to set the adjectives used to describe the pots created by this wheel based on how well the player passes the skillcheck. The adjective is used in the short and in the long if you so desire. If an array of arrays is used then a random adjective is chosen. If this is not set then the default adjectives will be used.

Parameters:
adjectives - An array or mixed array of six adjectives, firstly successes from marginal to critical then failures from marginal to normal (exceptional and critical failures cause the clay to fly off the wheel).

See also:
set_result_adverbs() and add_pot()

Example:
 set_result_adjectives( ({ ({ "simple", "basic" }), ({ "modern", "chic" }),
   ({ "pretty", "elegant" }), ({ "extravagant", "artistic" }), ({ "ugly",
   "unattractive", "lop-sided" }), ({ "bumpy", "uneven", "hideous" }) }) );

 set_result_adjectives( ({ "plain", "attractive", "classy", "unique",
   ({ "crooked", "uneven" }), ({ "ugly", "distorted" }) }) );

set_result_adverbs
void set_result_adverbs(mixed * adverbs)

This function allows you to set the adverbs that can be used in the long of a pot to show how well the player passes the skillcheck. If an array of arrays is used then a random adverb is chosen. If this is not set then the default adverbs will be used.

Parameters:
adverbs - An array or mixed array of six adverbs, firstly successes from marginal to critical then failures from marginal to normal (exceptional and critical failures cause the clay to fly off the wheel).

See also:
set_result_adjectives() and add_pot()

Example:
 set_result_adverbs( ({ "carefully", "skillfully", "artistically",
   "beautifully", ({ "carelessly", "poorly" }), "ineptly" }) );

set_room
void set_room(object room_ob)

This sets the room that the wheel is cloned into, this must be set if you add it as a hidden object. You can do this after the wheel is cloned by using a call other on the wheel in the room code.

Parameters:
room_ob - The room object.

Example:
wheel = clone_object( "/d/your/wheel" );
wheel->reset_get();
wheel->set_room( this_object() );
add_hidden_object( wheel );

test_add
int test_add(object ob,
             int flag)
test_remove
int test_remove(object ob,
                int flag,
                mixed dest)