Mudlet Help Desk

145679

Comments

  • RiluoRiluo The DoctorMember Posts: 821 ✭✭✭✭
    Hey looking for assistance with something I am doing in Lua.

    When I type wounds:
    You take a moment to assess how damaged your limbs are:
    Head:      0.00% (no bruising)
    Torso:     0.00% (no bruising)
    Left arm:  0.00% (no bruising)
    Right arm: 0.00% (no bruising)
    Left leg:  0.00% (no bruising)
    Right leg: 0.00% (no bruising)
    Balance Used: 1.50 seconds
    Equilibrium Used: 1.50 seconds
    I need to convert the lines like so I think:

    ^Left arm\: (.+)% \((.+)\)

    From here I want it to press jecis if the the line is over 17.00%

    Left arm: 17.05% (no bruising)

    any one able to show me a basic way of doing this.

    I was trying simple stuff like:
    if matches[2] > 16 then
    do stuff
    return
    end
    But yeah its fail!!

    Abhorash says, "Ve'kahi has proved that even bastards can earn their place."

  • RasharRashar Member Posts: 1,609 ✭✭✭✭✭
    Halp dying.
  • NalorNalor UKMember Posts: 774 ✭✭✭
    Riluo said:

    Hey looking for assistance with something I am doing in Lua.

    When I type wounds:

    You take a moment to assess how damaged your limbs are:
    Head:      0.00% (no bruising)
    Torso:     0.00% (no bruising)
    Left arm:  0.00% (no bruising)
    Right arm: 0.00% (no bruising)
    Left leg:  0.00% (no bruising)
    Right leg: 0.00% (no bruising)
    Balance Used: 1.50 seconds
    Equilibrium Used: 1.50 seconds
    I need to convert the lines like so I think:

    ^Left arm\: (.+)% \((.+)\)

    From here I want it to press jecis if the the line is over 17.00%

    Left arm: 17.05% (no bruising)

    any one able to show me a basic way of doing this.

    I was trying simple stuff like:
    if matches[2] > 16 then
    do stuff
    return
    end
    But yeah its fail!!
    you dont wanna do if matches[2] > 36 press jecis to x end... because if your off salve bal you'll mess things up You need to set it to an aff and as far as I remember your on TW right @Riluo

    So it'll be like


    if matches[3] > 16 then
    local jlimb = matches[2]:gsub(" ", "")

    myaffAdd(jlimb.. "prep")

    end

    Dont quoet me on that as I do mine completely different and not 100% certain on the aff TW uses for pre restoring nor how it captures afflictions.. Too lazy to download the system to see

    But morale of it all, YOu need to track it as an affliction and place it below all your salve curing so when it doesn't have to cure a REAL aff it'll prerestore (since its 4 seconds to preprestore)

    Also you have to set the You have restored your right leg as best as you can! - to be like -- myaffRemove(rightlegpre") and so on..


    Mudlet Bashing System for sale. Message if interested
  • RiluoRiluo The DoctorMember Posts: 821 ✭✭✭✭
    edited June 2015
    Nalor said:

    Riluo said:

    Hey
    you dont wanna do if matches[2] > 36 press jecis to x end... because if your off salve bal you'll mess things up You need to set it to an aff and as far as I remember your on TW right @Riluo

    So it'll be like


    if matches[3] > 16 then
    local jlimb = matches[2]:gsub(" ", "")

    myaffAdd(jlimb.. "prep")

    end

    Dont quoet me on that as I do mine completely different and not 100% certain on the aff TW uses for pre restoring nor how it captures afflictions.. Too lazy to download the system to see

    But morale of it all, YOu need to track it as an affliction and place it below all your salve curing so when it doesn't have to cure a REAL aff it'll prerestore (since its 4 seconds to preprestore)

    Also you have to set the You have restored your right leg as best as you can! - to be like -- myaffRemove(rightlegpre") and so on..

    Thank you for the reply, I get the gest of what you did here but I could not get it to work with what I have done thus far. I do not use TW or oasis or anything. Instead I use a hybrid of triggers for secondary messages and the IG firstaid along with what I learn as I go. So realistically I have no clue how this all functions I just break things and if it happens to do something I adopt it.

    I think the main issue is the trigger line as the line I am trying to capture looks like this.

    Left arm: 0.00% (no bruising)

    And has a decimal place in it. The trigger line I have does not:

    ^Left arm\:\s+(\d+)\% \((.+)\)

    I even tried to change it like so to capture the decimal point:

    ^Left arm\:\s+(\d+).(\d+)\% \((.+)\)

    Yet it won't capture anything either? So I am a loss as to what to do next.

    Abhorash says, "Ve'kahi has proved that even bastards can earn their place."

  • NalorNalor UKMember Posts: 774 ✭✭✭
    ^(.+)\:\s+(.+)\% \((.+)\)$

    is what i use the first (.+) is the limb
    Mudlet Bashing System for sale. Message if interested
  • TozToz Member Posts: 2,153 ✭✭✭✭✭
    Nalor said:

    ^(.+)\:\s+(.+)\% \((.+)\)$

    is what i use the first (.+) is the limb

    Can I just take a moment to say that regex is absolutely fugly to look at?
    (Oasis): Azzello says, "I'll still never forget the first time I saw Toz throwing hammers."
    (Oasis): Azzello says, "I freaked out and thought they had somehow managed to pull me into them."
    (Oasis): Azzello says, "So I tumbled away from my team and into theirs."


    TragerIshinDrahkuna
  • SerriceSerrice the Black Fox Member Posts: 1,202 ✭✭✭✭✭
    Char.Items.Contents

    Can you only query items that are in your inventory?
     
  • VeovisVeovis FloridaMember Posts: 282 ✭✭✭
    A quick little trigger to help with the recent time change. No guarantees that it's 100% accurate in all cases.
    Pattern: ^It has (\d*\.\d*) months of usefulness left\.$ Script: local real_hours = (tonumber(matches[2] * 100)/24) cecho("\n<gray>There are <goldenrod>" ..real_hours.. " <gray>real days of use left.\n")

    Assuming I read HELP TIME right, this should show you how long your item has in real days, because the new time has me thinking my stuff is going to decay this week.
  • NalorNalor UKMember Posts: 774 ✭✭✭
    edited August 2015
    ^It has (.+) months of usefulness left.$


    local days = math.floor(matches[2] * 4)
    cecho(" OOC Days: " .. days)


    Works better
    Mudlet Bashing System for sale. Message if interested
  • VeovisVeovis FloridaMember Posts: 282 ✭✭✭
    Nalor said:

    ^It has (.+) months of usefulness left.$


    local days = math.floor(matches[2] * 4)
    cecho(" OOC Days: " .. days)


    Works better

    Tried that. It was inexact due to rounding error.
  • NalorNalor UKMember Posts: 774 ✭✭✭
    @Veovis works fine for me,

    It has 1.0 months of usefulness left. OOC Days: 4
    Mudlet Bashing System for sale. Message if interested
  • VeovisVeovis FloridaMember Posts: 282 ✭✭✭
    edited August 2015
    Nalor said:

    @Veovis works fine for me,

    It has 1.0 months of usefulness left. OOC Days: 4

    The issue with math.floor is that it will, more or less, round the number down no matter how close it is to being higher. 1.9 is 1. 1.2 is 1, etc. The trigger I posted gives a pretty exact duration with the caveat that you will see a repeating decimal sometimes, because I don't care and didn't want to use string functions to truncate to two decimal places.

    Also, your regexp is more permissive than it needs to be. .+ is a wildcard, which isn't necessary at all.
  • MissariMissari Member Posts: 208 ✭✭✭
    So I'm trying to build a table database of shrines automatically as I walk around, adding some mudbot functionality that I've lost since switching to mudlet mapper. won't work though, and I can't figure out why.

    The for loop is inside a function that handles the gmcp event gmcp.Char.Items.List, debug echos show everything working right up until I try to table.insert, then the error pannel outputs
    [ERROR:] object: function:
    <[string "..."]:8: bad argument #1 to 'insert' (table expected, got nil)>
    Head scratching ensues. Halp plox.
    local roomNum = gmcp.Room.Info.num
    t.shrinelist = table.load(getMudletHomeDir().."\\shrinelist.lua", t.shrinelist)
    for k,v in ipairs(gmcp.Char.Items.List.items) do
    	if v.icon == "shrine" then
    		v.name = string.gsub(v.name, "a shrine of ","")
    		table.insert(t.shrinelist[v.name], roomNum)
    		table.save(getMudletHomeDir().."\\shrinelist.lua", t.shrinelist)
    	end
    end
  • KerocKeroc A small cupboardMember, Administrator, Immortal Posts: 364 admin
    edited May 2016
    table.insert requires your first passed arg to be a pointer towards a table. You will need to initialize 't.shrine[{string}]' as a table first if you want to use this call.

    A quick method would be:

    if type(t.shrinelist[v.name]) ~= "table" then t.shrinelist[v.name] = {} end

  • SivekuiSivekui Member Posts: 77 ✭✭
    Does anyone happen to know how to change the gmcp.Char.Status.level = "80 (65%)" into just the "80" ? so taking away the (65%) in mudlet, its driving me nuts
    MayhemHunting - Discord Chat - CLANHELP MAY (ingame)

  • TozToz Member Posts: 2,153 ✭✭✭✭✭
    @Sivekui I'm lazy, I'd do:

    local unicorn= "80 (65%)"
    local unf = string.split(unicorn, " ")


    unf[1] now contains 80, unf[2] has (65%). I just split the string into an array using a space as a delimiter.
    (Oasis): Azzello says, "I'll still never forget the first time I saw Toz throwing hammers."
    (Oasis): Azzello says, "I freaked out and thought they had somehow managed to pull me into them."
    (Oasis): Azzello says, "So I tumbled away from my team and into theirs."


  • IshinIshin Retired Lurker VirginiaMember, Guildmaster Posts: 1,748 ✭✭✭✭✭
    Anyone have any idea why my mapper wouldn't be recognizing that I'm in a water room and just keep trying to move in a direction instead of swimming?
    Tell me and I forget, teach me and
    I remember, involve me and I
    learn.
    -Benjamin Franklin
  • CaolanCaolan StrayaMember Posts: 13 ✭✭
    @Ishin, you want to find the trigger line for swimming (which I think is ^There's water ahead of you. You'll have to swim to make it through.$), and add mmp.swim() to the trigger script - this will tell the mapper's autowalker it needs to swim. If it's specifically about the environment type, you can try to do mc on and walk in and out of the room, it should update the room to reflect the water but it may not be listed that way. Remember to do mc off afterwards.
  • IshinIshin Retired Lurker VirginiaMember, Guildmaster Posts: 1,748 ✭✭✭✭✭
    Any idea why this wouldn't work?

    local targetAffs = beast.targets[who].affs

    I'm running 3.0.0 version mudlet right now. My script won't seem to populate the local targetAffs variable, not sure why.
    Tell me and I forget, teach me and
    I remember, involve me and I
    learn.
    -Benjamin Franklin
  • TozToz Member Posts: 2,153 ✭✭✭✭✭
    Mudlet tables are weird. Try deepcopy instead of = and post any errors you may get (or what it does instead).
    (Oasis): Azzello says, "I'll still never forget the first time I saw Toz throwing hammers."
    (Oasis): Azzello says, "I freaked out and thought they had somehow managed to pull me into them."
    (Oasis): Azzello says, "So I tumbled away from my team and into theirs."


  • LinLin SMASHER/DEVOURER MASCHINEKLASTMember Posts: 1,560 mod
    There are a number of steps you'll need to do before anyone can troubleshoot your problem. Type "lua beast.targets[who].affs". Does anything come up or does it return nil? Do you have anything appearing in your error console when you try to use that bit of code?
  • SivekuiSivekui Member Posts: 77 ✭✭
    @Ishin what does the [who] represent?

    and do you have

    beast.target[whatwhorepresents].affs = {} somewhere?
    MayhemHunting - Discord Chat - CLANHELP MAY (ingame)

  • IshinIshin Retired Lurker VirginiaMember, Guildmaster Posts: 1,748 ✭✭✭✭✭
    I actually ended up fixing it by simplifying the code, but basically that snippet is part of a function. It looks a bit like this.

    function doThis(who, aff)

    something
    something
    local something = gmcp.Something
    local targetAffs = beast.target[who].affs

    The 'who' is basically my target. So it might be like uh...

    'You use Mentis Stupidity on Lin.'

    doThis(Lin, "stupidity")

    Or something along those lines. But it was like the [who] wasn't expanding to fill in the person's name.
    Tell me and I forget, teach me and
    I remember, involve me and I
    learn.
    -Benjamin Franklin
  • TozToz Member Posts: 2,153 ✭✭✭✭✭
    You were saying 'make the variable targetAffs equal to the table found at beast.target.Lin.affs'. So if your table was really defined as, for instance, beast.target["Lin"].affs it wouldn't work (iirc), and if it was just beast.target.affs or beaset.Lin.affs, it would also not resolve.

    I'd suggest using an addAff function instead to simplify though. Just do like addAff(matches[2], matches[3]) for mentis, then add the aff matches[2] to matches[3] in the function so you only ever need to do logic in the one place.
    (Oasis): Azzello says, "I'll still never forget the first time I saw Toz throwing hammers."
    (Oasis): Azzello says, "I freaked out and thought they had somehow managed to pull me into them."
    (Oasis): Azzello says, "So I tumbled away from my team and into theirs."


  • LinLin SMASHER/DEVOURER MASCHINEKLASTMember Posts: 1,560 mod
    Also, rude!
  • SivekuiSivekui Member Posts: 77 ✭✭
    edited October 25
    @Ishin why you doing aff table per PERSON instead of just one .. as each time you switch target / someone moves room the affs will be reset.

    I've never personally understood why people keep track of everyones affs rather then just your own target. Makes things much more easier.

    also likely this ' local targetAffs = beast.targets[who].affs ' doesnt work as the beast.targets[who] is a table but I could be wrong. or you might have todo

    if not beast.target[who].affs then
    beast.target[who].affs = {}
    end

    before the local ^ to be sure it has THAT table.
    MayhemHunting - Discord Chat - CLANHELP MAY (ingame)

  • MykellahMykellah EnorianMember Posts: 49 ✭✭
    Sivekui said:

    @Ishin why you doing aff table per PERSON instead of just one .. as each time you switch target / someone moves room the affs will be reset.

    I've never personally understood why people keep track of everyones affs rather then just your own target. Makes things much more easier.

    Two words:

    Group fights


    "Courage is the soul of life"
  • TirriaTirria Member Posts: 16
    Hello,
    I am new to mudlet , and am trying to make a UI. Problem is that as I mess with things and change the sizes of the containers or miniconsoles. When I save then reactivate the script. They stay the same as the original. So how do I remove what wasn't right and update to what I want to try next?
  • TiurTiur Producer Member, Administrator, Immortal Posts: 280 admin
    I have a mudlet compatibility with screenreaders issue, if anyone has experience?
  • SivekuiSivekui Member Posts: 77 ✭✭
    Tirria said:

    Hello,
    I am new to mudlet , and am trying to make a UI. Problem is that as I mess with things and change the sizes of the containers or miniconsoles. When I save then reactivate the script. They stay the same as the original. So how do I remove what wasn't right and update to what I want to try next?

    reboot mudlet. Sometimes if you just reactivate the script it doesn't show (but it does, mudlet is weird) so rebooting it you will see the full effect of what you changed in the output.

    @Tiur have you asked on the mudlet discord channel? Vadi and co are pretty good and helpful
    MayhemHunting - Discord Chat - CLANHELP MAY (ingame)

Sign In or Register to comment.