home » builders » builder's lessons » if checks

If checks

We are often adding new if checks as we or one of our builders finds the need for one. So if you are wanting to check for something and it doesn't appear to be on this list, please post to the builders discussion forum, and the coders will consider it.

If checkFunction and Syntax
actorhasobjnum checks if the PC has the vnum in parenthesis worn or in inventory
if actorhasobjnum(8000)
actorotypewear checks if the PC is wearing the type of item in the parenthesis
if actorotypewear(1)
Use the bit vector not the word.
align checks $whatevers alignment with rhs
if align($n) > 1000
canhire checks if $whatevers can hire an employee for a dwelling
if canhire($n)
This is only used in the dwellings areas, not in normal areas.
canpkill checks if $whatevers can pkill
if canpkill($n)
All characters on FKMud can pkill so this check is not used.
cha checks $whatevers charisma with rhs
if cha($n) > 15
charinroom checks that the string $1 can be seen in the room by $n
if charinroom($n) == $1
clan checks $whatevers clan with rhs
Organisations are not hard coded in FKMud.
Check for the specific organisation objects instead.
if clan($n) == Clanname
class checks $whatevers class with rhs
if class($n) == Wizard
if class($n) == Warrior
if class($n) == Priest
if class($n) == Rogue

Only checks the 4 base classes, no guilds.
con checks $whatevers constitution with rhs
if con($n) > 15
day checks day number with rhs
if day() == 1
deity checks $whatevers deity with rhs
if deity($n) == Mystra
dex checks $whatevers dexterity with rhs
if dex($n) > 15
doingquest checks $whatevers questbits with rhs
Not used. Use if quest or if questr instead.
economy checks the current economy with rhs
if economy(7500) > 1000
Value is in copper. Start Vnum of area is in parenthesis.
if economy() > 1000
If no vnum is specified it will check the area that the prog is being activated in.
favor checks $whatevers favor with rhs
if favor($n) > 400
feat checks if $whatever has featname trained rhs times
if feat(featname, $n) > 0
formation checks if $whatever is in a certain position of the formation
if formation($n) == 1
getcurrentuses Checks how many uses $whatever of an ability currently has
if getcurrentuses(shapechange,$n) > 1
goldamt goldamt counts the greater of what is in $whatever's inventory or money pouch
if goldamt($n) > 500 [amount in copper coins]
It checks what has the greatest amount, inventory or money pouch.
goldamtroom goldamtroom compares rhs with amount of gold in the room that $whatever is in
if goldamtroom($n) > 500 [amount in copper coins]
goldamtroomc goldamtroomc compares rhs with amount of gold in the room and containers in the room that $whatever is in
if goldamtroomc($n) > 500 [amount in copper coins]
If the check is on $i it will look through the money pouch on $i
glory checks the amount of CURRENT glory $whatever has with the rhs
if glory($n) > 20
glory_total checks the TOTAL amount of glory $whatever has with the rhs
if glory_total($n) > 20
group checks the number of people in $whatever's group with the rhs
if group($n) > 2
guild checks $whatevers guild with rhs
if guild($n) == Necomancers [plural form]
For priests use the prefix Clerics of
if guild($n) == Clerics of Tyr
Exception is
Druids of Chauntea
hashorse checks if $whoever has a horse
if hashorse($n)
haspet checks if $whoever has a pet
if haspet($n)
hitamt checks $whatevers hps with rhs
if hitamt($n) > 150
hitprcnt checks $whatevers hp percentage with rhs
if hitprcnt($n) > 50
hometown checks hometown of $whatever with rhs
if hometown($n) == Waterdeep or
if hometown($n) == 8030 [vnum]
inarea checks if $whatever is in the area
if inarea($n) == 7500 [Area start vnum]
inroom checks if $whatever is in the rhs room
if inroom($n) == 8030 [vnum]
int checks $whatevers int with rhs
if int($n) > 15
isaffected checks if $whatever is affected by rhs
if isaffected($n) == Detect_magic
isburied($o) checks if $o (object) is buried or not
if isburied($o)
ischaotic checks if $whatever is of chaotic alignment
if ischaotic($n)
Is true for CG CN and CE.
ischarmed checks if $whatever is affected by charm
if ischarmed($n)
isclanned checks if $whatever is in a guild
if isclanned($n)
Clans are not currently hard coded on FKMud.
isdevoted checks if $whatever is devoted to a deity
if isdevoted($n)
isemployer checks if $whatever is the mobs employer
if isemployer($n)
Used by dwellings only.
isevil checks if $whatever is < -350 align
if isevil($n)
Is true for CE NE and LE.
isfamilar checks if $whatever is a familiar
if isfamiliar($i)
isfight checks if $whatever is fighting
if isfight($n)
isfollow checks if $whatever is following
if isfollow($n)
isfullmoon checks to see if there is a fullmoon
if isfullmoon()
isgood checks if $whatever is one of the three good alignments
if isgood($n)
Is true for LG NG and CG.
isguilded checks if $whatever is in a guild
if isguilded($n)
ishelled checks if $whatever is in hell
if ishelled($n)
isimmort checks if $whatever is immortal
if isimmort($n)
isindoors checks if $whatever is indoors
if isindoors($n)
islawful checks if $whatever is of lawful alignment
if islawful($n)
Is true for LG LN LE.
ismobinvis checks if $whatever is mobinvis
if ismobinvis($n)
ismounted checks if $whatever is mounted
if ismounted($n)
isneutral checks if $whatever is of one of the three neutral alignments
if isneutral($n)
Is true for CN TN NG.
isnpc checks if $whatever is a NPC
if isnpc($n)
isordered checks if $whatever is in an order
if isordered($n)
Orders are not hard coded on FKMud. Do not use.
ispc checks if $whatever is a PC
if ispc($n)
ispet checks if $whatever is a pet
if ispet($i)
ispkill checks if $whatever is a pkiller
if ispkill($n)
This feature is not used by FKMud. Do not use.
isunconcerned checks if $whatever is of neutral alignment
if isunconcerned($n)
Is true for NG TN and NE.
isundead checks if $whoever is undead
if isundead($n)
iswanted checks if $whatever is wanted by the justice system as a criminal
if iswanted($n)
killer checks if $whatever is a killer
if killer($n)
This feature is no longer used by FKMud. Do not use.
kismet checks the current kismet in the account of $whatever with rhs
if iskismet($n) > 100
language checks the language that $whatever is speaking with the rhs
if language($n) == Common
lck checks $whatevers luck with rhs
if lck($n) > 15
level checks $whatevers level with rhs
if level($n) > 40
manaamt checks $whatevers mana with rhs
if manaamt($n) > 100
manaprcnt checks $whatevers mana percentage with rhs
if manaprcnt($n) > 50
material checks if $whatever is made of material on rhs
if material($o) == 22
Use the bit vector number and not the word.
memorised Checks how many times $whatever has memorised a spell
if memorised(magic missile,$n) > 2
mobinroom checks if mob is in rhs room
if mobinroom(QQ01) > 0
mobinvislevel checks $whatevers level of mobinvis with rhs
if mobinvislevel($i) > 53
month checks month number with rhs
if month() == 1
Months Listing
moveamt checks $whatevers move with rhs
if moveamt($n) > 200
moveprcnt checks $whatevers move percentage with rhs
if moveprcnt($n) > 50
name checks name of $whatever with rhs
if name($n) == Drizzt
norecall checks if $whatever is in norecall room
if norecall($n)
number checks vnum of mob or object or gold on mob depending on $whatever
if number($i) > 10
if number uses $i then it counts the money on $i in inventory AND in money pouch
if number($n) == 7500
if number is a char other than $i (ie $n, $f, $c) AND $whatever is an NPC, it compares rhs with the vnum.
if number($o) == 7500
if number is an object (ie $o) then it compares rhs with the obj vnum
numinarea checks number of players in area with rhs
if numinarea(7500) > 1
The start vnum of the area is in parenthesis.
The rhs number is the number of PC's in the area.
objininv checks that $# can be seen in the inventory of $whoever
if objininv($n) == $1
objinroom checks that $# can be seen in the room with $whatever
if objinroom($n) == $1
objtype checks object type with rhs
if objtype($o) == 1
objval0 checks object value0 with rhs
if objval0($o) == 1
objval1 checks object value1 with rhs
if objval1($n) == 1
objval2 checks object value2 with rhs
if objval2($n) == 1
objval3 checks object value3 with rhs
if objval3($n) == 1
objval4 checks object value4 with rhs
if objval4($n) == 1
objval5 checks object value5 with rhs
if objval5($n) == 1
objisworn checks that $whatever is worn by $n
if objisworn($o) == $1
order checks $whatevers order with rhs
Orders are not used on FKMud. Do not use.
if order($n) == Ordername
otypecarry checks if $whatever has rhs number of objects of this type in inventory or worn
if otypecarry(1)
if otypecarry(armor)
otypehere checks if itemtype is in room or on $whatever
if otypehere(1)
otypeinv checks if $whatever has rhs item type in inv
if otypeinv(1)
otyperoom checks if room has rhs item type
if otyperoom(1)
otypewear checks if $whatever has rhs item type worn
if otypewear(1)
ovnumcarry checks if $whatever has rhs vnum carried
if ovnumcarry(7500) == 1
Carry means in inventory or is worn.
ovnumhere checks if how many vnum are in room
if ovnumhere(30) > 0
ovnuminv checks if $whatever has rhs vnum in inv
if ovnuminv(1) > 1
ovnumroom checks if room has rhs vnum
if ovnumroom(1) > 1
ovnumwear checks if $whatever has rhs vnum worn
if ovnumwear(1) > 1
ownsmark checks if $whatever is the marked owner of an object
if ownsmark($n)
pcinroom compares rhs to number of PCs in room with $whatever
if pcinroom($n) > 2
perm_cha compares rhs to number of PCs permanent charisma
if perm_cha($n) > 12
perm_con compares rhs to number of PCs permanent constitution
if perm_con($n) > 12
perm_dex compares rhs to number of PCs permanent dexterity
if perm_dex($n) > 12
perm_int compares rhs to number of PCs permanent intelligence
if perm_int($n) > 12
perm_lck compares rhs to number of PCs permanent luck
if perm_lck($n) > 12
perm_str compares rhs to number of PCs permanent strength
if perm_str($n) > 12
perm_wis compares rhs to number of PCs permanent wisdom
if perm_wis($n) > 12
position checks $whatevers position with rhs
if position($n) == 8
practice checks $whatevers number of pracs with rhs
Practice points are the same as stat points.
if practice($n) > 0
quality checks the quality of an object with the rhs
if quality($o) < 2
Use the bit vector and not the word.
quest checks if $whatever has questbits in area with rhs
if quest(0,1,$n) == 0
questr checks if $whatever has questbits in area with vnum r with rhs
if questr(8000,0,1,$n) == 0
race checks $whatevers race with rhs
if race($n) == Human
rand checks random percent with that in ()
if rand(50)
resistance checks if $whatever has rhs resistance to resistancetype(0)
if resistance(0, $n) > 25
if resistance(cold,$n) > 50
if resistance(fire,$n) <= 25
sector checks sector of room with rhs
if sector($n) == 13
Use the bit vector number, not the word.
sex checks $whatevers sex with rhs
if sex($n) == 1 for males
if sex($n) == 2 for females
if sex($n) == 0 for neutral
skilllevel checks if $whatever has skilllevel of skill with rhs
if skilllevel(second attack, $n) > 5
skillcheck checks if $whatever passes the skill level check with the rhs
if skillcheck(second attack, $n)
str checks $whatevers strength with rhs
if str($n) > 15
string checks $# for the input word
if string($1) == smell
See the String If Check Function lesson for more information.
stringprefix checks $# for the input word, including shorthand input
if stringprefix($1) == smell
See the String If Check Function lesson for more information.
temp checks the temperature of the room that $whatever is in, in Fahrenheit.
if temp() > 15
thief checks if $whatever is a thief
if thief($n)
No longer used by FKMud since the implementation of the new Justice system.
time checks hour number with rhs
if time() == 1
Time ranges from 0 - 23
timeskilled checks $whatevers times killed with rhs
This is no longer used by FKMud.
value5bits checks the quest bit of value5 on an object
if value5bits(0,5,$o) == 1
wasinroom checks room $whatever was last in with rhs
if wasinroom($n) == 7500
wear_loc checks where object is currently worn with rhs
if wear_loc($o) != -1
Example checks for if it is not worn.
weather checks if weather is cloudless/cloudy/rainy/lightning
if weather() == cloudy
if weather() == cloudless
if weather() == rainy
if weather() == lightning
wis checks $whatevers wisdom with rhs
if wis($n) > 15


$whatevers capital of each includes the title if after /
$n/N char that triggers prog or ch in hardcode $n refers to the PC by name, $N refers to the PC by their adjective
$i/I self mob with the prog
$t/T victim(used in hard code) - Do not use in area code. It crashes the game.
$r/R random char in room
$e he/she of $n
$m him/her of $n
$s his/her of $n
$E he/she of victim
$M him/her of victim
$S his/her of victim
$j he/she of $i
$k him/her of $i
$l his/her of $i
$J he/she of $r
$K him/her of $r
$L his/her of $r
$o/O object with the prog
$c/C character carrying $o
$p/P object in hard code
$a/A article for $o
$f/F character that $n is fighting
$w/W The group leader (use W)
$b room name
$v room vnum
$0 to $9 strings to be checked for