Object Functions for Mocha
Dealing with object types
- integer obj.type;
- Returns the type of the object, a constant from the following list:
Functions for each type of object are given on separate pages (use the links
above; types with no link have no additional properties).
Coins are a special type of object with their
own set of functions.
- boolean obj.is_container;
- Indicates that the object is a container (a chest or a sack).
- boolean obj.is_sticky;
- Indicates that the object cannot be removed or dropped.
- integer lookup_object_type (string name);
- Returns the object type specified by name, or no_match if
the string matches no object type.
Finding general aspects
- integer obj.timer;
- void set_object_timer (object obj, integer timer);
- Determine or set the decay timer for an object. A value of 0 indicates
that the object never decays. Any other value must be above 0 and indicates
the number of mud hours remaining until the object decays.
- integer obj.size;
- void set_object_size (object obj, integer size);
- Determine or set the size of an object in inches.
- integer obj.weight;
- void set_object_weight (object obj, integer weight);
- Determine or set the weight of an object in grams.
- integer obj.value;
- void set_object_value (object obj, integer value);
- Determine or set the value of an object in obsidian coins.
The value of the object in obsidian coins must be in the range 0 to 8000.
- integer mod_type (object obj, integer index);
- integer mod_amount (object obj, integer index);
- void set_object_mod (object obj, integer index, integer type, integer amount);
- Determine or set the type or amount of an object modifier. Each object
is allowed up to two modifiers (with indices 1 and 2). The type of a modifier
is a constant drawn from the following list:
- modify_age -- modifies age
- modify_alignment -- sets alignment to the amount * 10
- modify_armor -- modifies armor
- modify_attack -- modifies attack bonus
- modify_charisma -- modifies charisma
- modify_constitution -- modifies constitution
- modify_damage -- modifies damage
- modify_dexterity -- modifies dexterity
- modify_heal -- modifies healing rate
- modify_hit_points -- modifies maximum hit points
- modify_intelligence -- modifies intelligences
- modify_move_points -- modifies maximum movement points
- modify_none -- modifies nothing
- modify_save_breath -- modifies saves against breath weapons
- modify_save_disbelief -- modifies saves against disbelief
- modify_save_petrification -- modifies saves against petrification
- modify_save_poison -- modifies saves against poison
- modify_save_spell -- modifies saves against spells
- modify_sex -- sets sex to the amount
- modify_speed -- modifies attack speed
- modify_spell_points -- modifies maximum spell points
- modify_strength -- modifies strength
- modify_wisdom -- modifies wisdom
The amount must follow the guidelines specified in the object
creator.
Checking and setting flags
A group of boolean object members allows a handler to check for the
presence of any particular flag on an object, whether it be a simple
object flag, a flag indicating wearability, or a flag marking an
object's affects. As with all modifiable flags, those of level
Eternal and higher may change a flag using the set_<member name>
(object obj, boolean value) function, where member name is the
flag's member name. The following list describes the members and
functions.
- boolean obj.is_anti_cleric;
- Indicates that the object is unusable by clerics.
- boolean obj.is_anti_evil;
- Indicates that the object is unusable by those of evil alignment.
- boolean obj.is_anti_good;
- Indicates that the object is unusable by those of good alignment.
- boolean obj.is_anti_magician;
- Indicates that the object is unusable by magicians.
- boolean obj.is_anti_neutral;
- Indicates that the object is unusable by those of neutral alignment.
- boolean obj.is_anti_thief;
- Indicates that the object is unusable by thieves.
- boolean obj.is_anti_warrior;
- Indicates that the object is unusable by warriors.
- boolean obj.is_cursed;
- Indicates that the object is unusable by clerics.
- boolean obj.is_day_decay;
- Indicates that the object decays in daylight.
- boolean obj.is_donated;
- Indicates that the object has been donated and is worthless.
- boolean obj.is_high_rent;
- Indicates that the object has an unusually high cost to rent.
- boolean obj.is_invisible;
- Indicates that the object is invisible.
- boolean obj.is_magic;
- Indicates that the object is magical.
- boolean obj.is_surface;
- Indicates that the object is a surface (other items may be placed
on top of the surface).
- boolean obj.is_trapped;
- Indicates that the object is trapped or contains a trap object.
- boolean obj.is_unidentifiable;
- Indicates that the object is not identifiable through normal methods.
- boolean obj.is_unrentable;
- Indicates that the object is not rentable and is destroyed when a
person leaves the game with the object.
- boolean obj.can_hold;
- Indicates that the object can be held in the hand.
- boolean obj.can_take;
- Indicates that the object can be taken.
- boolean obj.one_handed_weapon;
- Indicates that the object can be used as a weapon with one hand.
- boolean obj.two_handed_weapon;
- Indicates that the object can be used as a weapon, but requires both
hands.
- boolean obj.worn_about;
- Indicates that the object can be worn about the body.
- boolean obj.worn_as_shield;
- Indicates that the object can be worn as a shield.
- boolean obj.worn_on_arms;
- Indicates that the object can be worn on the arms.
- boolean obj.worn_on_back;
- Indicates that the object can be worn on the back.
- boolean obj.worn_on_body;
- Indicates that the object can be worn on the body.
- boolean obj.worn_on_chest;
- Indicates that the object can be worn on the chest.
- boolean obj.worn_on_face;
- Indicates that the object can be worn on the face.
- boolean obj.worn_on_feet;
- Indicates that the object can be worn on the feet.
- boolean obj.worn_on_finger;
- Indicates that the object can be worn on a finger.
- boolean obj.worn_on_forehead;
- Indicates that the object can be worn on the forehead.
- boolean obj.worn_on_hands;
- Indicates that the object can be worn on the hands.
- boolean obj.worn_on_head;
- Indicates that the object can be worn on the head.
- boolean obj.worn_on_legs;
- Indicates that the object can be worn on the legs.
- boolean obj.worn_on_mouth;
- Indicates that the object can be worn in the mouth.
- boolean obj.worn_on_neck;
- Indicates that the object can be worn on the neck.
- boolean obj.worn_on_waist;
- Indicates that the object can be worn on the waist.
- boolean obj.worn_on_wrist;
- Indicates that the object can be worn on a wrist.
- boolean obj.affect_blind;
- Indicates that the object blinds the wearer.
- boolean obj.affect_cripple;
- Indicates that the object cripples the wearer.
- boolean obj.affect_detect_align;
- Indicates that the object allows the wearer to detect alignments.
- boolean obj.affect_detect_invis;
- Indicates that the object allows the wearer to detect invisible items.
- boolean obj.affect_detect_life;
- Indicates that the object allows the wearer to detect hidden persons.
- boolean obj.affect_detect_magic;
- Indicates that the object allows the wearer to detect magical dweomers.
- boolean obj.affect_endure_cold;
- Indicates that the object enables the wearer to endure cold.
- boolean obj.affect_endure_heat;
- Indicates that the object enables the wearer to endure heat.
- boolean obj.affect_feather_fall;
- Indicates that the object gives the wearer the ability to fall from
heights without being harmed.
- boolean obj.affect_hide;
- Indicates that the object hides the wearer.
- boolean obj.affect_immune_charm;
- Indicates that the object protects the wearer from being charmed.
- boolean obj.affect_immune_summon;
- Indicates that the object prevents the wearer from being summoned.
- boolean obj.affect_infravision;
- Indicates that the object allows the wearer to see in the dark.
- boolean obj.affect_invisible;
- Indicates that the object makes the wearer invisible.
- boolean obj.affect_paralysis;
- Indicates that the object paralyzes the wearer.
- boolean obj.affect_silence;
- Indicates that the object silences the wearer.
- boolean obj.affect_sneak;
- Indicates that the object allows the wearer to move without making
noise.
- boolean obj.affect_water_breath;
- Indicates that the object enables the wearer to breathe underwater.
Relating to the world
- person obj.owner;
- Returns the person carrying obj (possibly inside several layers
of containers), or none if the object is not owned by any person.
- integer obj.equipped_on;
- void equip (person pc, object obj, integer loc);
- void unequip (person pc, object obj);
- object worn_on (person pc, integer location);
- Determine or set the location on which an object is equipped, or find
the object worn by a person on a specified location (if nothing is worn by
the person on that location, the function returns none). The
location must come from the following list of constants:
- equipped_about -- worn about the owner's body
- equipped_in_mouth -- worn in the owner's mouth
- equipped_on_arms -- worn on the owner's arms
- equipped_on_back -- worn on the owner's back
- equipped_on_body -- worn on the owner's body
- equipped_on_chest -- worn on the owner's chest
- equipped_on_face -- worn on the owner's face
- equipped_on_feet -- worn on the owner's feet
- equipped_on_forehead -- worn on the owner's forehead
- equipped_on_hands -- worn on the owner's hands
- equipped_on_head -- worn on the owner's head
- equipped_on_left_finger -- worn on the owner's left finger
- equipped_on_left_wrist -- worn on the owner's left wrist
- equipped_on_legs -- worn on the owner's legs
- equipped_on_neck -- worn on the owner's neck
- equipped_on_right_finger -- worn on the owner's right finger
- equipped_on_right_wrist -- worn on the owner's right wrist
- equipped_on_waist -- worn on the owner's waist
- held_in_left_hand -- held in the owner's left hand
- held_in_right_hand -- held in the owner's right hand
- not_equipped -- not equipped by anyone
- wielding -- used as a weapon
- wielding_in_two -- used as a two-handed weapon
Return to Mocha's Main Page