Wait timers for buffing in MushClient

by Janalon

Back to Mechanic's Corner.

Janalon2009-01-31 14:32:31
Recently downloaded Wine on my MacBook so that I could finally install MushClient and get s system. YAY! This means I now have to convert all my my Nexus triggers and aliases over. BOO!

For most things, it is a simple cut and paste. Not too bad. I am, however, struggling with one thing-- how to convert the #WAIT command. Consider this example used when buffing after first entering the realms:

stance head
ka deflect left
#wait 7000
insomnia
brace
#wait 7000
grip
#wait 7000
shadowdance garb
#wait 7000
haste
#wait 7000
stealth whisper
#wait 7000
invoke red
#wait 7000
sneak
#wait 7000
parry all
#wait 9000
ka scorpiontail


Yeah. How do I convert the waits on over?
Unknown2009-01-31 14:47:09
There's a better way, but you should look into the DoAfter function if you want to stick with your timer method.
Janalon2009-01-31 17:12:50
Well... whats the better way? And can you give one example?
Acrune2009-01-31 17:27:57
The way I've always done it is have a deffing up variable that starts at 0. Then, have an alias that does your first def, and sets the variable to 1. Then I'd have a "You have regained equilibrium" trigger that checks the variable and does the next def, and increments the variable, so when I got eq back, the trigger would do the next defense. When all of the defs are done, set the variable back to 0.
Unknown2009-01-31 19:54:26
If you use my Treant combat system, it has a way to put up your defenses. Not all abilities are accounted for yet, but I add them as people report them missing. I like to use parallel queues for things that require different balances to speed it up as much as possible.
Unknown2009-01-31 19:54:37
QUOTE (Acrune @ Jan 31 2009, 12:27 PM) <{POST_SNAPBACK}>
The way I've always done it is have a deffing up variable that starts at 0. Then, have an alias that does your first def, and sets the variable to 1. Then I'd have a "You have regained equilibrium" trigger that checks the variable and does the next def, and increments the variable, so when I got eq back, the trigger would do the next defense. When all of the defs are done, set the variable back to 0.

