mud_jy 板


LINE

这个是後来觉得一阵子没玩,再上来就和新手一样,通通忘光光了,所以做成可以按的按钮 ,一键启动或是停止触发。 分为三个区块:触发、Alias、按钮的plugin。 PS.因为code有不少符号,如果不能用,可能是这些符号被bbs当成特殊的符号处理掉了,请 再和我说,我再修改,谢谢。 ====================================触发======================================== 这个部份就看需要做什麽了,底下是以我写的挖铜矿的触发,原则上我不习惯做太多的触发 ,以防其中一句没抓到,整个停下来,所以效率不会太好,堪用就是了。 注意事项: 1.需自行建立两个变数「jobminecount」、「jobminabexp」,预设值为0。 2.yourpassword请自行改为你的密码。 3.「abandon exp to 900000」、「deposit 10000 coin」和「jingjie exp 4000 」请自行更改成适合自己的数字;身上的钱还是会越来越多,所以改大一点会比 较好一些。 4.「exert regenerate」和「exert recover」是每做100次工作才会执行一次,请 自行决定要不要用,不用一定会晕,我自己的角色是放着12小时後会用完精力和 气血。 ===================================挖铜矿code=================================== <trigger enabled="y" group="minecopper" match="^(\&gt; |)你摸了摸了汗,看看空篮子,缕`算是干完么@趟了。$" name="coppermine01" regexp="y" send_to="12" sequence="100" > <send> world = GetWorldById(GetWorldID()) jobcount = tonumber(world.GetVariable("jobminecount")) abexpcount = tonumber(world.GetVariable("jobmineabexp")) abexpcount = tonumber(abexpcount) +1 world.SetVariable("jobmineabexp", abexpcount) if tonumber(abexpcount) % 100 == 0 then world.SetVariable("jobmineabexp", 1) Send("abandon exp to 900000") DoAfter(1, "yourpassword") DoAfter(6, "recall back") DoAfter(12.5, "west") DoAfter(12.5, "west") DoAfter(13, "deposit 10000 coin") DoAfter(18, "east") DoAfter(18.5, "south") DoAfter(19, "south") DoAfter(19.5, "south") DoAfter(20, "west") DoAfter(20.5, "fill dai") DoAfter(22, "east") DoAfter(23, "rideto hangzhou") DoAfter(25, "south") DoAfter(25, "south") DoAfter(25, "south") DoAfter(26, "southwest") DoAfter(26, "southwest") DoAfter(27, "west") DoAfter(27.5, "west") DoAfter(28, "west") DoAfter(28.5, "southwest") DoAfter(29, "south") DoAfter(29.5, "east") DoAfter(30, "east") DoAfter(30.5, "east") DoAfter(31, "exert regenerate") DoAfter(31.5, "exert recover") DoAfter(33, "ask gong about mine") DoAfter(33.5, "mine") elseif tonumber(abexpcount) % 10 == 0 then Send("jingjie exp 4000") end if tonumber(jobcount) &gt; 10 and tonumber(abexpcount) % 100 ~= 0 then world.SetVariable("jobminecount", 0) DoAfter(1, "eat liang") DoAfter(1, "eat liang") DoAfter(1.5, "drink dai") DoAfter(2, "drink dai") DoAfter(12, "ask gong about mine") DoAfter(13, "mine") elseif tonumber(abexpcount) % 100 ~= 0 then jobcount = jobcount + 1 world.SetVariable("jobminecount", jobcount) DoAfter(12, "ask gong about mine") DoAfter(13, "mine") end</send> </trigger> ================================================================================ ====================================Alias======================================= 其实是从检查触发的alias改出来的。 ====================================Code======================================== <alias name="EnORDisTriggers" match="^#tgs (\S+)$" enabled="y" group="SomeCmds" regexp="y" send_to="12" sequence="100" > <send> world = GetWorldById(GetWorldID()) target = "%1" trilist = GetTriggerList() if trilist then for sno, triname in ipairs (trilist) do grname = world.GetTriggerInfo(triname, 26) if grname == target then if world:GetTriggerInfo(triname, 8) then world.EnableTriggerGroup(grname, false) Note("Disable Trigger Group [" .. target .. "].") else world.EnableTriggerGroup(grname, true) Note("Enable Trigger Group [" .. target .. "].") end -- if group of trigger enabled or disabled break end -- if grname exists end -- for end -- if we have any triggers</send> </alias> ================================================================================ =================================按钮的plugin=================================== 原本想自己写,但超强的作者大大已经写好了,所以就直接用啦。 注意事项: 1.按钮需要一张图,但这张图只有32x32(pixels),所以别画太复杂,我是直接写 字而已。 2.图和档案放一起会比较没问题他的根目录预设是Mushclient的安装目录,请自行 更改成你放档安的目录,不改会看不到图,但功能是正常可用的。 3.路径的写法用「\」要注意一下写法,因为他是保留字,所以会需要多一个「\」 ,我看作者是用「/」但我没测试过,请自行测试。XD 4.会写script的大大可以直接写,我很懒把他拆到alias去了。 ps1.因为不是我自己写的,如果违反规则,我会把底下删了,只留下我自己改的部份。 ps2.最後附上原始连结 http://www.gammon.com.au/forum/?id=9359 ===============================底下是我改好的范例=============================== <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE muclient [ <!ENTITY horizontal "y" > <!ENTITY show_time "n" > ]> <muclient> <plugin name="Icon_Bar" author="Nick Gammon" id="ede0920fc1173d5a03140f0e" language="Lua" purpose="Shows a bar of buttons you can click on to do things" date_written="2009-02-26 09:00" date_modified="2010-05-31 17:22" requires="4.40" save_state="y" version="5.0" > <description trim="y"> <![CDATA[ Install this plugin to show a button bar. Click on an icon to execute a script or send a command to the MUD. ]]> </description> </plugin> <!-- Timers --> <timers> <timer script="handle_cooldowns" enabled="y" second="1.00" active_closed="y" > </timer> </timers> <!-- Script --> <script> -- pull in entities outside the CDATA block horizontal = ("&horizontal;"):lower ():sub (1, 1) == "y"; show_time = ("&show_time;"):lower ():sub (1, 1) == "y"; <![CDATA[ -- table of buttons --[[ Each button can have up to four entries: icon - filename of the image to draw tooltip - what to show if you hover the mouse over the button send - what to send to the MUD script - a script function to call cooldown - time spell takes to cool down, in seconds sound - sound to play when button pressed --]] buttons = { -- button 挖铜矿 { icon = "\worlds\\jins\\MineCopper.png", -- icon image tooltip = "挖铜矿", -- tooltip help text send = "#tgs minecopper", -- what to send --cooldown = 10, -- cooldown time in seconds --sound = "chimes.wav", -- sound to play when cast }, -- end of button 挖铜矿 -- button 2 -- { -- icon = "SwordIcon.png", -- tooltip = "Attack", -- send = "kill @target", -- cooldown = 1 * 60 * 60, -- 1 hour cooldown -- }, -- end of button 2 -- button 3 -- { -- icon = "SparkIcon2.png", -- tooltip = "Special Attacks", -- script = function () -- script to execute when clicked -- -- choose from menu -- local result = WindowMenu (win, -- WindowInfo (win, 14), -- x -- WindowInfo (win, 15), -- y -- "Backstab|Stun|Kick|Taunt") -- -- if not cancelled, do action on current target -- if result ~= "" then -- Send (result:lower () .. " " .. GetPluginVariable ("", "target")) -- end -- if -- end, -- script function -- cooldown = 10 * 60, -- 10 minute cooldown -- }, -- end of button 3 --> add more buttons here } -- end of buttons table -- configuration ICON_SIZE = 32 BACKGROUND_COLOUR = ColourNameToRGB "bisque" BOX_COLOUR = ColourNameToRGB "royalblue" BUTTON_EDGE = ColourNameToRGB "silver" MOUSE_DOWN_COLOUR = ColourNameToRGB "darkorange" -- where to put the window WINDOW_POSITION = 6 -- top right OFFSET = 6 -- gap inside box EDGE_WIDTH = 2 -- size of border stroke --[[ Useful positions: 4 = top left 5 = center left-right at top 6 = top right 7 = on right, center top-bottom 8 = on right, at bottom 9 = center left-right at bottom --]] -- font and size to use FONT_NAME = "Lucida Sans Unicode" FONT_SIZE = 18 FONT_SIZE_MEDIUM = 14 FONT_SIZE_SMALL = 10 FONT_COLOUR = ColourNameToRGB "yellow" -- sound to play if on cooldown ON_COOLDOWN_SOUND = "ding.wav" frames = {} -- remember where each icon was require "commas" function mousedown (flags, hotspot_id) if hotspot_id == "_" then -- find where mouse is so we can adjust window relative to mouse startx, starty = WindowInfo (win, 14), WindowInfo (win, 15) -- find where window is in case we drag it offscreen origx, origy = WindowInfo (win, 10), WindowInfo (win, 11) return end -- if local n = tonumber (hotspot_id) -- draw the button border in another colour for visual feedback WindowRectOp (win, 1, frames [n].x1, frames [n].y1, frames [n].x2, frames [n].y2, MOUSE_DOWN_COLOUR) Redraw () end -- mousedown function cancelmousedown (flags, hotspot_id) local n = tonumber (hotspot_id) -- draw the button border in original colour for visual feedback WindowRectOp (win, 1, frames [n].x1, frames [n].y1, frames [n].x2, frames [n].y2, BUTTON_EDGE) Redraw () end -- cancelmousedown function mouseup (flags, hotspot_id) -- fix border colour cancelmousedown (flags, hotspot_id) local n = tonumber (hotspot_id) local button = buttons [n] -- shift key clears cooldown if bit.band (flags, 1) == 1 then SetCooldown (n, nil) return end -- if -- can't press button if on cooldown if (button.cooldown_left or 0) > 0 then Sound (ON_COOLDOWN_SOUND) return end -- still on cooldown -- play sound if defined if button.sound then Sound (button.sound) end -- sound to play -- send to world if something specified if type (button.send) == "string" and button.send ~= "" then local errors = {} -- no errors yet -- function to do the replacements for string.gsub local function replace_variables (s) s = string.sub (s, 2) -- remove the @ replacement = GetPluginVariable ("", s) -- look up variable in global variables if not replacement then -- not there, add to errors list table.insert (errors, s) return end -- not there return replacement -- return variable end -- replace_variables -- replace all variables starting with @ local command = string.gsub (button.send, "@%a[%w_]*", replace_variables) -- report any errors if #errors > 0 then for k, v in ipairs (errors) do ColourNote ("white", "red", "Variable '" .. v .. "' does not exist") end -- for return end -- error in replacing Execute (command) end -- if -- execute script if wanted if type (button.script) == "function" then button.script (n) end -- if SetCooldown (n, button.cooldown) end -- mouseup function dragmove(flags, hotspot_id) -- find where it is now local posx, posy = WindowInfo (win, 17), WindowInfo (win, 18) -- move the window to the new location WindowPosition(win, posx - startx, posy - starty, 0, 2); -- change the mouse cursor shape appropriately if posx < 0 or posx > GetInfo (281) or posy < 0 or posy > GetInfo (280) then SetCursor (11) -- X cursor else SetCursor (10) -- arrow (NS/EW) cursor end -- if end -- dragmove function dragrelease(flags, hotspot_id) local newx, newy = WindowInfo (win, 17), WindowInfo (win, 18) -- don't let them drag it out of view if newx < 0 or newx > GetInfo (281) or newy < 0 or newy > GetInfo (280) then -- put it back WindowPosition(win, origx, origy, 0, 2); end -- if out of bounds end -- dragrelease function SetCooldown (n, amount) assert (n >= 1 and n <= #buttons, "Bad button number " .. n .. " to SetCooldown") if amount then assert (amount >= 0, "Bad amount " .. amount .. " to SetCooldown") end -- if local frame = frames [n] local x1, y1, x2, y2 = frame.x1 + 1, frame.y1 + 1, frame.x2 - 1, frame.y2 - 1 buttons [n].cooldown_left = amount -- cooldown time left in seconds local max = buttons [n].cooldown or 0 -- max cooldown time local percent -- how far cooled down we are as a percent if max > 0 then percent = (amount or 0) / max else percent = 0 -- don't divide by zero! end -- if -- reload the image if WindowDrawImage(win, n, x1, y1, -- left, top x2, y2, -- right, bottom 2) -- mode - stretch or shrink ~= error_code.eOK then WindowRectOp (win, 2, x1, y1, -- left, top x2, y2, -- right, bottom BACKGROUND_COLOUR) end if amount and amount > 0 then -- calculate pie end point local endx = math.cos (math.rad (percent * 360 + 90)) * ICON_SIZE + ICON_SIZE / 2 local endy = -1 * math.sin (math.rad (percent * 360 + 90)) * ICON_SIZE + ICON_SIZE / 2 -- clear temporary window WindowRectOp (tempwin, 2, 0, 0, 0, 0, 0xFFFFFF) -- fill with white -- draw the pie showing amount of cooldown WindowCircleOp (tempwin, 5, -10, -10, ICON_SIZE + 10, ICON_SIZE + 10, -- pie 0x000000, 5, 0, -- no pen 0x000000, 0, -- solid brush, black ICON_SIZE / 2, 0, -- from 12 o'clock position endx, endy) -- turn pie shape into an image WindowImageFromWindow(win, "mask", tempwin) -- blend in (darken mode) with 50% opacity WindowBlendImage(win, "mask", x1, y1, x2, y2, -- rectangle 5, -- darken 0.5) -- opacity -- if they want to see the time left (text on top of the button) do that now if show_time then local font = "f" local time_left = convert_time (amount) time_left = string.gsub (time_left, "[ s]", "") -- get rid of spaces, and "s" local time_len = WindowTextWidth (win, font, time_left) -- use smaller font if it doesn't fit if time_len > ICON_SIZE then font = "f2" time_len = WindowTextWidth (win, font, time_left) -- still too big? if time_len > ICON_SIZE then font = "f3" time_len = WindowTextWidth (win, font, time_left) end -- if end -- if local font_height = WindowFontInfo (win, font, 1) local x_offset = math.max ((ICON_SIZE - time_len) / 2, 0) local y_offset = math.max ((ICON_SIZE - font_height) / 2, 0) WindowText (win, font, time_left, x1 + x_offset + 2, y1 + y_offset + 2, x2, y2, 0x000000) WindowText (win, font, time_left, x1 + x_offset, y1 + y_offset, x2, y2, FONT_COLOUR) end -- show_time else buttons [n].cooldown_left = nil end -- if Redraw () end -- function SetCooldown function OnPluginInstall () local x, y, mode, flags = tonumber (GetVariable ("windowx")) or 0, tonumber (GetVariable ("windowy")) or 0, tonumber (GetVariable ("windowmode")) or WINDOW_POSITION, -- top right tonumber (GetVariable ("windowflags")) or 0 -- check miniwindow visible if x < 0 or x > GetInfo (281) or y < 0 or y > GetInfo (280) then x, y = 0, 0 -- reset to top left end -- if not visible win = GetPluginID () -- get a unique name tempwin = win .. ":temp" local gauge_height, gauge_width if horizontal then window_width = (#buttons * (ICON_SIZE + OFFSET)) + OFFSET window_height = ICON_SIZE + (OFFSET * 2) else window_width = ICON_SIZE + (OFFSET * 2) window_height = (#buttons * (ICON_SIZE + OFFSET)) + OFFSET end -- if -- make the miniwindow WindowCreate (win, x, y, -- left, top (auto-positions) window_width, -- width window_height, -- height mode, -- position mode flags, -- flags BACKGROUND_COLOUR) -- for drawing cooldowns (window not visible) WindowCreate (tempwin, 0, 0, -- left, top ICON_SIZE, -- width ICON_SIZE, -- height 12, -- position mode 0, -- flags ColourNameToRGB "white") -- grab fonts WindowFont (win, "f", FONT_NAME, FONT_SIZE, true) WindowFont (win, "f2", FONT_NAME, FONT_SIZE_MEDIUM, true) WindowFont (win, "f3", FONT_NAME, FONT_SIZE_SMALL, true) -- draw the buttons for n, v in ipairs (buttons) do if v.icon then if WindowLoadImage (win, n, GetInfo (66) .. v.icon) ~= error_code.eOK then DoAfterSpecial (1, string.format ([[ ColourNote ("white", "red", "Could not load image '%s'")]], string.gsub (GetInfo (66) .. v.icon, '\\', '\\\\')), sendto.script) end -- if end -- if icon specified local x1, y1, x2, y2 -- where to draw the icon if horizontal then x1, y1 = (n - 1) * (ICON_SIZE + OFFSET) + OFFSET, OFFSET x2, y2 = n * (ICON_SIZE + OFFSET), ICON_SIZE + OFFSET else x1, y1 = OFFSET, (n - 1) * (ICON_SIZE + OFFSET) + OFFSET x2, y2 = ICON_SIZE + OFFSET, n * (ICON_SIZE + OFFSET) end -- if -- draw the image if WindowDrawImage(win, n, x1, y1, -- left, top x2, y2, -- right, bottom 2) -- mode - stretch or shrink ~= error_code.eOK then WindowRectOp (win, 2, x1, y1, -- left, top x2, y2, -- right, bottom BACKGROUND_COLOUR) end -- if -- remember where to draw the frame, for mouse clicks frames [n] = { x1 = x1 - 1, y1 = y1 - 1, x2 = x2 + 1, y2 = y2 + 1 } -- draw the button border WindowRectOp (win, 1, frames [n].x1, frames [n].y1, frames [n].x2, frames [n].y2, BUTTON_EDGE) -- make a hotspot we can click on WindowAddHotspot(win, n, frames [n].x1, frames [n].y1, frames [n].x2, frames [n].y2, -- rectangle "", -- mouseover "", -- cancelmouseover "mousedown", "cancelmousedown", "mouseup", v.tooltip, -- tooltip text 1, 0) -- hand cursor end -- for each world -- draw the border of the whole box WindowCircleOp (win, 2, 0, 0, 0, 0, BOX_COLOUR, 6, EDGE_WIDTH, 0x000000, 1) -- make a hotspot WindowAddHotspot(win, "_", 0, 0, 0, 0, -- whole window "", -- MouseOver "", -- CancelMouseOver "mousedown", "", -- CancelMouseDown "", -- MouseUp "Drag to move", -- tooltip text 10, 0) -- arrow (NS/EW) cursor WindowDragHandler(win, "_", "dragmove", "dragrelease", 0) if GetVariable ("enabled") == "false" then ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.") EnablePlugin (GetPluginID (), false) return end -- they didn't enable us last time -- ensure window visible WindowShow (win, true) end -- OnPluginInstall -- hide window on removal function OnPluginClose () WindowShow (win, false) -- hide it end -- OnPluginClose -- show window on enable function OnPluginEnable () WindowShow (win, true) -- show it end -- OnPluginEnable -- hide window on disable function OnPluginDisable () WindowShow (win, false) -- hide it end -- OnPluginDisable function OnPluginSaveState () SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17))) SetVariable ("windowx", WindowInfo (win, 10)) SetVariable ("windowy", WindowInfo (win, 11)) SetVariable ("windowmode", WindowInfo (win, 7)) SetVariable ("windowflags", WindowInfo (win, 8)) end -- OnPluginSaveState -- called every second on a timer function handle_cooldowns (name) for n, v in ipairs (buttons) do if buttons [n].cooldown_left then SetCooldown (n, buttons [n].cooldown_left - 1) end -- if some cooldown left end -- for end -- function handle_cooldowns ]]> </script> </muclient> ================================================================================ --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 112.105.167.2
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/mud_jy/M.1440841709.A.C6D.html
1F:推 tawi: $GT好像是多余的? 08/29 18:16
2F:推 tawi: &gt 08/29 18:16
3F:→ rsliang: 那个是符号>,不能省掉,有时候在mud中最前面会多「> 」 08/29 19:48







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