看板 mud_sanc 關於我們 聯絡資訊
最近偶爾會發生玩家資料檔、天空城之家的檔案、以及 times_check 資料檔的遺失事件,這些共通點都是會去 call save_object 函數, 目前懷疑成就系統在呼叫這個的時候,沒有設 CD 時間,導致玩家在 執行某些成就的更新動作時,可能會產生問題。 可能而已,目前還在假設階段,但 CD 時間是必要的,這部份可參考 一些用時間控制的寫法,例如在主物件中假設玩家下某指令去呼叫該 物件的某函數時 int save_room() { save_object(base_name(this_object())); return 1; } int 某函數() { int t=time(); object ppl=this_player(); if(ppl->query_temp("time_record/呼叫某函數CD時間")>t) return notify_fail("你要等一下喔。\n"); // 然後才允許執行該函數原本的東西 . . // 然後設定比方 CD 時間兩秒 ppl->set_temp("time_record/呼叫某函數CD時間",t+2); // 然後才做 save_object save_room(); return 1; } 凡會頻繁呼叫到 save_room 的東西都盡可能這樣做,因為每 一次寫檔(讀檔也是,但 sanc 比較少有頻繁讀檔的情況)都需 要時間。 例如,目前已知有使用更新成就的 ai 指令,該指令及相關指 令請盡可能加上 CD 時間至少 2 秒。 例子: /u/l/laechan/skycastle/room/skyroom.c int wit_xxx(string str) { int n,t; object ppl; if(!str || str=="") return notify_fail("提領挪布幣語法: wit 數目.\n"+ "你的家目前共存有 "+data["nobu_money"]+" 挪布幣.\n"+ "請注意,領出後的挪布幣無法再存入家中.\n"); ppl=this_player(); t=time(); // 利用玩家 temp data 區的 time_record 欄位來儲存 if(ppl->query_temp("time_record/wit_nobu_money")>t) return notify_fail("wit: 你要等一下喔.\n"); // 從家拿出東西=buy int buy(string str1) { // 在 玩家的天空城之家本身儲存這個參數(當成他的家的全域參數) if(query("action_time")>time()) { write(HIR"你要等一下才能再做這個動作唷!\n"NOR); return 1; } Laechan -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.33.120.231 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/mud_sanc/M.1730289625.A.F0E.html ※ 編輯: laechan (114.33.120.231 臺灣), 10/30/2024 20:06:42
justinj : 我是有做5秒以內可以記錄,但不儲存的功能.. 10/31 15:05
justinj : 那修改成5秒內都不能archive 10/31 15:35
justinj : 修正/std/new_ob/instance_room.c 移動時自動增加 10/31 15:36
justinj : 修正/d/ppl/justinj/cmds/_go.c 移動時自動增加 10/31 15:36
justinj : 修正/d/ppl/justinj/cmds/_archive.c 10/31 15:36
justinj : 修正/d/ppl/justinj/cmds/_map3.c 10/31 15:36
justinj : 修正/open/cmds/vobjs_d.c打死怪物時自動增加 10/31 15:36
justinj : 修改questing的部分,以及_archive.c/_map3.c 11/01 15:08
justinj : 其它修改都改回來..其它是用questing 11/01 15:09
laechan : 確認一下,成就資料存在skycastle 嗎? 11/01 16:02
justinj : 目前是存在skycastle..如果要在新手村用就要抽出來 11/01 17:02
laechan : it's ok, 目前跟nobu商量string讀取長度限制的放寬 11/01 17:28
laechan : 若有順利放寬, da 玩家的家時應該就show得出來 11/01 17:28