Help - Search - Members - Calendar
Full Version: Mush Class On/off Control
Achaea's Forums > Off-Topic > Tech Support > Client Help
Dontarion
So I've painstakingly made a new alias that controls my classes that are on and off. Now, I use the userbar to show these so I must keep track of what's on. I also have special setups like tn all on, or tn bashing on, etc and tn all on doesn't turn on bashing.

This script may help newer users move to MUSH as some of the more advanced features are in it. This is written in Lua. I am no expert as I'm learning as I go. It isn't hard though.

CODE
if string.find ("Monk|Occultist|Occie|Runewarden|Runie|Shaman|Apostate|Monk|Jester|Bard|Druid
|Sylvan|Sentinel|All|Dragon|Bash|Bashing|Priest|Paladin|Magi", string.proper("%1")) and string.find("On|Off", string.proper("%2")) then
    if "%2" == "on" then
        if "%1" == "monk" then
            EnableGroup("xatk_Kaido", true)
            EnableGroup("xatk_Tekura", true)
            EnableGroup("xatk_Telepathy", true)
        elseif "%1" == "occultist" then
            EnableGroup("xatk_Occultism", true)
            EnableGroup("xatk_Domination", true)
            EnableGroup("xatk_Tarot", true)
        elseif "%1" == "sentinel" then
            EnableGroup("xatk_Woodlore", true)
            EnableGroup("xatk_Metamorphosis", true)
        elseif "%1" == "sylvan" then
            EnableGroup("xatk_Elementalism", true)
            EnableGroup("xatk_Groves", true)
        elseif "%1" == "druid" then
            EnableGroup("xatk_Metamorphosis", true)
            EnableGroup("xatk_Groves", true)
        elseif "%1" == "shaman" then
            EnableGroup("xatk_Curses", true)
            EnableGroup("xatk_Runelore", true)
            EnableGroup("xatk_Vodun", true)
        elseif "%1" == "jester" then
            EnableGroup("xatk_Tarot", true)
            EnableGroup("xatk_Pranks", true)
            EnableGroup("xatk_Vodun", true)
        elseif "%1" == "priest" then
            EnableGroup("xatk_Healing", true)
            EnableGroup("xatk_Devotion", true)
            EnableGroup("xatk_Spirituality", true)
        elseif "%1" == "magi" then
            EnableGroup("xatk_Elementalism", true)
            EnableGroup("xatk_Crystallism", true)
        elseif "%1" == "paladin" then
            EnableGroup("xatk_Devotion", true)
            EnableGroup("xatk_Chivalry", true)
        elseif "%1" == "infernal" then
            EnableGroup("xatk_Chivalry", true)
            EnableGroup("xatk_Necromancy", true)
        elseif "%1" == "apostate" then
            EnableGroup("xatk_Necromancy", true)
            EnableGroup("xatk_Apostasy", true)
            EnableGroup("xatk_Evileye", true)
        elseif "%1" == "serpent" then
            EnableGroup("xatk_Venom", true)
            EnableGroup("xatk_Subterfuge", true)
            EnableGroup("xatk_Hypnosis", true)
        elseif "%1" == "bard" then
            EnableGroup("xatk_Harmonics", true)
            EnableGroup("xatk_Swashbuckling", true)
            EnableGroup("xatk_Voicecraft", true)
        elseif "%1" == "runewarden" then
            EnableGroup("xatk_Chivalry", true)
            EnableGroup("xatk_Runelore", true)
        elseif "%1" == "dragon" then
            EnableGroup("xatk_Dragoncraft", true)
        elseif "%1" == "bash" then
            EnableGroup("bash", true)
        elseif "%1" == "bashing" then
            EnableGroup("bash", true)
        elseif "%1" == "all" then
            EnableGroup("xatk_Kaido", true)
            EnableGroup("xatk_Tekura", true)
            EnableGroup("xatk_Telepathy", true)
            EnableGroup("xatk_Occultism", true)
            EnableGroup("xatk_Domination", true)
            EnableGroup("xatk_Tarot", true)
            EnableGroup("xatk_Woodlore", true)
            EnableGroup("xatk_Metamorphosis", true)
            EnableGroup("xatk_Elementalism", true)
            EnableGroup("xatk_Groves", true)
            EnableGroup("xatk_Metamorphosis", true)
            EnableGroup("xatk_Groves", true)
            EnableGroup("xatk_Curses", true)
            EnableGroup("xatk_Runelore", true)
            EnableGroup("xatk_Vodun", true)
            EnableGroup("xatk_Tarot", true)
            EnableGroup("xatk_Pranks", true)
            EnableGroup("xatk_Vodun", true)
            EnableGroup("xatk_Healing", true)
            EnableGroup("xatk_Devotion", true)
            EnableGroup("xatk_Spirituality", true)
            EnableGroup("xatk_Elementalism", true)
            EnableGroup("xatk_Crystallism", true)
            EnableGroup("xatk_Devotion", true)
            EnableGroup("xatk_Chivalry", true)
            EnableGroup("xatk_Chivalry", true)
            EnableGroup("xatk_Necromancy", true)
            EnableGroup("xatk_Necromancy", true)
            EnableGroup("xatk_Apostasy", true)
            EnableGroup("xatk_Evileye", true)
            EnableGroup("xatk_Venom", true)
            EnableGroup("xatk_Subterfuge", true)
            EnableGroup("xatk_Hypnosis", true)
            EnableGroup("xatk_Harmonics", true)
            EnableGroup("xatk_Swashbuckling", true)
            EnableGroup("xatk_Voicecraft", true)
            EnableGroup("xatk_Chivalry", true)
            EnableGroup("xatk_Runelore", true)
            EnableGroup("xatk_Dragoncraft", true)
        end
    else
        if "%1" == "monk" then
            EnableGroup("xatk_Kaido", false)
            EnableGroup("xatk_Tekura", false)
            EnableGroup("xatk_Telepathy", false)
        elseif "%1" == "occultist" then
            EnableGroup("xatk_Occultism", false)
            EnableGroup("xatk_Domination", false)
            EnableGroup("xatk_Tarot", false)
        elseif "%1" == "sentinel" then
            EnableGroup("xatk_Woodlore", false)
            EnableGroup("xatk_Metamorphosis", false)
        elseif "%1" == "sylvan" then
            EnableGroup("xatk_Elementalism", false)
            EnableGroup("xatk_Groves", false)
        elseif "%1" == "druid" then
            EnableGroup("xatk_Metamorphosis", false)
            EnableGroup("xatk_Groves", false)
        elseif "%1" == "shaman" then
            EnableGroup("xatk_Curses", false)
            EnableGroup("xatk_Runelore", false)
            EnableGroup("xatk_Vodun", false)
        elseif "%1" == "jester" then
            EnableGroup("xatk_Tarot", false)
            EnableGroup("xatk_Pranks", false)
            EnableGroup("xatk_Vodun", false)
        elseif "%1" == "priest" then
            EnableGroup("xatk_Healing", false)
            EnableGroup("xatk_Devotion", false)
            EnableGroup("xatk_Spirituality", false)
        elseif "%1" == "magi" then
            EnableGroup("xatk_Elementalism", false)
            EnableGroup("xatk_Crystallism", false)
        elseif "%1" == "paladin" then
            EnableGroup("xatk_Devotion", false)
            EnableGroup("xatk_Chivalry", false)
        elseif "%1" == "infernal" then
            EnableGroup("xatk_Chivalry", false)
            EnableGroup("xatk_Necromancy", false)
        elseif "%1" == "apostate" then
            EnableGroup("xatk_Necromancy", false)
            EnableGroup("xatk_Apostasy", false)
            EnableGroup("xatk_Evileye", false)
        elseif "%1" == "serpent" then
            EnableGroup("xatk_Venom", false)
            EnableGroup("xatk_Subterfuge", false)
            EnableGroup("xatk_Hypnosis", false)
        elseif "%1" == "bard" then
            EnableGroup("xatk_Harmonics", false)
            EnableGroup("xatk_Swashbuckling", false)
            EnableGroup("xatk_Voicecraft", false)
        elseif "%1" == "runewarden" then
            EnableGroup("xatk_Chivalry", false)
            EnableGroup("xatk_Runelore", false)
        elseif "%1" == "dragon" then
            EnableGroup("xatk_Dragoncraft", false)
        elseif "%1" == "bash" then
            EnableGroup("bash", false)
        elseif "%1" == "bashing" then
            EnableGroup("bash", false)
        elseif "%1" == "all" then
            EnableGroup("xatk_Kaido", false)
            EnableGroup("xatk_Tekura", false)
            EnableGroup("xatk_Telepathy", false)
            EnableGroup("xatk_Occultism", false)
            EnableGroup("xatk_Domination", false)
            EnableGroup("xatk_Tarot", false)
            EnableGroup("xatk_Woodlore", false)
            EnableGroup("xatk_Metamorphosis", false)
            EnableGroup("xatk_Elementalism", false)
            EnableGroup("xatk_Groves", false)
            EnableGroup("xatk_Metamorphosis", false)
            EnableGroup("xatk_Groves", false)
            EnableGroup("xatk_Curses", false)
            EnableGroup("xatk_Runelore", false)
            EnableGroup("xatk_Vodun", false)
            EnableGroup("xatk_Tarot", false)
            EnableGroup("xatk_Pranks", false)
            EnableGroup("xatk_Vodun", false)
            EnableGroup("xatk_Healing", false)
            EnableGroup("xatk_Devotion", false)
            EnableGroup("xatk_Spirituality", false)
            EnableGroup("xatk_Elementalism", false)
            EnableGroup("xatk_Crystallism", false)
            EnableGroup("xatk_Devotion", false)
            EnableGroup("xatk_Chivalry", false)
            EnableGroup("xatk_Chivalry", false)
            EnableGroup("xatk_Necromancy", false)
            EnableGroup("xatk_Necromancy", false)
            EnableGroup("xatk_Apostasy", false)
            EnableGroup("xatk_Evileye", false)
            EnableGroup("xatk_Venom", false)
            EnableGroup("xatk_Subterfuge", false)
            EnableGroup("xatk_Hypnosis", false)
            EnableGroup("xatk_Harmonics", false)
            EnableGroup("xatk_Swashbuckling", false)
            EnableGroup("xatk_Voicecraft", false)
            EnableGroup("xatk_Chivalry", false)
            EnableGroup("xatk_Runelore", false)
            EnableGroup("xatk_Dragoncraft", false)
            EnableGroup("bash", false)
        end
    end
    EnableGroup("xvenom", false)
    EnableGroup("xcurses", false)
    EnableGroup("xrunes", false)
    if "%1" == "all" then
        Note("All classes have been turned " .. string.upper("%2") .. "!")
    else
        Note(string.proper("%1") .. " has been turned " ..   string.upper("%2") .. "!")
    end
    if "%2" == "on" then
        if not string.find(GetVariable("classeson"), string.proper("%1")) then
            if GetVariable("classeson") == "" then
                if "%1" == "bash" or "%1" == "bashing" then
                    SetVariable("classeson", string.proper("bashing"))
                elseif "%1" == "occie" then
                    SetVariable("classeson", string.proper("Occultist"))
                elseif "%1" == "all" then
                    SetVariable("classeson", "")
                    SetVariable("classeson", "Monk|Occultist|Runewarden|Shaman|Apostate|Monk|Jester|Bard|Druid|Sylvan|Sent
inel|Priest|Paladin|Magi|Dragon")
                else
                    SetVariable("classeson", string.proper("%1"))
                end
            else
                if "%1" == "bash" or "%1" == "bashing" then
                    SetVariable("classeson", GetVariable("classeson") .. "|" .. string.proper("bashing"))
                elseif "%1" == "occie" then
                    SetVariable("classeson", GetVariable("classeson") .. "|" .. string.proper("Occultist"))
                elseif "%1" == "all" then
                    SetVariable("classeson", "")
                    SetVariable("classeson", "Monk|Occultist|Runewarden|Shaman|Apostate|Monk|Jester|Bard|Druid|Sylvan|Sent
inel|Priest|Paladin|Magi|Dragon")
                else
                    SetVariable("classeson", GetVariable("classeson") .. "|" .. string.proper("%1"))
                end
            end
        else
        end
    elseif "%2" == "off" then
        if "%1" == "all" then
            SetVariable("classeson", "")
        else
            SetVariable("classeson", string.gsub(GetVariable("classeson"), string.proper("%1|"), ""))
            SetVariable("classeson", string.gsub(GetVariable("classeson"), string.proper("|%1"), ""))
            SetVariable("classeson", string.gsub(GetVariable("classeson"), string.proper("%1"), ""))
        end
    end
else
    Note("Chose the correct class or turn on and off.")
end


Inside my prompt trigger you'll find this for manipulating the userbar (that grey bar right below the text input):

CODE
    -- Userbar start:
    InfoClear()
    InfoColour("cyan")
    InfoBackground("black")
    Info("Target: " .. GetVariable("target") .. "    |    Classes Enabled: " .. string.gsub(GetVariable("classeson"), "|", ", "))
    -- Userbar end!


I know, I haven't commented at all in the alias code for class control but I just wrote it. Deal with it. laugh.gif
Soludra
This could be much simplified if you kept a table of class -> skills pairs. For example:

CODE
classes = {
  monk = {"Kaido", "Tekura", "Telepathy"},
  occultist = {"Occultism", "Domination", "Tarot"},
  sentinel = {"Woodlore", "Metamorphosis"},
  sylvan = {"Elementalism", "Groves"},
  druid = {"Metamorphosis", "Groves"},

  -- et cetera
}


Then your alias would just be something like this:

CODE
for _,skill in ipairs(classes["%1"]) do
  EnableGroup("xatk_" .. skill, ("%2" == "on"))
end


Any questions? smile.gif
Dontarion
No questions. I really don't feel like rewriting that right now. biggrin.gif
Penquin
Painstakenly wrote, huh?
Dontarion
Yes and no. Doing it that way gave me pretty extended control especially regarding the new stuff I've added to it.
Penquin
QUOTE (Dontarion @ Aug 17 2009, 09:57 PM) *
Yes and no. Doing it that way gave me pretty extended control especially regarding the new stuff I've added to it.


Honestly, I just see it as a rewrite of my python fuction 'class' in the script file, but with a longer if statement and written in LUA:P
CODE
def Class(name,output,wildcards):
    tar = wildcards[0]
    al_debug(wildcards)
    target = world.GetVariable("target")
    Class = wildcards[1].strip(" ")
    classes =["apostate","bard","serpent","paladin","occie","infernal","jester","shaman","sentinel","druid","sylvan","monk","occie","priest","runewarden","bash","magi", "all", "dragon", "bash"]
    trig_list=["apostate","bards","bubonis","chiv","crystal","defs","devo","dolls","elements","evileye","groves","hall","hypno","jester","meta","monk","necro","occie","priest","runes","shamans","entinels","serpent","tarot","venoms","magi", "dragon", "bash"]
    world.SetVariable("class",wildcards[1].strip(" "))
    if tar in classes:
        tar = target
        Class = wildcards[0]
        world.SetVariable("class",Class)
    if Class == "dragon":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("dragon",1)
        world.EnableTriggerGroup("Arena",1)
    if Class == "bash":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("bash",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "serpent":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("Arena",1)
        world.EnableTriggerGroup("serpent",1)
    elif Class == "monk":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("monk",1)
        world.EnableTriggerGroup("Arena",1)
        world.EnableTrigger("Arena_limb",0)
    elif Class == "sentinel":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("sentinel",1)
        world.EnableTriggerGroup("meta",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "apostate":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("apostate",1)
        world.EnableTriggerGroup("necro",1)
        world.EnableTriggerGroup("evileye",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "bard":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("bards",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "paladin":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("chiv",1)
        world.EnableTriggerGroup("devo",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "infernal":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("chiv",1)
        world.EnableTriggerGroup("necro",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "runewarden":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("chiv",1)
        world.EnableTriggerGroup("runes",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "shaman":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("dolls",1)
        world.EnableTriggerGroup("runes",1)
        world.EnableTriggerGroup("jester",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "jester":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("dolls",1)
        world.EnableTriggerGroup("jester",1)
        world.EnableTriggerGroup("tarot",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "occie":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("occie",1)
        world.EnableTriggerGroup("tarot",1)
        world.EnableTriggerGroup("bubonis",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "priest":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("priest",1)
        world.EnableTriggerGroup("devo",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "magi":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("elements",1)
        world.EnableTriggerGroup("crystal",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "sylvan":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("elements",1)
        world.EnableTriggerGroup("groves",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "druid":
        for x in trig_list:
            world.EnableTriggerGroup(x,0)
        world.EnableTriggerGroup("meta",1)
        world.EnableTriggerGroup("groves",1)
        world.EnableTriggerGroup("Arena",1)
    elif Class == "all" or Class == "bash":
        for x in trig_list:
            world.EnableTriggerGroup(x,1)
        world.EnableTriggerGroup("Arena",1)
    if Class != "monk":
        world.EnableTrigger("Arena_limb",1)
    else:
        world.EnableTrigger("Arena_limb",0)

    if name == "target":
        if Class:
            if Class not in classes:
                al_alert("Choose a class!")
            else:
                if tar != target:
                    al_en("TARGET IS NOW: " + string.upper(tar) + " --CLASS: " + string.upper(Class))
                    world.SetVariable("target",string.capitalize(tar))
                else:
                    al_en("CLASS: " + string.upper(Class))
        else:
            for x in classes:
                world.EnableTriggerGroup(x,0)
            al_en("TARGET IS NOW: " + string.upper(tar))
            world.SetVariable("target",string.capitalize(tar))
            world.EnableTriggerGroup("Arena",1)
    
        if Class == "all" or Class == " ":
            world.SetVariable("class","")
    else:
        al_debug("ALIAS WAS NOT CALLED")
        if Class:
            if tar != target:
                world.SetVariable("target",string.capitalize(tar))
        else:
            for x in classes:
                world.EnableTriggerGroup(x,0)
            world.SetVariable("target",string.capitalize(tar))
            world.EnableTriggerGroup("Arena",1)

        if Class == "all" or Class == " ":
            world.SetVariable("class","")
Dontarion
I didn't really look at your Python. I suppose I should though. I couldn't deal with your 1500 triggers so I loaded up an old one I worked on and started from scratch. Almost done. Bard and Vodun is all I need in terms of triggers and to finish the defstrip coding is my last thing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.