CthulhuMud - Conditions
[ Index ]
Conditions are used to detect a number of different situations, generally
concerned with permission or reaction. Conditions may be chained together
to make a compound condition. When this is done, the conditions are combined
with AND logic. For example, the following conditions:
actor->is->flying
actor->level 75 -1
actor->not->carrying 2057 2057
Would match an action performed by an mob who was both flying and of above
75th level and not carring (or wearing) item 2057.
Conditions are always evaluated against a context,
most often one coming from an event.
Parts of a Condition
Conditions are comprised of 5 parts:
-
Subject
-
This determines what the condition is evaluated against.
-
Negation
-
This indicates that the result of the condition is to be reversed.
-
Conditions
-
This specifies the attribute of the subject that is being checked.
-
Index
-
This is sometimes used to help refine the attribute, and other times used
to store a part of the comparison condition.
-
Low and High
-
These are a pair of values used for attribute comparison. Generally a value
of -1 for high means unlimited.
Creating Conditions Through OLC
When entering conditions throug OLC they are normally entered thus:
subject <not> condition parms
The not is optional and the parms depend upon the condition
being created.
Conditions in Files
When conditions are written to a file (or is a few cases manually edited
in one) they are always written out in the sequence:
subject condition 'index' low high
With everything being numbers except the index which is a string (and may
not contain quotes).
The numbers are taken from constants defined in the econd.h file.
Negated conditions are indicated through the usage of a negative condition
value.
Subjects
Each condition has a subject. Possible subjects are:
-
actor (mob)
-
The mob who is taking the action
-
victim (mob)
-
The mob that is being acted upon
-
observer (mob)
-
The mob the condition is being evaluated for. Can be the same as actor
or victim
-
lactor (mob)
-
The leader of the actor
-
lvictim (mob)
-
The leader of the victim
-
lobserver (mob)
-
The leader of the observer
-
world (world)
-
The condition has no specific subject within the mud
-
pobj (object)
-
The primary object associated with the event
-
sobj (object)
-
The secondary objet associated with the event
-
event (event)
-
This is the event the condition is being evaluated
against
Not all subjects are valid in all contexts. Generally this will depend
upon the event being reactied to. If a subject is not valid, all conditions
upon it are unsatisfied.
Conditions
The conditions are broken up according to the subjects that they can be
evaluated against.
World Conditions
-
moon low high
-
Checks on the phase of the moon, from 0 New to 4 Full. The moon follows
a standard 28 day cycle
-
random low high
-
Checks on a random number in the range 0..1023
-
hour_of_day low high
-
Check against time of day (0..23). 1 hour gametime is 30 seconds real time
-
hour_of_day_mod div low high
-
Check against hour of day modulus div (0..(div-1)). Good divs: 2, 3, 4,
6, 8, 12
-
day_of_month low high
-
Checks against the day of the month (0..32) 1 Month gametime is 6 hours,
24 minutes realtime.
-
day_of_month_mod div low high
-
Checks against day of month modulus div (0..(div-1)). Good divs: 2, 4,
8, 16
-
day_of_year low high
-
Checks against the day of the year (0..383). 1 Year gametime is 3 days,
4 hours and 48 minutes.
-
day_of_year_mod div low high
-
Checks against day of year modulus div (0..(div-1)). Good divs: 2, 3, 4,
6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192
-
week_of_year low high
-
Checks against the week of the year (0..47). 1 week gametime is 1 hour,
36 minutes
-
week_of_year_mod div low high
-
Checks against week of year modulus div (0..(div-1)). Good divs: 2, 3,
4, 6, 8, 12, 16, 24
-
month_of_year low high
-
Checks against the month of the year (0..11). 1 month gametime is 6 hours,
24 minutes
-
month_of_year_mod div low high
-
Checks against month of the year modulus div (0..(div-1)). Good divs: 2,
3, 4, 6
-
mob_in_room room low high
Checks
a mob with a vnum in the range is in the room
player_in_room room
Checks
to see if any players are in the room
room_empty_mob
Checks there
are no mobiles or players in the room
obj_in_room room obj_low obj_high
Checks if an
object with a vnum in the range is in the room
obj_room_container room container obj
Checks if an
object with a vnum in the range is in a container in the room
room_empty_obj
Checks there
are no objects in the room
-
partner name
-
Checks if a certain partner mud exists and is connected.
-
gadget room id state
-
Checks if gadget id is in state state in room room.
Mob/Character conditions
-
skill 'skill' low high
-
Checks the mobs skill (0..200)
-
race 'race'
-
Checks the mobs race. All characters are currently human.
-
size low high
-
Checks the mobs size. tiny(0), small(1), medium(2), large(3), huge(4),
giant(5)
-
level low high
-
Checks the mobs level (1..150)
-
divinity low high
-
Checks the players divinity (newbie(0), player(1), hero(2),... imp(7),
mud(8))
-
sanity low high
Checks the mobs
level (1..128)
casting level low high
Checks the mobs
current spell casting level (1..165)
-
align low high
-
Checks the mobs alignment (-1000..1000)
-
prof 'profession' low high
-
Checks the characters profession and profession levels
-
start low high
-
Checks the characters starting room for his newest profession
-
hits low high
Checks the characters
current hit point total
mana low high
Checks the mobs
current mana point total
move low high
Checks the mobs
current move point total
hits_percent
Checks the percentage
of max hits the mob is on
mana_percent
Checks the percentage
of max mana the mob is on
move_percent
Checks the percentage
of max move the mob is on
-
gold low high
Checks
for gold
-
fame low high
Checks
for fame
-
name string
Checks
for a certain name
-
short string
Checks
for a certain short-description (used for polymorph affected checks)
-
cult string
Checks
who the character is worshipping
-
discipline string
Checks
if a character knows a certain magical discipline
-
criminal_rating low high
Checks
a characters criminal record. If there is no passport the value 0 is being
returned - check with an IS condition for the passport
-
gender sex1 sex2
-
Checks the mobs gender
-
soc_rank soc_id template
-
Checks the characters rank within the listed society. Template is made
up from 1 invited, 2 member, 4 council, 8 Leader, so a value of 14 would
match anyone who was a member, a council member or a leader.
-
soc_level soc_id low high
-
Checks the characters level within the society.
-
soc_auth soc_id template
-
Checks the charactes authority within the society. Template is made up
from the SOC_AUTH bits in the society.h file.
-
conv conv_id subj_id state
-
Checks for a particular state in a conversation
-
carrying vnum1 vnum2
-
Checks if an object with either vnum1 or vnum2 is carried or worn
-
carrying_type type1 type2
-
Checks if an object with either type1 or type2 is carried or worn
-
wearing vnum1 vnum2
-
Checks if an object with either vnum1 or vnum2 is worn
-
wearing_type type1 type2
-
Checks if an object with either type1 or type2 is worn
-
vnum low high
-
Checks if the mobs vnum falls within the range given. Does not work on
characters
-
in_room low high
-
Checks if the mob is in a room with a vnum within the range given
-
is_alone
-
Checks if nobody else is in the mobs room
-
in_subarea low high
-
Checks if the mob is in a room with a subarea within the range given
-
deed deed_id flag
-
Checks if the deed has been done (1) or has not been done (0)
-
quest quest_id low high
Checks if the
state of the quest is within the given range.
Generally 0
for starting through to 9999 for completed.
-
memory memory_slot_number
Checks if there
is something rmembered in the specified slot.
memory_value memory_slot_number low high
Checks if the
value of the string in the slot is within the specified range.
-
affected affect
-
Checks is the mob is affected with a particular spell effect. This uses
the affect list, not the affect bits which can be checked through an 'is'
condition. How the character acquires the affect can alter how you have
to check for it.
-
uses_imp
-
Checks if the player uses an IMP enabled client - useful for switching
between description and images/links
-
is state
-
Checks if the mob is in the specified state
-
is_not state
-
Checks if the mob is not in the specified state
The states that is and is_not can detect are:
hungry thirsy drunk
full refreshed sober
standing fighting sitting resting awake
sleeping stunned dieing dead
blind invisible seeing_evil seeing_invisible seeing_magic
seeing_hidden mind_melded sanctuary faerie_fire seeing_infrared
cursed scared poisoned protected_from_good protected_from_evil
sneaking charmed flying pass_door hasted calmed plauge_ridden
weakened seeing_in_darkness berserk swimming regenerating
polymorphed absorbing_magic fleeing dreaming aura slow globe
hallucinating relaxed fire_shield frost_shield morf incarnated
criminal vampire were stranger passport
Object conditions
-
level low high
-
Checks if the objects level is within this range
-
type low high
-
Checks if the objects 'item type' is within this range
-
vnum low high
-
Checks if the objects vnum is within this range
-
owner string
Checks
for an object owner
-
contains
Checks object
contents, depends on object type
Container, Locker, Keyring
contains vnum vnum
Satisfied if an object with either vnum is present
Scroll, Potion or Pill
contains spell_num spell_num
Satisfied is both spells are contained. High may be -1.
Light
contains hours
Satisfied if light hours left are >= value.
Wand, Staff
contains spell_num charges
Satisfied is at least 1 charge of spell_num remains
Fountain
contains liquid
Satisfied is the fountain contains the specified liquid.
Drink ontainer
contains liquid drinks
Satisfied if the container hold that many or more drinks of the liquid
-
value number low high
-
Checks the object v0..v4 flags
Event conditions
-
type low high
-
Checks if the events type is within this range
-
subtype low high
-
Checks if the events subtype is within this range
-
number low high
-
Checks if the number on the event is within this range
-
number_mod mod low high
-
Checks if the number on the event is within this range subject to modulo
arithmetic.
-
am_actor
-
Checks if the observer is the same as the actor. This is often true when
the event is not being evaluated by a mob. This is also true if it is the
mob doing something.
-
am_victim
-
Checks if the oberser is the victim. This is true if something is being
done to the mob.
-
actor_grouped
Checks if the
actor is in the same group as the observer.
victim_grouped
Checks if the
victim is in the same group as the observer.
actor_remembered slot
Checks if the
actor (true name or player name) is remebered in the indicated memory slots
on the observer.
victim_remembered slot
Checks if the
victim (true name or player name) is remebered in the indicated memory
slots on the observer.
actor_friend
Checks if the
actor is a friend of the observer.
actor_foe
Checks if the
actor is a foe of the observer.
victim_foe
Checks if the
victim is a foe of the observer.
actor_visible
Checks if the
actor is a visible to the observer.
victim_visible
Checks if the
victim is a visible to the observer.
-
local
-
Checks if the event originated in the oberserves room.
Condition Usage
Conditions can be used for:
-
Extra descriptions - rooms and objects (obs = act)
-
Skill prerequisits (obs = act)
-
Profession prerequisits (obs = act)
-
Door visability (obs = act)
-
Door destinations (obs = act)
-
Conversations (obs, act)
-
Triggers (obs, act, vict)
[ Index ]