判斷式用於 MOBprogram 之中。利用 trigger type 和 if check 的組合,我們可以寫出智慧型的怪物,以及複雜的任務。

rand(num)

機率的判別。下例是常用的「三選一」的寫法。

範例

if rand(33)
   MPOLOAD 10801
else
   if rand(50)
       MPOLOAD 10802
   else
       MPOLOAD 10803
   endif
endif

isnpc($*)

判別 $* 是否為 NPC。

範例

if isnpc($n)
   say $n is NPC
else
   say $n is not NPC
endif

ispc($*)

判別 $* 是否為玩家。

範例

if ispc($n)
   say $n is PC
else
   say $n is not PC
endif

isimmort($*)

判別 $* 是否為大神(等級 > 50)。

範例

if isimmort($n)
   MPJUNK all
endif

isgood($*)

判別 $* 是否為好人(陣營 >= 350)。

範例

if isgood($n)
   give card $n
   say 對不起,你是好人
endif

isevil($*)

判別 $* 是否為壞人(陣營 <= -350)。

範例

if isevil($n)
   shiver $n
   say 好可怕,你是壞人
endif

isfight($*)

判別 $* 是否在戰鬥中。

範例

if isfight($i)
   MPHIT $n
endif

hitprcnt($*) == percent

判別 $* 的生命點數(百分比)的多寡。

範例

if hitprcnt($i) == 30
   cast heal
   cast heal
endif

isfollow($*)

判別 $* 是否正跟隨著別人。leader 必須在場。

範例

if isfollow($i)
else
   follow $n
   say group me!!
endif

isfollowing($*)

判別自己是否正跟隨著 $*。

範例

if isfollowing($n)
   follow self
   wave $n
endif

inroom($*) == room-vnum

判別 $* 是否在某個房間。

範例

if inroom($i) == 3700
else
   MPGOTO 3700
endif

atroom(mob) == room-vnum

判別某隻怪物是否在某個房間內。怪物可以填名字或 vnum,也可以檢查數量。

範例

if atroom(3113) == 3001
else
   MPAT 3001 MPMLOAD 3113
endif
if atroom(5.guard) == 3001
   MPECHO room #3001 裡有五隻 #3113
endif

ishere($*)

判別 $* 是否在同一間房間。

範例

if ishere($n)
   smile $n
endif

isthere(mob)

判別某人是否在同一間房間。

範例

if isthere(blane)
   smile blane
endif

isalive(dest)

判別某個房間(room-vnum)、怪物(mob-name)或物品(obj-name)是否存在。

範例

if isalive(blane)
   tell blane 恭喜你沒死
endif
if isalive(3700)
   MPGOTO 3700
endif

cansee($*)

判別是否能看見 $*。

範例

if cansee($n)
else
   say 我不跟看不到的人做生意
endif

isaffected($*) & integer

判別 $* 是否受到某個效果的影響。對應的效果值請參見 affected-flags 的對照表,需為數值,可以累進。

範例

if isaffected($n) & 128
   MPECHO $n is affected by sanctuary
endif

steed($*)

判別 $* 是否正帶著座騎。

範例

if steed($n)
   MPFORCE $n disband
endif

ischarmed($*)

判別 $* 是否受到 charm 影響。

範例

if ischarm($i)
   say I'm charmed!
endif

istamed($*)

判別 $* 是否受到 tame 影響。

範例

if istamed($i)
   say I'm tamed!
endif

questval(quest-value) == integer

判別玩家的 quest value。若 quest value 為 null,系統會回傳 true。

範例

if questval(12345) == 1
   qset $n 12345 2
endif

qvalue(quest-value) == integer

判別玩家的 quest value。若 quest value 為 null,系統會回傳 false。

範例

if qvalue(12345) == 1
   qset $n 12345 2
endif

questmark(quest-number) == integer

判別玩家的 questmark。

範例