You know what I do? I have a list of my deffs in the Mush Notepad(Among other things, I use it alot, it's quite helpful) and manually put defs up! tongue.gif
Acrune2009-01-31 21:01:06
Thats silly. My method takes 10 minutes to do, and then you don't have to worry about it again tongue.gif
Isuka2009-01-31 21:33:56
QUOTE (Janalon @ Jan 31 2009, 06:32 AM) <{POST_SNAPBACK}>
Recently downloaded Wine on my MacBook so that I could finally install MushClient and get s system. YAY! This means I now have to convert all my my Nexus triggers and aliases over. BOO!

For most things, it is a simple cut and paste. Not too bad. I am, however, struggling with one thing-- how to convert the #WAIT command. Consider this example used when buffing after first entering the realms:

stance head
ka deflect left
#wait 7000
insomnia
brace
#wait 7000
grip
#wait 7000
shadowdance garb
#wait 7000
haste
#wait 7000
stealth whisper
#wait 7000
invoke red
#wait 7000
sneak
#wait 7000
parry all
#wait 9000
ka scorpiontail


Yeah. How do I convert the waits on over?


Instead of using a timer, consider instead creating a variable that stores if you have balance or not. Then, create aliases for your defenses that both uses the command, and sets the balance properly (so if you DO SOMETHING that takes balance, it tells your system that you no longer have balance). Finally, when you regain balance, you run a check to see if you have any defenses that need to be put up using a trigger.

I know, it's more complicated, but it will help you compensate for lag and potentially speed up your deffing process. It will also teach you some essential skills when you're coding your combat curing system later on.
Janalon2009-01-31 22:19:25
QUOTE (Acrune @ Jan 31 2009, 04:01 PM) <{POST_SNAPBACK}>
Thats silly. My method takes 10 minutes to do, and then you don't have to worry about it again tongue.gif


Hahaha. Of course. Currently I am buffing in Nexus and switching to MushClient. Of course, I sometimes switch to Savitar if I want to be able to cut and paste text... So, I am presently using three clients, sometimes simultaneously.

I'll have to give one of these methods a try...
Chade2009-02-10 18:54:58
QUOTE (Janalon @ Jan 31 2009, 10:19 PM) <{POST_SNAPBACK}>
Hahaha. Of course. Currently I am buffing in Nexus and switching to MushClient. Of course, I sometimes switch to Savitar if I want to be able to cut and paste text... So, I am presently using three clients, sometimes simultaneously.

I'll have to give one of these methods a try...


Cutting and pasting in MUSHClient with a simple Ctrl+C on highlighted stuff is easy if you know how...

Here's how:

Download the copy_output.xml file attached to this post and put it in a folder you use for your MUSHClient stuff, then when you're logged in on MUSHClient go to File - Plugins, browse to the relevant folder and click on copy_output.xml once it's installed you can simply highlight anything you want to copy in mush and press ctrl+c and jobs a good un.

PS To download the file, right click it and click save as.
Isuka2009-02-10 20:33:52
I thought I'd give you an idea of the defup script I've come up with for my personal system.

I've been using Treant to teach me how Lua works, so there are absolutely similarities to how his system works.

First: you need to set up your defenses, and if you want to a table for displaying them based on category.


CODE
mydefs = {
     = { = "free", = "useenchant kingdom"},
     = { = "free", = "useenchant beauty"},
     = { = "free", = "thirdeye"},
     = { = "free", = "nightsight"},
     = { = "free", = "weathering"},
     = { = "free", = "combatstyle aggressive", = "aggressive"},
     = { = "free", = "stance legs", = "legs"},
     = { = "free", = "useenchant mercy"},
     = { = "free", = "useenchant perfection"},
     = { = "free", = "insomnia"},
     = { = "free", = "resistance"},
     = { = "free", = "regen on"},
     = { = "eq", = "chant draconis"},
     = { = "eq", = "chant rubeus"},
     = { = "eq", = "chant acquisitio on"},
     = { = "eq", = "chant fortuna"},
     = { = "phys", = "breathe deep"},
     = { = "eq", = "flex"},
     = { = "eq", = "constitution"},
     = { = "eq", = "grip"},
     = { = "free", = "adrenaline"},
     = { = "eq", = "useenchant levitate"},
     = { = "eq", = "invoke red", = "grounded"},
     = { = "eq", = "useenchant waterbreathe"},
     = { = "eq", = "useenchant waterwalk"},
     = { = "eq", = "read protection"},
     = { = "eq", = "chant populus"}
}

mydefcats = {
     = {"mercy","kingdom","perfection","beauty","waterwalk","waterbreathe","protection","levitate"},
     = {"fire","frost","kafe"},
     = {"gripping","stance","combat style"},
     = {"lich","lichseed"},
     = {"vitality","surge","speed","regeneration","boosting","strength","weathering","breathe","constitution","resistance"},
     = {"thirdeye","nightsight"},
     = {"fortuna","rubeus","populus","draconis","acquisitio"},
     = {"red"},
     = {"insomnia"}
}


Then, you need to set up the basics for handling defenses. I have a separate file for this.

CODE
if not defs then
    defs = {
        current = {}
    }
end

-- add, delete and check for defs
function defs:add(d,v)
    -- Only add a def if it isn't currently active
    if self.current then return end
    self.current = v or true
end

function defs:del(d)
    -- Only delete a def if it's currently up
    if not self.current then return end
    self.current = nil
end

function defs:has(d)
    -- return the value of a current def, or false
    if self.current then return self.current end
    return false
end

function defs:reset()
    self.current = {}
    Note("--- Defenses Reset ---")
end


Next, the code to actually parse through the list of defenses you've set up.

CODE
-- process a list of defenses
function defs:defup()
    if not mydefs then -- mydefs was never defined. Abort.
        return
    end
    -- create an easy to use function to remove clutter from later process
    local function processDef(name,cmd,bal,val)
        if not bals:canAct() then return true end
        if bal ~= "free" and not bals:has(bal) then return true end
        Execute(cmd)
        if val then    defs:add(name,val) else    defs:add(name) end
        if bal ~= "free" then bals:lose(bal) end
        return true
    end
    
    local continue = false
    -- every def will be defined with an associated command and balance.
    -- parse through them, and if possible run the command to put them up.
    -- do the free defs first
    for k,v in pairs(mydefs) do
        if not defs:has(k) and v == "free" then
            continue = processDef(k,v,v,v)
        end
    end
    for k,v in pairs(mydefs) do
        if not defs:has(k) then
            continue = processDef(k,v,v,v)
        end
    end
    -- Finalize by turning off the trigger group to stop further processing.
    if not continue then
        EnableGroup("defup_captures", false)
        defs:display()
    end
end


Finally, some code to display your defs in a cleaner format:

CODE
-- display a more useful DEF
function defs:display()

    -- small function to properly display title case
    local function titlecase(f,l)
      return f:upper()..l:lower()
    end
    for row,val in pairs(mydefcats) do
        local prow = row:gsub("()(*)",titlecase)
        local col = 1
        ColourNote("yellow","", prow .. ":")
        ColourTell("","",string.format("%-2s",""))
        for _,v in pairs(val) do
            if col > 4 then
                Note("")
                ColourTell("","",string.format("%-2s",""))
                col = 1
            end
            local color
            if defs:has(v) then color = "lime" else color = "crimson" end
            local skv = defs:has(v)
            v = v:gsub("()(*)",titlecase)
            if skv == true or skv == false then
                ColourTell(color, "", string.format("%-28s", v))
            else
                skv = skv:gsub("()(*)",titlecase)
                ColourTell(color, "", string.format("%-28s", v..": "..skv))
            end
            col = col + 1
        end
        Note("")
    end
end


Finally, you need to set up some triggers and aliases to make the system work properly:
CODE
To get the basic system working:

     match="^def$"
   enabled="y"
   group="defenses"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:reset()
EnableTriggerGroup("def_captures", true)
bals:lose("eq")
Send("def")

  
     name="defup_onbalregain"
   match="^OnBalRegain (\\w+)$"
   group="defup_captures"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="100"
  >
  defs:defup()
  


     group="defup_captures"
   keep_evaluating="y"
   match="^You are protected by \\d+ defences\\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:defup()
  



To get the balance captures working:

     custom_colour="3"
   enabled="y"
   match="^You have recovered equilibrium\\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  Execute("OnBalRegain eq")
  
     custom_colour="3"
   enabled="y"
   keep_evaluating="y"
   match="^You have recovered balance on all limbs\\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  Execute("OnBalRegain phys")
  


And an example of a couple of def capture triggers:

     group="def_captures"
   match="^Your vision is heightened to see in the dark\\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:add("nightsight")
  
     group="def_captures"
   match="^Your sense of time is heightened\\, and your reactions are speeded\\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:add("speed")
  
     group="def_captures"
   match="^Your muscles are flexed for increased strength\\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:add("strength")
  
     group="def_captures"
   match="^Your fighting stance is defending your legs\\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:add("stance", "legs")

  
     group="def_captures"
   match="^You have ingested the kafe bean and are feeling extremely energetic\\.$"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  defs:add("kafe")
  


Long winded, I know, and not exactly copy/paste ready, but I think it's a decent example of what's required, at least.