Quick Coding Questions

1111214161724

Comments

  • KlendathuKlendathu Eye of the Storm
    edited September 2017
    @Volphrin

    <div>magi = magi or {}
    
    local t_element = {
    	[1] = "earth",
    	[2] = "air",
    	[3] = "fire",
    	[4] = "water",</div><div>}
    
    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
    <span>
    
    function Smashrl()
    </span>
    	magi.staffStrike("right leg","arms")
    <span style="background-color: transparent; color: inherit; font-size: inherit;">
    <font face="lucida grande, Lucida Sans Unicode, tahoma, sans-serif">end</font></span></div>

    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."
  • Klendathu said:
    @Volphrin

    <div>lots of code</div>


    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.

  • That's awesome, @Klendathu thanks!
  • JonathinJonathin Retired in a hole.
    edited September 2017
    @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.
    I am retired and log into the forums maybe once every 2 months. It was a good 20 years, live your best lives, friends.
  • 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.

  • 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.




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • 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.
  • 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. :(




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • 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.
  • 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.
  • 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.
  • 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.

  • edited October 2017
    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)?
  • 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





    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • 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.
  • Yeah there’s more than just those, but that’s the gist.




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • edited October 2017
    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?
  • Retardation doesn’t, no




    Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • I know SVO picks it up though (svo.affl.retardation iirc)
  • Nylian said:
    I know SVO picks it up though (svo.affl.retardation iirc)
    Easier to check svo.inslowcuringmode() which looks for ret and aeon. 
  • 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 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




  • Penwize has cowardly forfeited the challenge to mortal combat issued by Atalkez.
  • You just made my day, thank you!
  • 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 Storm
    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."



  • So many things I could be doing differently.
  • 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.
  • 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?
  • Do you use expandAlias() a lot? I've heard it can cause problems, don't remember teh details specifically.
    spread positivity
Sign In or Register to comment.