if questmark(12345) == 1
   questmark $n 12345 2
endif

iswear($*) == obj-vnum

判別 $* 是否正裝備著某樣物品。

範例

if iswear($n) == 17068
   say $n 穿著阿努比斯!
endif

iscarry($*) == obj-vnum

判別 $* 是否攜帶著某樣物品。可以檢查數量。

範例

if iscarry($n) == 3138
else
   MPECHO $n 身上沒有水袋
endif
if iscarry($n) == 5.3138
   MPECHO $n 有五個水袋
endif

isobjecthere($*) == obj-vnum

判別 $* 所在處有無某樣物品。

範例

if isobjecthere($i) == 3135
   say 這裡有一座水池
endif

pcnumber($*) == integer

判別 $* 所在的房間人數。

範例

if pcnumber($i) >= 20
   MPMSET self hp 10000
endif

sex($*) == integer

判別 &* 的性別。請參見性別對照表

範例

if sex($n) == 2
   say $n is female
endif

position($*) == integer

判別 $* 的狀態。請參見狀態對照表

範例

if position($n) == 6
   say $n is resting
endif

level($*) == integer

判別 $* 的等級。

範例

if level($n) == 45
   say $n is a Hero
endif

class($*) == integer

判別 $* 的職業。請參見職業對照表

範例

if class($n) == 5
   say $n is a Mercenary
endif

iswarrior($*)

判別 $* 是否為戰士。怪物會回傳 false。

範例

if iswarrior($n)
   MPKILL $n
endif

iscaster($*)

判別 $* 是否為法師。Lord 屬於法師。怪物會回傳 false。

範例

if iscaster($n)
   MPKILL $n
endif

fame($*) == integer

判別 $* 的頭銜。請參見頭銜對照表

範例

if fame($n) == 1
   say $n is a Dragon Master
endif

honor($*) == integer

判別 $* 的 honor 值。僅適用於 Penacles Knight。請參見榮譽值對照表

範例

if honor($n) > 6
   MPTRANSFER $n 3606
endif

ac($*) == integer

判別 $* 的防禦力。

範例

if ac($n) < -600
   MPMSET self hp 5000
endif

hr($*) == integer

判別 $* 的命中點數。

範例

if hr($n) > 55
   MPMSET self hp 5000
endif

dr($*) == integer

判別 $* 的傷害點數。

範例

if dr($n) > 55
   MPMSET self hp 5000
endif

sp($*) == integer

判別 $* 的法術效應。

範例

if sp($n) > 120
   MPMSET self hp 5000
endif

goldamt($*) == integer

判別 $* 的財產。

範例

if goldamt($n) > 100000
   steal coins $n
endif

practice($*) == integer

判別 $* 的學習點數。

範例

if practice($n) < 20
   comfort $n
endif

chinese($*)

判別 $* 是否為中文模式。

範例

if chinese($n)
   say 你好
else
   say Hello, world!!
endif

objtype($*) == integer

判別 $* 的物品類別。請參見 item type 對照表

範例

if objtype($o) == 2
   say $o is a scroll
endif

objval#($*) == integer

判別 $* 的 value 值。# 的值為 0~3。請參見 item type 對照表

範例

if objval0($o) == 1
   say $o 的 value-0 是 1
endif
if objval1($o) == 0
   say $o 的 value-1 是 0
endif
if objval2($o) == -1
   say $o 的 value-2 是 -1
endif
if objval3($o) == 10
   say $o 的 value-3 是 10
endif

number($*) == integer

判別 $* 的 vnum。

範例

if number($n) == 3134
   MPKILL $n
endif

name($*) == string

判別 $* 的名字。怪物需為全名。

範例

if name($n) == cityguard guard
   MPKILL $n
endif

hour($*) == integer

判別 DR 內的時間。值為 0~23。

範例

if hour($i) == 6
   say It's the time to open the gate.
   unlock east
   open east
endif