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灯, 水草

请输入看板名称,例如:Gossiping站内搜寻

TOP