Re: [wizs] error msg

作者: laechan (揮淚斬馬雲)   2023-03-19 22:07:21
執行時段錯誤: *Bad argument 2 to member_array()
Expected: string or array Got: 0.
程式: /d/ppl/justinj/devil/mob/mantis.c:35
物件: /d/ppl/justinj/devil/mob/mantis#253957
生物名: mantis
/d/ppl/justinj/devil/mob/mantis#253957 "heart_beat" /std/gmonster.c:123
/d/ppl/justinj/devil/mob/mantis#253957 "run_away" /d/ppl/justinj/devil/mob/mantis.c:80
/d/ppl/justinj/devil/mob/mantis#253957 "force_me" /std/mob/living.c:16
/d/ppl/justinj/devil/mob/mantis#253957 "cmd_hook" /std/gmonster.c:32
/cmds/std/_go "cmd_go" /cmds/std/_go.c:154
/d/ppl/justinj/devil/mob/mantis#253957 "move_player" /std/gmonster.c:42
/adm/daemons/mob_d "move_player" /adm/daemons/mob_d.c:378
/d/ppl/justinj/devil/mob/mantis#253957 "move" /std/ob/mob.c:60
/std/ob/ob_d "move" /std/ob/ob_d.c:52
/d/ppl/justinj/devil/mob/mantis#253957 "move_to" /std/ob/mob.c:63
/d/ppl/justinj/devil/mob/mantis#253957 "init" /d/ppl/justinj/devil/mob/mantis.c:35
void init()
{
object ppl=this_player();
::init();
if(ppl->query("npc"))//怪物類
{
if(member_array("center",ppl->query("id"))> -1)//塔
kill_ob(ppl);
}
}
我的經驗是,member_array("center",ppl->query("id")) 這個如果會
出錯,八成是 ppl->query("id") 讀到的東西為
1. 空
2. 非 array
通常我會改成 member_array("center",(mixed)ppl->query("id")) 來
避免錯誤,或是
if(ppl->query("npc") && ppl->query("id"))
另外,ppl 並不一定是玩家,能觸發怪物 init 函數的只要是生物
都有可能。
Laechan

Links booklink

Contact Us: admin [ a t ] ucptt.com