[wizs] debug.log

看板mud_sanc (Sanctuary - 聖殿)作者 (小太保)時間16年前 (2009/11/09 12:08), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/17 (看更多)
執行時段錯誤: *Bad argument 1 to all_inventory() Expected: object Got: 0. 程式: u/l/laechan/special/mob/fingerwind1.c:76 物件: 0 /d/blade/shuttindie "start_effect2" d/blade/shuttindie.c:151 /std/user#26729 "shut" std/user/attack.c:130 /adm/daemons/shut_d "shut_tar" adm/daemons/shut_d.c:295 /adm/obj/simul_efun "show" adm/simul_efun/show.c(adm/obj/simul_efun.c):150 0 "receive_damage" std/mob/attack.c:28 0 "die" u/l/laechan/special/mob/fingerwind1.c:76 已更新部份判斷。我之前偷懶將 heart_beat 內的判斷式直接 cp 一份到 die 函數才會出現上述問題(怪物都死了自然讀取物 件時會讀到 0) 執行時段錯誤: *Bad argument 1 to userp() Expected: object Got: 0. 程式: d/ppl/highelf/children/mob/elf2.c:42 物件: /d/ppl/highelf/children/mob/elf2#997011 生物名: elf /d/ppl/highelf/children/mob/elf2#997011 "check_beauty" d/ppl/highelf/children/mob/elf2.c:42 執行時段錯誤: *Bad argument 2 to foreach Expected: array Got: 1. 程式: d/ppl/highelf/children/mob/elf2.c:51 物件: /d/ppl/highelf/children/mob/elf2#998936 生物名: elf /d/ppl/highelf/children/mob/elf2#998936 "check_beauty" d/ppl/highelf/children/mob/elf2.c:51 ob=present("beauty",env); if(ob && !userp(ob) && living(ob)) { 上面可以改為.. if(ob=present("beauty",env)) // 先判斷有無 { if(!userp(ob) && living(ob)) 另外如果 beauty 是特殊 npc 或特殊物品的話,就取特殊的 id,例如 special beauty,這樣你就無須判斷 userp(ob), 因為玩家的 id 不可能是「special beauty」。 就是可以少一個判斷。 執行時段錯誤: *Bad argument 1 to environment() Expected: object Got: 1. 程式: adm/daemons/mob_d.c:45 物件: /adm/daemons/mob_d /d/ppl/highelf/children/mob/elf2#994577 "heart_beat" std/gmonster.c:118 /adm/daemons/mob_d "continue_attack" adm/daemons/mob_d.c:491 /adm/daemons/mob_d "clean_up_attackers" adm/daemons/mob_d.c:45 void init 裡頭的寫法並不好,那是每執行一次就會 check beauty 並做函數內的一些動作,這可能會造成系統負擔。 一般針對這樣的需求都會建議改採用 heary_beat 的方式,用週期性 的 check 替代頻繁的 check。 執行時段錯誤: *Bad argument 1 to userp() Expected: object Got: 1. 程式: cmds/std/_holybell.c:71 物件: /cmds/std/_holybell /std/user#17834 "cmd_hook" std/user.c:294 /cmds/std/_holybell "cmd_holybell" cmds/std/_holybell.c:71 foreach(ob in obs) { if(!ob || (ob && !living(ob))) continue; ob->set_temp("holybell_times",t); if(userp(ob)) { if(ob->query_temp("holybell_check")<check) { ob->set_temp("holybell_check",check); if(ob->query_temp("shield2")) tell_object(ob,HIG"你的護盾受到聖潔鈴音的強化, 變得更加堅固了!!\n"NOR); } if(ob->query("block_command")>0) { if(env=ob->query_current_attacker() && !userp(env)) <= 這裡出問題 { ob->delete("block_command"); ob->delete("block_command_msg"); tell_object(ob,HIM"你的定身狀態被聖潔鈴音解除了!!\n"NOR); } } } } query_current_attacker 函數是定義在 /std/user/attack.c object query_current_attacker() { int i; if(i=sizeof(temp_data["ats"])) // me->query_temp("ats"))) return temp_data["ats"][i-1]; } 它這樣確實有可能出現回傳值不為物件的情況(就是 0) 我將上面的函數做了一些修改... object query_current_attacker() { int i; mixed atts=temp_data["ats"]; atts-=({0}); i=sizeof(atts); if(i>0) // me->query_temp("ats"))) return temp_data["ats"][i-1]; } 不過它還是有問題就是了。先暫時這樣。 Expected: string or array or object Got: 0. 程式: cmds/std/_go.c:208 物件: /cmds/std/_go 0 "heart_beat" std/monster.c:130 0 "run_away" std/mob/living.c:124 /adm/daemons/mob_d "run_away" adm/daemons/mob_d.c:851 0 "force_me" std/mob/living.c:18 0 "cmd_hook" std/monster.c:34 /cmds/std/_go "cmd_go" cmds/std/_go.c:208 " Heart beat in /d/ppl/quest/evil/mob/galloper#979431 turned off. Error in error handler: *Bad argument 1 to call_other() Expected: string or array or object Got: 0. 這東西跟 mob 的自動行走有關。 set_name(HIG"奔騰鬼馬"NOR); <= 這個建議使用不空白全小寫無色碼的英文 拍謝上面我看錯了, 不用修改. _go.c 的第 208 行如下.. if( (object)me->query_temp("leader")== me) 我已經先修改為如下... if(me && (object)me->query_temp("leader")== me) 我的推測是怪物陣亡→me 消失→所以上述判斷出問題。 剩下的有空再 debug, 吃飯先。 Laechan -- ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 編輯: laechan 來自: 61.225.163.161 (11/09 15:10)

11/09 16:35, , 1F
fix
11/09 16:35, 1F
文章代碼(AID): #1AzvM--3 (mud_sanc)
討論串 (同標題文章)
完整討論串 (本文為第 1 之 17 篇):
0
1
0
2
1
1
0
4
1
8
5
14
文章代碼(AID): #1AzvM--3 (mud_sanc)