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

Quick Coding Questions

11819202123

Comments

  • Issam
    Issam Member, Secret Squirrel Posts: 215 ✭✭✭✭ - Eminent
    I use 'if string.match(gmcp.Char.Vitals.charstats[3], "Spec: Dual Cutting")' etc. to check mine. There may be a better way but this has worked fine for me.



    Jakiro
  • Iocun
    Iocun Member Posts: 3,672 @@ - Legendary Achaean
    edited March 2020
    The only downside with that is, that depending on several factors (such as new information IRE might add to the charstats), it won't always bee the third table entry. So I'd rather use something like table.contains(gmcp.Char.Vitals.charstats, "Spec: Dual Cutting")

    (This is assuming the according table entry is precisely "Spec: Dual Cutting". If it can vary a bit, you'd have to do a loop through the whole table and check each entry with string.gmatch)
    Jakiro
  • Jakiro
    Jakiro Member Posts: 147 ✭✭✭ - Distinguished
    Thanks for all the help! You guys are the best :) 
    image
  • Aliandor
    Aliandor Member Posts: 22
    So I made a trigger for Keorin's limb counter on assess for Monk to set the breakpoint.

    For non-artied Monks (assuming my formula is correct) it should be very accurate.

    I'm using math.ceil to round up to the nearest hit.

    Is there a way to change it to round up to the nearest .15/.25/.35 to account for knuckles? 

    I'm still testing to make sure the formula is actually right, but so far it has been!  I'm just trying to account for those edge cases with knuckles now.
  • Syrennia
    Syrennia Member Posts: 83 ✭✭✭ - Distinguished
    edited April 2020
    Iocun said:
    The only downside with that is, that depending on several factors (such as new information IRE might add to the charstats), it won't always bee the third table entry. So I'd rather use something like table.contains(gmcp.Char.Vitals.charstats, "Spec: Dual Cutting")

    (This is assuming the according table entry is precisely "Spec: Dual Cutting". If it can vary a bit, you'd have to do a loop through the whole table and check each entry with string.gmatch)
    Even easier would be just parsing the charstats table whenever your system parses the rest of Char.Vitals, a lot of things get stored in it. Rage, kai, channels, spec, etc.

    Then you can just check against something like sys.info.spec or however you choose to store it.
  • Kaios
    Kaios Member Posts: 64
    edited April 2020
    Aliandor said:
    So I made a trigger for Keorin's limb counter on assess for Monk to set the breakpoint.

    For non-artied Monks (assuming my formula is correct) it should be very accurate.

    I'm using math.ceil to round up to the nearest hit.

    Is there a way to change it to round up to the nearest .15/.25/.35 to account for knuckles? 

    I'm still testing to make sure the formula is actually right, but so far it has been!  I'm just trying to account for those edge cases with knuckles now.
    Even with accurate tracking, the problem I've run in to with Keorin's tracker that I can't discern the reason for is that during prolonged fights it will eventually mess up to a point that the tracking becomes more of a hindrance than a help if you keep trying to follow it. An example of this would be, I break a limb in eight hits, the first break goes well and Keorin's tracker indicates that it has broken upon the 8th hit... But I mess up my kill path so I have to try again. Now, I still break the limb in the same number of hits except Keorin's tracker might tell me that I have hit it only 7 times even though they are applying salve so I know it has broken OR indicates that the limb has broken even though I know it has not. I can't explain why this happens because I don't understand scripting well enough but it really makes that limb tracker extremely difficult to properly utilize and learn with.

    Also I have an unrelated question myself that I'd appreciate any assistance someone might be able to offer. I've been having issues capturing Mind Sapience in Nexus and I'm not sure why I've been unable to.

    Mind Sapience could appear as something like this for a party tell: --> Kaios: pt blah blah

    And I have tried to capture it various ways including like this: ^\-\-\> (\w+)\: pt (.+)$

    ...Unfortunately, I haven't been able to get any of them to capture the variables at all so far.
  • Archaeon
    Archaeon Ur mums house lolMember Posts: 1,294 ✭✭✭✭✭ - Grand Achaean
    Sounds like you're counting hits to a limb during the apply window.
  • Caelan
    Caelan Member Posts: 2,577 @@ - Legendary Achaean
    Using gmcp.Char.Items to track the denizens in the room, but when I kill them, and gold drops, it doesn't update until I do LOOK (or leave and come back). 

    What event do I need to track when gold drops and refresh the mobs in the room, etc?  Or do I just need to trigger the "You have slain" and stuff to run the function again?

  • Antonius
    Antonius Member Posts: 5,040 @@ - Legendary Achaean
    Caelan said:
    Using gmcp.Char.Items to track the denizens in the room, but when I kill them, and gold drops, it doesn't update until I do LOOK (or leave and come back). 

    What event do I need to track when gold drops and refresh the mobs in the room, etc?  Or do I just need to trigger the "You have slain" and stuff to run the function again?

    gmcp.Char.Items.List is the initial state, updated when you first enter the room or L/QL. gmcp.Char.Items.Add and gmcp.Char.Items.Remove are sent when an item is added or removed; they both have a location to tell you where it is (room, inventory, etc.). There's also gmcp.Char.Items.Update for changes to state, but not location (e.g. wield/unwield).
  • Cooper
    Cooper Member Posts: 5,723 @@ - Legendary Achaean
    Is there something similar that updates when an adventurer enters or leaves a room?

  • Saonji
    Saonji Member Posts: 657 ✭✭✭✭ - Eminent
    gmcp.Room.addPlayer
    gmcp.Room.removePlayer

    gmcp.Room.Players is what's updated on entry/ql
  • Kynath
    Kynath Member Posts: 11
    Not sure if this is in the right place. I am looking to clarify something with the serverside queuing. I am looking to adjust a certain defense to cure above certain afflictions in a situation. Do you just move whatever defense it is up above the affliction priority or do you need to use the curing priority defence <x> preempt syntax?
  • Sophi
    Sophi Rally PointMember Posts: 158 ✭✭✭ - Distinguished
    I think curing affliction and curing defence are different sets of priorities? Not sure if they play off each other. Is this for fitness or something?
  • Kynath
    Kynath Member Posts: 11
    @Sophi Had a spar where I had to deal with a lot of transfix. Wanted to move blindess up over something like healthleech when it made sense.
  • Sophi
    Sophi Rally PointMember Posts: 158 ✭✭✭ - Distinguished
    edited September 2020
    @Kynath CURING PRIORITY DEFENCE BLINDNESS 1 PREEMPT works


    Kynath
  • Froggle
    Froggle Member Posts: 8
    Are the `gmcp_args` keys `ohmap` and `num` unique? I have not found any non-unique values for either, but I haven't covered every room in the wilderness.
  • Kynath
    Kynath Member Posts: 11
    So I have been making some changes to an old version of wundersys I was able to find. Coming along pretty good so far. Randomly though the wsys.prompt function throws an error that I think is related to this function but I'm not sure what the issue is.

    function wsys.doqueues()
     if next(wsys.queuestable) then
    for k,v in ipairs(wsys.queuestable) do
    _G ["wsys"][v .. "queue"]()
    end -- for
    wsys.queuestable = {}
    end -- if
    end -- func
    Was thinking maybe it was a formatting problem but searching around in the internals hasn't gotten me any results. 

    The error is attempt to call field '?' a nil value.

    Anyone have any experience with this?
  • Utianima
    Utianima Norway and AustriaMember Posts: 318 ✭✭✭✭ - Eminent
    Kynath said:
    So I have been making some changes to an old version of wundersys I was able to find. Coming along pretty good so far. Randomly though the wsys.prompt function throws an error that I think is related to this function but I'm not sure what the issue is.

    function wsys.doqueues()
     if next(wsys.queuestable) then
    for k,v in ipairs(wsys.queuestable) do
    _G ["wsys"][v .. "queue"]()
    end -- for
    wsys.queuestable = {}
    end -- if
    end -- func
    Was thinking maybe it was a formatting problem but searching around in the internals hasn't gotten me any results. 

    The error is attempt to call field '?' a nil value.

    Anyone have any experience with this?
    Pretty sure your problem is in this line:

    _G ["wsys"][v .. "queue"]()

    Does your error not also show a line number, so you can pinpoint it?

    Not sure what you're trying to do, but the part where you concatenate "v" with "queue" seems strange. I would expect it to be something like this instead:

    _G wsys.queuetable[k]()

    You have a table of key value pairs where the value is a function, right? And what is _G referring to?

  • Kynath
    Kynath Member Posts: 11
    @Utianima Thanks for taking a look at it. I figured that was the problem as well but wasn't sure how to fix it. The function was something that came with Wundersys so not sure on the _G part. I tried deleting it but that caused a different error.

    Line 61 is where the error is from which is what you pointed out. Since you mentioned it I swapped the 'v' with queue out for a k and will see if that fixes the issue. Fingers crossed!
    Utianima
  • Sophi
    Sophi Rally PointMember Posts: 158 ✭✭✭ - Distinguished
    _G refers to the global environment, i.e. where Lua stores everything. You can manipulate it like any other table.
    KynathUtianima
  • Utianima
    Utianima Norway and AustriaMember Posts: 318 ✭✭✭✭ - Eminent
    Sophi said:
    _G refers to the global environment, i.e. where Lua stores everything. You can manipulate it like any other table.
    Ok, thanks. Is there any performance benefit of specifying it though, as it's anyways lexically scoped and would try local first, then global, anyways?

  • Vinzent
    Vinzent Member Posts: 339 ✭✭✭ - Distinguished
    Probably, but I've never noticed. I don't use it for manipulation but instead to use variables to call a function on occasion. _G is the only possible way of performing that in Lua.
    Utianima
  • Sophi
    Sophi Rally PointMember Posts: 158 ✭✭✭ - Distinguished
    Never had to use it for anything, really. It looks like that wsys function might be trying to call another function, so maybe that's the reason it is using the _G? Not sure what is going on there
    Utianima
  • Caelan
    Caelan Member Posts: 2,577 @@ - Legendary Achaean
    I'm sure this has been asked but the SEARCH kind of sucks. I'm re-writing some curing stuff, and was wondering why you would use raiseEvent() rather than just a function call?

    Or maybe I'm not trying to implement it as intended.  Right now just messing with eating herbs and raising the event to run the function to see if I can (I was just playing with it at this point).   I have no idea why in the numerous previous re-writes over the years, I never used events.  Been looking at the Mudlet Events Engine page but still not sure why I wouldn't just call the function.

  • Amranu
    Amranu Member Posts: 782 ✭✭✭✭ - Eminent
    Events are useful if you have some script and want to be able to hook other scripts into it without modifying the script raising the event.
  • Aerek
    Aerek East Tennessee, USAMember Posts: 1,836 @@ - Legendary Achaean
    ^You rub some curare on .+.$
    ^You rub some (\w+) on .+.$
    
    Trying to capture venom applications, specifically the second venom, however even with the AND/MULTI box checked and set to 2 lines, multimatches[2][2] returns "curare", since the first line technically matches both patterns.

    How do I tell Mudlet to look only for two consecutive lines that match this pattern, instead of accepting one line that matches both patterns? Ideally, I'd like to capture both venoms in multimatches[1][2] and [2][2].
    -- Grounded in but one perspective, what we perceive is an exaggeration of the truth.
  • Amranu
    Amranu Member Posts: 782 ✭✭✭✭ - Eminent
    use a line spacer, it's a type of pattern (where you set it to use regulat expressions for a trigger).
    Aerek
  • Aerek
    Aerek East Tennessee, USAMember Posts: 1,836 @@ - Legendary Achaean
    Nice. I figured it would be something simple I was missing.
    -- Grounded in but one perspective, what we perceive is an exaggeration of the truth.
  • Draugryn
    Draugryn Member Posts: 1
    edited January 9
    So, jumping back into the game with a new computer, loaded svof and keneanung's basher (not sure if either are still being maintained) and keep running into an issue that I'm sure has a super simple fix but I'm just not seeing it. I also know very little about how any of this works.

    Basically, the &tar isn't picking up my targets. Even when I've killed the mob manually, and it shows up in the prio list, the command doesn't seem to linking the &tar with my target (or anything on the list). 

    For reference, my command through the basher is: 

    keneanung: attackcommand is now battlefury focus speed/slaughter
    Alias "keneanungki" will now execute: "battlefury focus speed/slaughter &tar"

    What am I missing/doing wrong?
  • Nhakra
    Nhakra Member Posts: 18
    If I had to wager a guess, it'd be something to do with command separators, but I don't recall precisely how to work with 'em in this context.
Sign In to Comment.