看板 mud_sanc 關於我們 聯絡資訊
這是給norr的 po在這裡是想要看看有沒有可以改的 ==================================================== //QUES模式({題目,答案群}) int check(string str) { object ob,ppl=this_player(); mixed ans,ques; int i,j; if(!ans=ppl->query_temp("ans")) return 1; //答案放在玩家身上 if(member_array(str,ans)==-1) return notify_fail("答錯了!!\n"); write("你答對了!!\n"); if(4<j=ppl->query_temp("times")) //判斷連續答對次數 { ob=clone_object(data["give_obj"]); //給的東東 write(ob->query("short")+"給你!\n"); ob->move_to(ppl); return 1; } if(!i=sizeof(QUES[j]0m)) return 1; //以下重新設定問題 ques=QUES[j][random(i)]; write(ques[0]); //題目 ppl->set_temp("ans",ques[1]); //答案群 ppl->add_temp("times",1); input_to("check",str); return 1; } =================================================================== 青藍色是分組題目的.... --    /\/. ◢◣ \\/.   ,\//, //o\,\//,.\//\█◣ /o\\ ,\/,,\/   //o\◢◣ | //o\\/o//o\\█◣|◢◣ //o\/o\.//,    |◢██◣| | | |██████◣| | \o\\   ◢██████|◣◢█|███████◣ | | -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.129.140.8
laechan :有看到一個地方要改,已經答過的問題就不要再出現除非 03/19 09:58
justinj :可以請norr將題目多補一點..不然就將QUES改成依times 03/19 10:34
justinj :來給題..每一種times的題目都不一樣....amem 03/19 10:34
※ 編輯: justinj 來自: 220.129.142.109 (03/19 10:38)
hlead :基本上 i 跟 j 亂跳的話 可以保證問題的唯一性.. 03/19 10:56
hlead :有 j 組...每組裡面有 i 題..所以應該不會重複.. 03/19 10:57
hlead :我是打算把mixed ans and ques拉出來另一個檔.. 03/19 10:58
hlead :所以你的ques and ans都是三唯陣列囉?... 03/19 11:00
hlead :然後你這樣 ans and times 會有問題 都沒清掉... 03/19 11:01
hlead :如果要多NPC共用..而且玩家又到處亂問...會有問題 03/19 11:02
justinj :一開始的當然你自己寫...我只是沒po上去而已... 03/19 11:03
justinj :start()->check()->check()->...->結束 03/19 11:04
justinj :start的部分可以問題重新開始那邊.... 03/19 11:06
hlead :喔...只是懶得花時間去寫..avert 03/19 11:06
hlead :反正能用就好...等之後自己要用到在寫一下就好了.. 03/19 11:06
hlead :當然,我不介意你順手幫我寫好的..哈哈~ 03/19 11:07
justinj : 參考...............我咧還會自行吃字.. 03/19 11:08
justinj :我只是花個幾分鐘寫一下...反正debug的部分就自行處 03/19 11:09
justinj :理...po在這裡的另一個目的它了(雖然我不知ppl會不會 03/19 11:10
justinj :出問題) 03/19 11:10
laechan :if(4<j=(int)ppl->query_temp("times")) 改這樣看看 03/19 11:22
justinj :ques ({問題1,答案群})...答案群是({答案1,答案2}) 03/19 12:51