Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Quick Coding Questions

11214161718

Comments

  • KlendathuKlendathu Eye of the StormPosts: 2,634Member @@ - Legendary Achaean
    edited September 5
    @Volphrin

    magi = magi or {}
    
    local t_element = {
    	[1] = "earth",
    	[2] = "air",
    	[3] = "fire",
    	[4] = "water",}
    
    local element = element or 1 --default value if it does not exist
    
    magi.cycleElement = function()
    
    	element = element + 1
    	if element > 4 then element = 1 end
    	cecho("\n<pink>Element selected: <white>"..t_element[element].."<reset>\n")
    
    end
    
    
    magi.staffStrike = function(bPart1, bPart2, elmt)
    
    	if (bPart1 or ""):len() == 0 then bPart1 = "head" end
    	if (bPart2 or ""):len() == 0 then bPart2 = "arms" end
    	if not elmt then elmt = element end
    
    	send("setalias sse stand/staffstrike "..target.." with "..t_element[elmt].. " " ..bPart1.."/golem smash "..target.." "..bPart2)
    	send("clearqueue eqbal")
    	send("queue add eqbal sse")
    end
    
    
    function Smashrl()
    
    	magi.staffStrike("right leg","arms")
    
    end

    You then need to set up a hotkey to run magi.cycleElement().

    I also took the liberty of changing how your Smashrl() function worked, you could either set up a series of functions in the same format, or just add the code within to your hotkeys, changing the variables as necessary.


    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
    Volphrin
  • VerinVerin Posts: 18Member ✭✭✭ - Distinguished
    Klendathu said:
    @Volphrin

    lots of code


    This code shouldn't compile, there's a "<pink>" in there somewhere. Please replace with other colour (e.g., <green>, <red>, <gold>) and paste code in your Mudlet script. Should work like a charm then.

  • VolphrinVolphrin Posts: 19Member ✭✭ - Stalwart
    That's awesome, @Klendathu thanks!
    Klendathu
  • JonathinJonathin Grand Rapids, MIPosts: 3,220Member @@ - Legendary Achaean
    edited September 15
    @Klendathu. I can't even believe that I never noticed that I could just add 1 to a variable and call the array that way. I always used table.insert and table.remove together to cycle a table. I am derp.

    (Mudlet Clan): Nylian says, "Mosr's on the case. Fix incoming."

    Tutorials and scripts  The Repository

    KlendathuCaelan
  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    Couple of questions;

    I see in a lot of logs people creating a serverside alias and then sending only that alias on every attack.
    • What's the reason behind doing that instead of something like -- send("stuff/stuff/stuff/stuff") -- ?

    My method of sending commands to the mud is super spammy. I spam clearing queue and updating queue based on what I want to do next in order to chase balance and fight through para spam.
    • Is there a "best" way to do this? I feel like just spamming every X milliseconds is sub-optimal.

  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean
    I make an alias like that so I can queue everything. As far as I’m aware, doing the stacked send like that, every command is subject to latency. Not so with a server alias.

    I delete all the lines that spam me out, and I just hold down enter to spam through paralysis. I did add a paralysis/prone check to reduce that slamming though.


    You hug Aurora compassionately.
  • AlyxeriAlyxeri Posts: 353Member ✭✭✭✭ - Eminent
    I have my serverside separator set to ::

    So I pretty much just do stuff like
    queue addclear eqbal stand::assess atalkez::enrage butterfly atalkez::doublestrike atalkez curare::summon butterfly
    addclear is a lovely function everybody should use, rather than using clearqueue/queue add to queue things. The above is the exact same as setting an alias, then sending said alias, with 1 less command needing to be sent.
    Aldwic
  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean
    I would use that, but it was introduced after I overhauled my aliases, and I’m entirely too lazy to fix something that isn’t broken. :(


    You hug Aurora compassionately.
    Aldwic
  • KoganKogan Posts: 355Member ✭✭✭✭ - Eminent
    I may be mistaken, but I do believe QUEUE only allows for so many commands? Where Ive yet to hit a cap on setalias commands and then queuing the alias. Thats why I use a serverside alias for things like handing artifacts over.
    AtalkezAldwicVender
  • AlyxeriAlyxeri Posts: 353Member ✭✭✭✭ - Eminent
    Queue is 10 commands per 'queue add' - I have yet to run into a situation where I've needed to do more than that, personally. And I've played some pretty spam-heavy classes.
  • KoganKogan Posts: 355Member ✭✭✭✭ - Eminent
    Well the situation I just listed does it for me. I do remove individually though because I'm an asshole who doesn't do remove artifacts. However some I do keep/keep on if they have other things I need attached. Like my gauntlets having gloves of harvesting. Either way I have.... 10 artifacts to remove/give and generosity/selfishness worked in on the backend as well. There are a few uses for it, but rarely in combat I suppose.
    Aldwic
  • AntoniusAntonius Posts: 4,246Member @@ - Legendary Achaean

    There are two main reasons I use in-game aliases:

    It gets around the 10 command limit that you have with the command separator. This isn't normally an issue, but there are certain situations where I'll have a lot of conditional requirements on attacks; wielding, getting vials/pipes from pack, etc. It's easier to not have to worry about whether or not I'd hit that limit.

    It means I don't have to requeue to change the commands to run as part of my attack, which in turn means I don't have to remove other things I may have queued (movement, blocking, picking up gold or corpses, etc.) if I decide I want to use different venoms, switch to targetting a different limb, and so on. I can just queue the alias once, and change what commands are associated with it as many times as necessary before recovering balance.

    NylianShirszae
  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    edited October 17
    Antonius said:

    <cool stuff>

    I didn't consider that implication of queuing them all.  Fantastic.

    How do you handle it when you have paralysis without spamming the queue command, as updating the alias once queued doesn't go through if you have para (but do have eqbal)?
  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean
    I use gmcp afflictions, and I have a dictionary that I use to reference it:

    if not Aff.paralysis and not Aff.prone then
         send("stuff")
    end



    You hug Aurora compassionately.
    Aldwic
  • KoganKogan Posts: 355Member ✭✭✭✭ - Eminent
    Atalkez said:
    I use gmcp afflictions, and I have a dictionary that I use to reference it:

    if not Aff.paralysis and not Aff.prone then
         send("stuff")
    end

    I check for par/prone/webbed/ropped/both arms broken because if I don't have an assess function it will take every bit of 2 seconds for me to hit absolve range/<insert your mana kill here>. Something @Nylian may want to consider if running mind warden or whatever.
  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean
    Yeah there’s more than just those, but that’s the gist.


    You hug Aurora compassionately.
  • KayleKayle Posts: 81Member ✭✭✭ - Distinguished
    edited October 17
    Does ret give a value to affs.aeon? If not does it give a value to anything that I can check through gmcp if it's active?
  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean
    Retardation doesn’t, no


    You hug Aurora compassionately.
  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    I know SVO picks it up though (svo.affl.retardation iirc)
  • KoganKogan Posts: 355Member ✭✭✭✭ - Eminent
    Nylian said:
    I know SVO picks it up though (svo.affl.retardation iirc)
    Easier to check svo.inslowcuringmode() which looks for ret and aeon. 
    Aldwic
  • AlyxeriAlyxeri Posts: 353Member ✭✭✭✭ - Eminent
    Atalkez said:
    I use gmcp afflictions, and I have a dictionary that I use to reference it:

    if not Aff.paralysis and not Aff.prone then
         send("stuff")
    end

    if canAttack() then
       send("stuff")
    end

    ^function checks vs all those affs. Ez.
    Atalkez
  • KayleKayle Posts: 81Member ✭✭✭ - Distinguished
    Atalkez said:
    I use gmcp afflictions, and I have a dictionary that I use to reference it:

    if not Aff.paralysis and not Aff.prone then
         send("stuff")
    end


    can you explain how you changed the listing of gmcp into a database so I can attempt to try something like this
  • AtalkezAtalkez Posts: 4,148Member, Secret Squirrel @@ - Legendary Achaean


    You hug Aurora compassionately.
    KayleAldwic
  • KayleKayle Posts: 81Member ✭✭✭ - Distinguished
    You just made my day, thank you!
  • AnzeAnze Posts: 75Member ✭✭✭ - Distinguished
    Antonius said:

    There are two main reasons I use in-game aliases:

    It gets around the 10 command limit that you have with the command separator. This isn't normally an issue, but there are certain situations where I'll have a lot of conditional requirements on attacks; wielding, getting vials/pipes from pack, etc. It's easier to not have to worry about whether or not I'd hit that limit.

    It means I don't have to requeue to change the commands to run as part of my attack, which in turn means I don't have to remove other things I may have queued (movement, blocking, picking up gold or corpses, etc.) if I decide I want to use different venoms, switch to targetting a different limb, and so on. I can just queue the alias once, and change what commands are associated with it as many times as necessary before recovering balance.

    How do you target a different limb when your alias is already queued?
  • KlendathuKlendathu Eye of the StormPosts: 2,634Member @@ - Legendary Achaean
    Redefining your alias doesn't dequeue it

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
    Aldwic
  • AnzeAnze Posts: 75Member ✭✭✭ - Distinguished



    So many things I could be doing differently.
    Aldwic
  • AntoniusAntonius Posts: 4,246Member @@ - Legendary Achaean
    As Klendathu said, you can update an alias while it's already queued and it won't get removed from the queue. In terms of how I actually have that implemented, here's a quick overview:

    Main attacks go through a function which has two arguments: an optional modifier and whether or not to queue it. This function is responsible for figuring out which specific commands to use based on what class I am, what afflictions are set to be used, and a couple of additional conditions. It then sets my attack alias (atk) to be those commands, and - if the queue parameter's value was true - queues the alias. It also tracks the modifier passed (which may be nil) in a variable so it can be used in other places.

    My alias to attack calls the attack function, passing the optional modifier from the alias (may be nil) and saying to queue it (i.e. passes true as an argument to the queue parameter).

    My alias to update which body part I'm targetting (which is just stored in a variable) calls that same attack function, but passing the last modifier variable and false as arguments. Since it won't queue, all it does is update what my attack alias will do. If the alias is already queued, it will run the new commands when I recover balance. If it's not queued, nothing happens.
    Aldwic
  • CenCen Posts: 39Member ✭✭✭ - Distinguished
    My Mudlet lags a lot during group fights, to the point where typing in commands is slowed down. I have a pretty good computer and Mudlet doesn't seem like a very intensive application, any idea what could be slowing it down? Is it normal?
  • VenderVender Posts: 234Member ✭✭✭ - Distinguished
    Do you use expandAlias() a lot? I've heard it can cause problems, don't remember teh details specifically.
    it's frustration that creates desire
    not the other way around
    unless you let it
    baby, I'll let it
Sign In to Comment.