Re: [wizs] 問題請教

看板mud_sanc (Sanctuary - 聖殿)作者 (口古月)時間17年前 (2008/05/27 17:19), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串4/5 (看更多)
我一開始實驗單樣物品n個,用hlead貼的結果沒反應..複製貼上改掉道具也不能..痾 int return_obj(string str) { object ob,ppl=this_player(); mixed obs=all_inventory(ppl); int i,u; i=0; foreach(ob in obs) if(ob->query("mushroom")) i++; if (i<2) { write("你要收集滿兩個才能兌換唷!!\n"); return 1; } for(u=0;u<3;u++) { ob=present("mushroom",ppl); ob->remove(); } write("這是你要的東西,拿去吧!!!\n"); return 1; } 結果都顯示"你要收集滿兩個才能兌換唷"...沒成功. 測試2,我拿蘑菇跟骨頭來實驗,用小保貼的改2樣各n個來試 int return_obj(string str) { object ob,ppl=this_player(); mixed obs=all_inventory(ppl); int i,j; i=0; j=0; foreach(ob in obs) { if(ob->query("mushroom")) i++; if(ob->query("bone")) j++; } if(i>=2 && j>=2) write("這是你要的東西,拿去吧!!!\n"); else write("你東西要收集滿才能兌換唷!!\n"); return 1; } 結果只會顯示"你東西要收集滿才能兌換唷"....都失敗了.. 請問哪邊要修正? 還有一次移除兩種東西 ob=present("mushroom",ppl) && ob=present("bone",ppl) ob->remove(); 這樣寫可以?? 但是這樣好像只會移除一組而已..假如npc各要2組的話 for(k=0;k<3;k++) { ob=present("mushroom",ppl) && ob=present("bone",ppl) ob->remove(); 這樣不曉得行不行.. 小保貼的方法2就可以用,但是成功後的移除不曉得怎寫比較好 像蘑菇跟骨頭各兩個都移除掉..試不出來 目前就這樣..移除的部分還在研究 int return_obj(string str) { object ob1,ob2,ppl=this_player(); if(ob1=present("mushroom 2",ppl) && ob2=present("bone 2",ppl)) { write("這是你要的東西,拿去吧!!!\n"); } else write("你東西要收集滿才能兌換唷!!\n"); return 1; } 現在有點混亂..請示一下,謝謝.. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.29.188 ※ 編輯: aiggkimd 來自: 220.135.29.188 (05/27 18:10)

05/27 19:39, , 1F
ob->query("mushroom") <--你是錯這地方。
05/27 19:39, 1F

05/27 19:40, , 2F
那是物件上的另外參數,不是該物件ID。
05/27 19:40, 2F

05/27 23:06, , 3F
3q
05/27 23:06, 3F
文章代碼(AID): #18Ez8NS8 (mud_sanc)
討論串 (同標題文章)
以下文章回應了本文
0
1
完整討論串 (本文為第 4 之 5 篇):
0
1
2
2
文章代碼(AID): #18Ez8NS8 (mud_sanc)