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

Quick Coding Questions

1101113151618

Comments

  • ExelethrilExelethril PhD EbonicsPosts: 3,123Member @@ - Legendary Achaean
    Does anyone happen to know what the monk stance defense "keepup" variable is for svof? I can't seem to find it. For example, svof's parry variable is "svo.sp_config.parry_shouldbe" 

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • RyzethRyzeth Posts: 1,105Member ✭✭✭✭✭ - Grand Achaean
    Does anyone happen to know what the monk stance defense "keepup" variable is for svof? I can't seem to find it. For example, svof's parry variable is "svo.sp_config.parry_shouldbe" 
    You can get it from gmcp.Char.Vitals.charstats, iirc.
    string.match(gmcp.Char.Vitals.charstats[3], "Stance: (%w+)")

    Something to that effect, you'll have to change [3] to the right number. No idea about SVO, but that's how you can get what stance you're currently in; can use it to compare to what stance you WANT to be in.

    Exelethril
  • KoganKogan Posts: 355Member ✭✭✭✭ - Eminent
    Does anyone happen to know what the monk stance defense "keepup" variable is for svof? I can't seem to find it. For example, svof's parry variable is "svo.sp_config.parry_shouldbe" 
    Run -- lua svo.defc -- in command line and see if it returns stances as well? If so you can do if not svo.defc.stancename then do stuff.
  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    Stances (and forms) should be normal defenses, that are simply made exclusive to each other. That means they are "svo.defkeepup[svo.defs.mode].<def>", like "svo.defkeepup[svo.defs.mode].eagle".

    Your current stance should be in "svo.me.stance" and "svo.me.form" for tekura and shikudo respectively.
    Kogan
  • ExelethrilExelethril PhD EbonicsPosts: 3,123Member @@ - Legendary Achaean
    Does anyone happen to know how I can get this to fire only when I have dragoncurse/limb/eq balance?

    send("queue addclear eqbal stand~dragoncurse "..target.." paralysis 1~rend " ..target.. " left leg slike~breathgust " ..target)

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • CooperCooper IowaPosts: 4,179Member @@ - Legendary Achaean
    Queue addclear eqbal queue add class the rest of it

    Exelethril
  • ExelethrilExelethril PhD EbonicsPosts: 3,123Member @@ - Legendary Achaean
    edited August 13
    Is there a way to make information stored in a variable fade after x seconds, so it'll be technically empty? For example, direction == matches[2]

    [ SnB PvP Guide | Link ]

    [ Runewarden Sparring Videos | Link ]
  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    If you use a timer, you can set it to "nil". Just make sure you kill the timer before you re-set the value.
    Exelethril
  • SayennaSayenna Posts: 188Member ✭✭✭✭ - Eminent
    Is there a way to make information stored in a variable fade after x seconds, so it'll be technically empty? For example, direction == matches[2]
    direction = matches[2]
    if dirTimer then
    killTimer(tostring(dirTimer))
    end
    dirTimer = tempTimer(3, [[direction = nil]])

    change the '3' to whatever number you wanna use.



    Exelethril
  • CaelanCaelan Posts: 804Member ✭✭✭✭✭ - Grand Achaean
    edited August 15
    How do I get this:

    _G['eat_'..cure]()

    to do this (where x.y. is a namespace and subname - the "cure" part works fine, but not the namespace in the beginning)

    _G['x.y.eat_'..x.y.cure]()


    I've tried it all kinds of ways like
     _G[x.y.]['eat_'..x.y.cure]()   
    _G[x.y]['.eat_'..x.y.cure]()

    Basically I have all my "eat_<herbname>" functions and the way I have it now, it works fine..  but I'm trying to play around with the namespace stuff and it doesn't quite work.  It keeps saying something like "field is ?"  or "concatenating x.y."

  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    Are x and y actual namespaces or variable that contain namespace names? If the former, x.y["eat_"..x.y.cure] if the latter it's _G[x][y]["eat_".._G[x][y].cure].
  • CaelanCaelan Posts: 804Member ✭✭✭✭✭ - Grand Achaean
    edited August 15
    Keneanung said:
    Are x and y actual namespaces or variable that contain namespace names? If the former, x.y["eat_"..x.y.cure] if the latter it's _G[x][y]["eat_".._G[x][y].cure].
    The actual names.  Figured they weren't important so threw in some placeholders.

    Still doesn't like it.  would it be _G[x.y[".eat cure"..x.y.cure]] ?

    Switched it to x.y._G["eat_"..x.y.cure]  and it's saying I need an "="?

  • KlendathuKlendathu Eye of the StormPosts: 2,633Member @@ - Legendary Achaean
    Is _G a function to which you're trying to pass a variable?
    _G(x.y["eat_"..cure])
    Without knowing what _G and x.y.eat_cure actually are, it's pretty hard to resolve :)

    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."
  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    Maybe it would be easier if you gave your real table names and how they are structured. Then we don't need to guess around.

    _G is the global table, the one every variable and function lands in if you normally don't need to prefix it with anything. So _G.echo("something") is the same as echo("something"). You normally only need to access it if you dynamically piece something global together like in your old code.
  • AntoniusAntonius Posts: 4,244Member @@ - Legendary Achaean
    _G is the reference for Lua's global scope. There is generally no need to explicitly reference it, though.
  • AntoniusAntonius Posts: 4,244Member @@ - Legendary Achaean

    Assuming (based on your comments) that x is the name of a namespace (within the global scope), y is a namespace within the x namespace (a sub-namespace), and cure is the name of a variable within the scope of your code (that contains a string), then it should probably just be:

    x.y["eat_" .. cure]()

    As a more general point, the fact that you appear to have a function per herb suggests that the design of your code is... not good. You're going to end up duplicating code and making maintaining the entire thing more difficult than it needs to be.

  • CaelanCaelan Posts: 804Member ✭✭✭✭✭ - Grand Achaean
    Antonius said:

    Assuming (based on your comments) that x is the name of a namespace (within the global scope), y is a namespace within the x namespace (a sub-namespace), and cure is the name of a variable within the scope of your code (that contains a string), then it should probably just be:

    x.y["eat_" .. cure]()

    As a more general point, the fact that you appear to have a function per herb suggests that the design of your code is... not good. You're going to end up duplicating code and making maintaining the entire thing more difficult than it needs to be.

    Meh.. That worked. I had already tried it.  But I had the x.y.[  the stupid dot was messing it up.  I knew it was something dumb.

    Anyway, I am in the process of speeding up and making efficiencies which is why I was doing this.  Get it working the way I had in my other script first, then fix so I have a "safe state" saved.  As it turns out, I didn't need this chunk of code, but was just curious how to get it working. Though in this instance, it also didn't make it more difficult to maintain - but it did duplicate some code.  I was able to remove about 500 lines of code  in 10 or 12 functions and condense it down to 2 functions and under 50 lines of code (with one of those functions being sileris so I will modify it shortly, just wasn't top of my list right now)

    Thanks.

  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    https://ada-young.appspot.com/pastebin/NV2WTeIg

    How do I capture:
    1. That there are Icewalls
    2. The directions that the icewalls are at.

    I don't know how to write the regex for it.
  • TysandrTysandr Posts: 208Member ✭✭✭ - Distinguished
    edited August 16
    try

    An icewall is here, blocking passage to the (.+?)\.

    hmm, didn't really work, might have to pipe some triggers. I'll let other people chime in.
    Proof of Concepts: Sailing Map, Trading
    bounty
    "It's not rocket surgery."

  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    heh that's what I had. only matches on the first one
  • TysandrTysandr Posts: 208Member ✭✭✭ - Distinguished
    edited August 16
    Messy;

    ^.*An icewall is here, .*$

    local t = matches[1]:split("An icewall")

    asdasdAn icewall is here, blocking passage to the down. An icewall is here, blocking passage to the 
    south.

    {
      "asdasd",
      " is here, blocking passage to the down. ",
      " is here, blocking passage to the south."
    }

    >> could then parse the split

    caveat: I hate dependent triggers
    Proof of Concepts: Sailing Map, Trading
    bounty
    "It's not rocket surgery."

  • ArmaliArmali Posts: 898Member, Secret Squirrel ✭✭✭✭ - Eminent
  • CaelanCaelan Posts: 804Member ✭✭✭✭✭ - Grand Achaean
    edited August 29
    If I make a table, and later want to change a value in it, is there a way to maintain permanence or would it need to be done on login each time?

    I guess a good example would be how SVO lets you do the defense upkeep with an alias. (I don't use SVO so not sure if it has to be continuously done on login)

    Or does SVO write it out to a file and import it each time?

  • AntoniusAntonius Posts: 4,244Member @@ - Legendary Achaean
    @Caelan You probably want table.save and table.load. Though I think newer versions of Mudlet make it a lot easier to persist variables without having to write code to do it.
  • CaelanCaelan Posts: 804Member ✭✭✭✭✭ - Grand Achaean
    Antonius said:
    @Caelan You probably want table.save and table.load. Though I think newer versions of Mudlet make it a lot easier to persist variables without having to write code to do it.
    Well, that's a duh.  Forgot Mudlet used that.

  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    Can you do http requests (post/get) from mudlet?
  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    Get requests work by using downloadFile(). Post not out of the box, but can be done after installing luasocket (see http://w3.impa.br/~diego/software/luasocket/ for instructioms)
    Nylian
  • NylianNylian Posts: 113Member ✭✭✭ - Distinguished
    Thank you @Keneanung,

    I'm famliar with lua socket, do I need to do anything in mudlet to load the library?
  • KeneanungKeneanung Posts: 554Member ✭✭✭✭ - Eminent
    The usual require should work, if it's installed somewhere lua can find it.
    Nylian
  • VolphrinVolphrin Posts: 19Member ✭✭ - Stalwart
    Trying to find an easy way to use my Magi abilities without a hundred different aliases. 

    I've like to set a variable for the attack type (Earth, Air, etc) and be able to cycle through those when hitting an F key. 

    That way I could have:

    function Smashrl()
           
           send("setalias sse stand/staffstrike " ..target.. " with " ..elementaltype.. " right leg/golem smash " ..target.." arms")
           send("clearqueue eqbal")
           send("queue add eqbal sse")
    end


    and then when I want to change to use, say Water instead of Earth, I can hit F10 and it cycles through the options (Clearly echoing to screen) and fills the variable. 

    Any idea where to start with that, and is that even an efficient way or doing things?

Sign In to Comment.