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

Quick Coding Questions

11718192022

Comments

  • CooperCooper Member Posts: 5,431 @@ - Legendary Achaean
    Pyori said:
    (\w+) covers for the eventuality of Achaea following Imperian/Starmourn with gender-neutral terms (Their/They etc).

    Performance is all well and good, but Achaea/Mudlet in general is not going to get to the point of it being noticeable unless you're running on it on a literal toaster.
    They have said many times this will never ever happen in Achaea. Male/female he/she only. 

  • PyoriPyori Member Posts: 2,124 @@ - Legendary Achaean
    edited September 2019
    Cooper said:
    They have said many times this will never ever happen in Achaea. Male/female he/she only. 
    Because they have never gone back on their word before. No sir.

    Regarding this particular thing, they said they wouldn't do it Imperian as well and here we are.

  • SophiSophi Rally PointMember Posts: 118 ✭✭✭ - Distinguished
    Attack helicopter has 10 leg fractures. 
  • ArchaeonArchaeon Ur mums house lolMember Posts: 658 ✭✭✭✭ - Eminent
    Sophi said:
    Attack helicopter has 10 leg fractures. 
    Sexist racist zenophobic 
  • TahquilTahquil Member Posts: 4,440 @@ - Legendary Achaean
    Did you mean xenophobic?
    Numira
  • CaelanCaelan Member Posts: 2,171 @ - Epic Achaean
    Why is it always the Aussies and Brits that come to our forums and alllll of a sudden they know our language better than us, huh? ;-)

  • PyoriPyori Member Posts: 2,124 @@ - Legendary Achaean
    Tahquil said:
    Did you mean xenophobic?
    No zenophobic. Means he greatly dislikes zen.

    Caelan
  • ArchaeonArchaeon Ur mums house lolMember Posts: 658 ✭✭✭✭ - Eminent
    no i really just hate zylophones 
    Caelan
  • CaelanCaelan Member Posts: 2,171 @ - Epic Achaean
    Archaeon said:
    no i really just hate zylophones 
    Those things are the worst.

  • ReysonReyson Member Posts: 631 ✭✭✭✭✭ - Grand Achaean
    Eurgh, this is an old thread to necro, but I don't want to make a new one, and it's a pretty quick question, so, sorry! 

    Anyone know if the simplified 'if' script for Nexus can grab GMCP info? Is it a 'value,' if so? 
  • AtalkezAtalkez Member, Secret Squirrel Posts: 5,187 @@ - Legendary Achaean
    edited March 4
    Generally a string or a number, and yes.

    if gmcp.Char.Status.class == “Depthswalker” then
        Send(“stuff”)
    end

    etc

    I would have to look at my Nexus stuff to convert for syntax differences.


    You hug Aurora compassionately.
    Reyson
  • ReysonReyson Member Posts: 631 ✭✭✭✭✭ - Grand Achaean
    If you could do that, you'd be my hero forever. 

    I'm sure I'm missing something dumb, but it's really annoying. 
  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    edited March 4
    I don't think Nexus' simplified scripting can straight up access the GMCP object. It feels like you have to set simplified scripting variables to whatever values specific parts of the GMCP object hold.

    I hopped on and made the block in the picture below with simplified scripting. In Nexus, your class is held inside the javascript GMCP.Status.class variable. The simplified scripting segment below compares the strings "GMCP.Status.class" and "Runewarden". It doesn't grab the actual GMCP data for comparison to "Runewarden", it just straight up compares the string "GMCP.Status.class" to "Runewarden". So this block will always "otherwise jump to label 'Else'" since "GMCP.Status.class" and "Runewarden" are not the same strings.


    The other two options aside from Value are Variable and Current Target. Using Variable might work to use the GMCP data, but would require you to first set a simplified scripting variable to your desired GMCP contents using the set_variable() function in an Execute Script block or the onGMCP Nexus function.

    I'm not real great at using simplified scripting so here's a snippet of what accessing GMCP data looks like using the Execute Script block.


    If you want to, for example, set your maxhp from the GMCP.gauge_data object to a Nexus variable, you just have to do the following in an Execute Script block.

    set_variable("variable_name", GMCP.gauge_data.maxhp);
    If you wanted to set that variable to your current class instead of your maxhp, it'd be as follows.

    set_variable("variable_name", GMCP.Status.class);
    After doing that, you could go ahead and try the Variable variation of the simplified Scripting as follows.


    There are probably other better ways to around it, but I'm either missing something or couldn't think 'em up while locked in a cubicle.

    RackhamReyson
  • ReysonReyson Member Posts: 631 ✭✭✭✭✭ - Grand Achaean
    I'm not going to lie. I'd really, really hoped it wouldn't be some solution like that. 

    That answer makes me want to cry, even if you're my hero for sitting through it. 
  • RackhamRackham Member Posts: 140 ✭✭✭ - Distinguished
    This is huge for me though and I wish I could bookmark just that response in this thread. Gunna use that a lot
  • AtalkezAtalkez Member, Secret Squirrel Posts: 5,187 @@ - Legendary Achaean
    Okay, so I never used simplified scripting. I always used Advanced and coded my own things.

    So, something like this for Serpent:

    ^d(\w+)(\w+)$ -- Regular Expression

    Set to: Execute a script

    if (GMCP.Char.Status.class == "Serpent")
    {
      var venoms = {}
      venoms["c"] = "curare";
      venoms["k"] = "kalmia";
      venoms["v"] = "vernalius";
      venoms["x"] = "xentio";
      venoms["g"] = "gecko";
      venoms["s"] = "slike";
      venoms["e"] = "eurypteria";
      venoms["l"] = "larkspur";
      venoms["a"] = "aconite";
      venoms["z"] = "vardrax"
        
      send_command('cq all;clearalias x1;setalias x1 stand/wield shield dirk/dstab &tar " +venoms[args[1]]+ " " +venoms[args[2]]+ ";queue add eqbal x1')

    }


    Then for Paladin I did something similar while checking for rebounding:

    ^d(.+)$ -- Regular Expression

    Set  to: Execute a script

    if (GMCP.Char.Status.class == "Paladin")
    {
    var venoms = {}
      venoms["c"] = "curare";
      venoms["k"] = "kalmia";
      venoms["v"] = "vernalius";
      venoms["x"] = "xentio";
      venoms["g"] = "gecko";
      venoms["s"] = "slike";
      venoms["e"] = "eurypteria";
      venoms["l"] = "larkspur";
      venoms["a"] = "aconite";
     
    if (!tarReb)
    {    
      if (venoms[args[1]] == "slike")
    {
    send_command("cq all;clearalias x1;setalias x1 stand/wield shield sword/combination &tar slice " +venoms[args[1]]+ " smash high;queue add eqbal x1")
        }
      else if (venoms[args[1]] == "curare")
      {
            send_command("cq all;clearalias x1;setalias x1 stand/wield shield sword/combination &tar slice " +venoms[args[1]]+ " drive;queue add eqbal x1")
        }
      else    
      {
      send_command("cq all;clearalias x1;setalias x1 stand/wield shield sword/combination &tar slice " +venoms[args[1]]+ " smash mid;queue add eqbal x1")
        }
    }
    else
    {
        send_command("cq all;clearalias x1;setalias x1 stand/wield shield sword/combination &tar raze smash mid;queue add eqbal x1")
    }
    }

    As far as I'm aware, that should work regardless of any settings you have.


    You hug Aurora compassionately.
  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    Is there any GMCP data in particular that you'd like to access, @Reyson, conveniently or repeatedly?
  • ReysonReyson Member Posts: 631 ✭✭✭✭✭ - Grand Achaean
    edited March 5
    Oh, @Chubbs, I'm thinking of making a system for myself, mostly for noise management and class-specific prio swaps (and things like defences modes, streamlining offence, that kind of thing), so mostly affs, class, race, the stuff in vitals, and maybe a few other miscellaneous things! 
  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    edited March 6
    So like... I made a thing, @Reyson . It'll probably still make you cry, but uhhh, now you can directly access some of the GMCP object in simplified scripting. (Also may have issues)

    The package doesn't work automatically on import because its activation is tied to the onLoad function. Right after importing it, you'll want to use the "load sgmcp" alias to activate the package. In the future, it'll automatically activate itself when you log in.

    If you ever want to try modifying my modification and something goes wrong, or my modification itself goes wrong, use the "reset sgmcp" alias to restore the original simplified scripting functionality without modifications. Then you probably want to comment out the one run_function() call in the onLoad function.


    Here's what the package's included 'test that this is working' alias looks like. It also serves as the usage example.


    The package lets you access data in the GMCP object through the following format so long as the type is 'Value':
       - GMCP.key.key or GMCP.key
    I.e. GMCP.Status.class, GMCP.Status.race, GMCP.TargetIsPlayer, GMCP.gauge_data.hp

    You can also only access the final string/integer/boolean stored values. Won't work if you try to access an entire object. Well, okay, it will, but then you just set a Nexus variable to an entire object or tried to compare a string to an object. Dunno why you might want to at the moment, but it'll do that.

    So this will let you immediately access class, race, some vitals stuff (which is kept in GMCP.gague_data btw) without having to do set_variables() in the onGMCP Nexus function or an execute script block.

    GMCP.Afflictions and GMCP.Defences are objects where the aff names are the keys though so accessing them will be difficult and this probably doesn't support that.

    Hit me up if you have issues or something or wanna nerd out over this. Love doing it when I can. Let's make weird janky almost working things together!

    Reyson
  • ReysonReyson Member Posts: 631 ✭✭✭✭✭ - Grand Achaean
    Hardcore! 

    To quote nostalgia incarnate, you're a good man, Charlie Brown.

    I'll mess around with it soon, and I'll see how it works out! Let's figure out some good, simple scripts that might make life easier for people. I'm excited! 

    We got this.
  • KaiosKaios Member Posts: 3
    Hi guys.

    I'm having some difficulty with scripting in Nexus and I was hoping that someone might be able to help.

    I found Keorin's limb tracker on the forum and it is not exactly useful in terms of... well, any actual tracking at all. But it's an excellent base point to start with.

    I'd like to modify the damage values for some of the variables and I was getting some help doing this, but unfortunately most people I've spoken to about these matters don't use Nexus themselves and can offer me little assistance.


    I believe these are the variables I need to modify first:

    client.limbcount.damageTable = {
        /*monk*/
        "tekuraPunch":1,
        "tekuraKick":2,
        "tekuraUppercut":1,
        "tekuraSidekick":2,
     
    else if (lcClass == "monk"){
        reflex_enable(reflex_find_by_name("group", "monk group", false, false, "knlc"))
        set_variable("lcLightAttack", "lcPunch")
        set_variable("lcHeavyAttack", "lcKick")
        if ((get_variable("lcPunch") == undefined) || (get_variable("lcKick") == undefined) || (get_variable("lcUppercut") == undefined) || (get_variable("lcSidekick") == undefined) || (client.limbcount.isInstalling == true)){
            set_variable("lcPunch", client.limbcount.damageTable["tekuraPunch"])
            set_variable("lcKick", client.limbcount.damageTable["tekuraKick"])
            set_variable("lcUppercut", client.limbcount.damageTable["tekuraUppercut"])
            set_variable("lcSidekick", client.limbcount.damageTable["tekuraSidekick"])

    So the formula I was recommended to use instead would be something like this for a hammerfist attack: (.082 * opp_hp + 250) / opp_hp) * 100). Opp_hp being the variable that stores my opponent's max HP on assess. One issue is I don't know how to enter this formula in to Nexus in a way that it will round the outcome to only two decimal places.

    If I were to modify the above in this manner, would it be correct?

    client.limbcount.damageTable = {
        /*monk*/
        "tekuraPunch":(.082 * opp_hp + 250) / opp_hp) * 100),
        "tekuraKick":2,
        "tekuraUppercut":1,
        "tekuraSidekick":2,

    Like that for instance? Of course the rounding would still have to occur somewhere, at some point.

    I am really bad at this stuff and have little aptitude for coding, I'd appreciate any assistance that might be offered. Except for telling me to switch from Nexus, please don't tell me that.
  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    Dude, you're going to make me download this limb counter to screw around with it, lol.

    You can truncate to x decimals in javascript with the .toFixed(x) function.
    I.e. If you have a numerical variable testVar = 14/16 (which is equal to 0.9375), you can do testVar.toFixed(2); to truncate it to 2 decimal places, setting testVar to "0.94".

    As for the modifying the counting formula, I need to take a look at the guts of the limb counter before saying anything concrete.
  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    So, I took a quick look through Keorin's limb counter. It seemed pretty solid. You would -NOT- want to make that modification to the tekuraPunch variable to achieve your desired effect.

    It looks like Keorin's limb counter works by setting a 'breakpoint', which is the number of hits it takes to break a limb, for a person. The tekuraPunch/Kick/Uppercut/Sidekick values are indicators of how many hits it takes to break that limb.

    I.e. Let's say the default breakpoint value for the monk class in knlc is 8. If you throw out 2 punches and a kick at someone's left leg, knlc adds the punch/kick values to the left leg's hit counter. So the limb would start out at 0 hits, then the both punches would increase the limb damage to 2 hits and the kick would push the limb up to 4 hits. When the number of hits of limb damage exceeds the breakpoint value (8), the limb breaks.

    From a glance the (.082 * opp_hp + 250) / opp_hp) * 100) formula thing you're attempting to do seems completely different from how knlc works. That's an entire damage formula rather than just a hit modifier. The tekuraPunch/Kick/Uppercut/Sidekick variables absolutely look like they're just hit modifiers.

    I think you'd have to rip apart the way Keorin's counter works to implement that formula.

    As a side note, I hear a lot of good things about Keorin's counter. I wonder why it's not working for you. Are you grabbing breakpoints on your own and setting them per person with the "shn (person) #" alias? It looks like knlc does the math and keeps track of how many hits 'til break for you, but you still have to figure out what the breakpoint is for each health threshold yourself.


  • RackhamRackham Member Posts: 140 ✭✭✭ - Distinguished
    I 'fixed' it.
    Nobody ask me how. Nobody look at the monstrosity I just birthed.
    But the deed is done.
    Nhakra
  • KaiosKaios Member Posts: 3
    Chubbs said:

    As a side note, I hear a lot of good things about Keorin's counter. I wonder why it's not working for you. Are you grabbing breakpoints on your own and setting them per person with the "shn (person) #" alias? It looks like knlc does the math and keeps track of how many hits 'til break for you, but you still have to figure out what the breakpoint is for each health threshold yourself.


    I wasn't doing that no, I was only relying on assess to calculate the break count for the opponent. The issue I find with it is that it does not do a very good job of accurately reflecting what my actual damage is at times, and ends up throwing me off more often than it helps. For instance, it might actually be one or two hits off of a break when it indicates to me that I have broken a limb or breaks on the next hit when it should have been in two.

    The reason I want to modify the formula in this way is that I want the break point to be static at 100 (percent) and ascertain how much damage is being dealt to the limb based on the opponent's max health at all times instead. However, the issue that Rackham helped me to resolve was why the formula was not outputting anything correctly and instead was running in to an error whenever the break point was modified to 100.

    It works the way I wanted it to now, for example a hammerfist against an opponent with approx. 4400 health outputs 'left leg is at 13.83/100' but if that is for better or worse, I don't know.

  • ChubbsChubbs Member Posts: 96 ✭✭✭ - Distinguished
    Neato, it's kinda working now! Also, @Rackham, you absolute madman. :tongue: 

    God, I wish I were monk so I could test this out, LOL. If you were using assess to calculate the break count for someone and not letting Keorin's counter know that break count, that might have been what was leading to inaccurate reflections of limb damage!

    If you were letting the counter know though, I have no clue what the issue might have been. Either way, good luck with the new setup and hope it works well for you!
  • AtalkezAtalkez Member, Secret Squirrel Posts: 5,187 @@ - Legendary Achaean
    You’re wanting to go about it the more “accurate” way, but it’s much more difficult to nail down.

    The problem with formula, is there are literally thousands of data points around health that you have to account for, and the formula has to be accurate across all of them. Reverse engineering the game formula is not easy.

    Comparatively, understanding what the class does and recognizing a pattern is much easier. Tekura without knuckles, you’re going to break at 7/8/9 across 99% of health values you’re going to come across. Kicks are roughly 2, punches roughly 1, with sidekick and moon kick being roughly 2.5. I found it much easier to count this way (and I count on my head for Tekura vs holding a limb counter) because the flow works well. You’re either breaking on a second full combo, of you need one more hit after the second combo.


    You hug Aurora compassionately.
    Chubbs
  • JakiroJakiro Member Posts: 133 ✭✭✭ - Distinguished
    Recently got an insignia and I was wondering how I would be able to tell my scripts which weaponmastery spec I'm in? Is there a gmcp variable for this? or something I can use to differentiate from the specs? Thanks in advance!
    image
  • YtaruYtaru Member Posts: 8
    @Jakiro one of the gmcp.Char.Vitals.charstats, I think

    IocunJakiro
  • IocunIocun Member Posts: 3,547 @@ - Legendary Achaean
Sign In to Comment.