mud_sanc 板


LINE

讓 ob trade 指令比較方便使用的觸發...大概 -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- 當下指令:"obtrd playerID"時,開始取得交易對象ID,並送出指令:ob。 這一系列觸發唯有變數 a 不為 nil 時,才會觸發。 -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- <aliases> <alias match="obtrd(.*)" enabled="y" group="obtrading" regexp="y" send_to="12" sequence="100" > <send> if '%1' == "" then Note (" 你要跟誰交易?<obtrd playerID>") else --將交易對象ID賦值於 a a = Trim('%1') --送出指令 ob 到 MUD。 Send('ob') end </send> </alias> </aliases> <triggers> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- 清空 OB_list 用! -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- <trigger enabled="y" group="obtrading" match="^你的物..欄帶著 \d+\/99 種物..:$" regexp="y" send_to="12" sequence="100" > <send>OB_list = nil</send> </trigger> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- 停止收集 ob 內容,並開始作業 -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- <trigger enabled="y" group="obtrading" match="^╚═════╩═══════════════════════════ ═════╝$" regexp="y" send_to="12" sequence="100" > <send> --移除變數。 b,Sell_list ,k_h = nil, nil,nil --判斷 a 值是否存在。 if a ~= nil then --對話框1:設定出售的清單。 result = utils.multilistbox("請選擇要出售的物品:", "OB交易", OB_list, default) --如果按下 cancel 或 未選擇項目就按下 OK 時 if result == nil or table.maxn(result) == 0 then Note ('交易已經中止!') -- else SellALL = {} table.foreach(result, function(i) table.insert(SellALL,OB_list[i]) end) --為下一個對話框建立已選擇物品清單 for k,y in pairs(SellALL) do if Sell_list == nil then Sell_list = "" end k_h = 12*k --下一個對話框的尺寸變動值(高) Sell_list = Sell_list..""..string.format("%%02d",k).."".. string.format("%%02d",string.match(y,"(%d+)")).."".. string.match(y," (%S+)").."\\n" end --for SellALL to Sell_list --對話框2:修改出售的數量。 result = utils.inputbox ([[請輸入各物品出售的數量:\n]].. [[1.各項數量以","分隔!\n]].. [[2.欲全數賣出單品,輸入"a"。\n]].. [[3.單品賣量大於持有量時,視為該項全數賣出。\n]].. [[4.不輸入內容直接按下確定,則整批全數出清。\n]].. [[╔═╦═╦═════════════════\n]].. [[║項║量║名 稱\n]].. [[╠═╬═╬═════════════════\n]].. Sell_list.. [[╚═╩═╩═════════════════]], "OB交易", nil, nil, '14',               --對話框尺寸調整        {box_width = 320, box_height = 230 + k_h, prompt_width = 310, prompt_height = 115 + k_h, reply_width = 310, reply_height = 25, }) --按下 cancel 鈕時, if result == nil then Note ('交易已經中止!') --輸入框未輸入內容並按下OK,直接送出內容。 elseif result == "" then Send ('ob trade ',table.concat(SellALL,","),' with ',a) --輸入框有內容並按下OK, else --取出result的值到v並遍歷 for v in string.gmatch(result,"(%w+)") do --gmatch不存在索引值,必須自行設定 if b == nil then b = 1 end --v為0就清空出售清單對應品項 if v == '0' then SellALL[b] = "" --v值不為a也不大於持有數,才修改出售數量 elseif v ~= "a" and v > string.match(SellALL[b],"(%d+)") then SellALL[b] = string.gsub(SellALL[b],'%d+',v) end b = b + 1 end -- for --整理格式,連續","改為一個","。 SellALL = string.gsub(table.concat(SellALL,","),',+',',') --移除開頭的","。 SellALL = string.gsub(SellALL,'^,','') --移除末尾的","。 SellALL = string.gsub(SellALL,',$','') --送出內容。 Send ('ob trade ',SellALL,' with ',a) end end end --移除用畢的變數 a, b, SellALL, OB_list = nil,nil,nil,nil </send> </trigger> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- 收集 ob 的資料,並存到OB_list。 -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- <trigger enabled="y" group="obtrading" match="^║( *\d+\.\S+\s+\( +\d+\)║[^\n]+║[^\n]+)║" regexp="y" send_to="12" sequence="100" > <send> if OB_list == nil then OB_list = {} end if a ~= nil then for k,v,i in string.gmatch('%1',"(%d+)%.(%S+)%s+%( +(%d+)%)") do table.insert(OB_list,k,i.." "..v) end end --if </send> </trigger> -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- </triggers> --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.196.45 ※ 編輯: hmml 來自: 220.132.196.45 (12/15 12:19)







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:e-shopping站內搜尋

TOP