Mudlet Help Desk

1246710

Comments

  • Setne said:
    Ashmer said:

    Anyone else have a problem where the inbuilt Mudlet logger randomly stops logging, silently?

     

    I notice when I turn off the logger, the log file is far shorter than what is actually between the start and stop echoes for the inbuilt logger.

    If you want to log stuff, you alternatively have the option of the screendump script, or a logger that logs things in real-time using html5. Unfortunately, I don't have the code, nor a download link, but I think it might be packaged with TW iirc.
    @ashmer that should work, just 'log' after combat..  ... 
    Mudlet Bashing System for sale. Message if interested
  • How in the bloody hell do I stop Mudlet from gagging < and > and everything in between? >.> I've figured this out before, but I can't seem to get it this time. Driving me effing insane.
    "You ever been divided by zero?" Nia asks you with a squint.



  • OleisOleis Producer Emeritus Administrator, Immortal
    Chances are you have mxp disabled in game but you still need to check Force MXP Negotiation Off in mudlet's preferences.
    You say to Slyphe, "You're so freaking smart."
    [---]
    "^," Slyphe agrees with you.
    Draiman
  • I swear I turned that off when I enabled gmcp, and then I had to restart everything. Sigh. Thanks.
    "You ever been divided by zero?" Nia asks you with a squint.



  • RiluoRiluo The Doctor
    edited February 2014

    quick question on how to make this kind of idea fire. I need it to activate when it hits a number. It is a badly done but its a test:

    ^Your (.+) has taken (.+)\% damage.$


    local autotest = matches[3]
    local autotest = autotest + 1
    if autotest > 90000 then
     send("parry whatever")
     autotest = 0
    end


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

  • DhraenDhraen UK
    edited February 2014
    local autotest = tonumber(matches[3])

    Tada!

    Edit: For the record, had you checked the error log, it would have detailed the issue.
    Omei
  • edited February 2014
    In addition to that, there are a number of ways you can optimize it.

    You should only declare something local once per scope. If you're not familiar with scope, suffice it to say, just use local the first time you use the variable, then just the variable name by itself from then on. You can do all needed arithmetic, string manipulation, or whatever you need right on the line in which you create the variable.

    local autotest = tonumber(matches[3]) + 1
    image

    i am rapture coder
    Dhraen
  • SetneSetne The Grand Tyrant
    ^Your (.+) has taken (.+)\% damage\.$

    Also, you can set variables as local without defining them at the top if need, e,g:
    local var1, var2, var3, var4, etc.

    Ingram said:
    "Oh my arms are suddenly lubed"
  • RiluoRiluo The Doctor
    edited February 2014

    Thank you guys, that makes more sense. I just need to translate it into tripwire as its parry setup is being odd.



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

  • I'm surprised no one has said this yet either, though I suppose it doesn't relate directly to the question:

    ^Your (.+) has taken (\d+)% damage\.$

    ^That's a better pattern. There is no need to escape the % character in regex - it isn't a special char. And don't use .+ for everything. Use \w+ for words and \d+ for numbers.

    Also
    http://www.regular-expressions.info/quickstart.html
    99% of what you need to know to match IRE mud output efficiently is on the quickstart page.
  • SetneSetne The Grand Tyrant
    I don't know what a proper line would look like, so I couldn't comment on it.

    Ingram said:
    "Oh my arms are suddenly lubed"
  • DhraenDhraen UK
    edited February 2014
    Personally, I'd use: ^Your ([A-Za-z ]+) has taken (\w+)\% damage\.$
    Better to be as strict as possible with your pattern matching, but yes... Good point.

    Edit: Might even be able to get away with just: ^Your ([a-z ]+) has taken (\d+)\% damage\.$ (This assumes the limb has no capital letters).

    Further, while it's obviously good practice to use \d+ as Irruel mentioned, in Mudlet, it matters little as even when using \d+, it gets interpreted as a string, hence the tonumber() requirement.

  • I used to bother doing:
    (head|torso|left leg|right leg|left arm|right arm)
    But these days I'm a bit lazy for that.

    \d does still matter though, as it is still more efficient than .+

    Also, I suppose we should be trying to use:

    .*
    [a-z ]*

    I tend to default to greedy + and only think about lazy * when the distinction matters, but to be efficient we should be doing the reverse.





  • RiluoRiluo The Doctor

    Hey guys tried to make a quick alias to order a troop to move. But I got this error every time? Help please.

    Lua error:[string "send("Tell division271491 march to " ..matc..."]:1: attempt to
    concatenate field '?' (a nil value)

    This is the script I set

    ^bmarch (\w+)

    send("Tell crew666 clear orders")
    tempTimer( 2, [[send ("Tell crew666 march to " ..matches[2])]] )

    .


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

  • SerriceSerrice the Black Fox
    tempTimer(2, [[send("tell crew666 march to "]] .. matches[2] .. [[")]])

    See what I did there?
     
    Riluo
  • RiluoRiluo The Doctor
    I tried it, but nothing. however, I will keep testing stuff as it will be a useful code to use for other things. Cheers

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

  • use

    local dir = matches[2]

    temptimer

    and change matches[2] to dir in the temptimer @Riluo
    Mudlet Bashing System for sale. Message if interested
  • RiluoRiluo The Doctor
    edited May 2014
    Hi once more guys :)

    I need to create a script that will convert a word to another word when I speak in game, whilst also allowing me to convert it back. It is for rp purposes and driving me insane. I have created the entire language already (yes I am an uber geek) Once I have it done I will be giving it to people as a "rp quest" I setup down the track. So for example:

    I will make a simple alias like "Dsay (\w+) that will fire the script. Therefore when I type:

    dsay hello world!

    Riluo says, "Vir wer!"

    Whilst doing the reverse, so
    Bob says, "Vir wer!" and I would hear Bob says, "Hello world!"

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

    Haven
  • AshmerAshmer Barefoot Adventurer Life
    edited May 2014
    There are a couple of ways you can do this. What I would do if I were to take a first cut at this is create two different subroutines. One is a gsub for accepting the language as a trigger, that would look like this:

    function translate_d(arg)

    local translation = arg:gsub("vir", "hello"):gsub("wer", "world")

    return translation

    end

    Then what you do is trigger say to something like:

    (\w+) says\, \"(.*)\"

    Here, you would need to create a check that runs a string.findpattern on matches[3], and if it doesn't detect a word of your language, to stop running the trigger. Then, do:

    deleteLine()
    local translation = translate_d(matches[3])
    cecho("(yellow) -- replace () with html brackets here -- " .. matches[2]:title() .. " says, \"" .. translation:title())

    I'm sure there are other ways you can do that bit, but that's the quick-and-dirty, no-research-done, no-questions-asked kind of thing I'd do. You could develop it from there, that's by no means the most efficient way or the most pared-down script you can do.

    For the opposite, in turning out the language, you could do the same thing, only in reverse. Create a function to return a gsubbed string, and then do send("say " .. translate_dsay(matches[2])) on that alias.

    Hope this gives you something of a start!

    the way she tells me I'm hers and she is mine

    open hand or closed fist would be fine

    blood as rare and sweet as cherry wine

  • Hey y'all! Just switched over to Mudlet and I'm kind of in love. BUT I do have a few questions before I really get sucked into writing a billion useless scripts. Disclaimer: My scripting jargon might be a little wonky.

    So, my understanding of Mudlet is that variables are stored globally and can be accessed by all other functions provided that variable only existed for a temporary time- like if it was created by a loop, it would disappear afterwards? But if a function created it before entering the loop and the loop only accessed it, the variable would remain free to use?

    Hypothetical problem: If I have a script going that will be setting variables for me and storing values, and a second one wants to borrow that information, but since starting Mudlet the first one hadn't been triggered to create that variable, what happens here? Do people run the equivalent of an init when they logon for all variables they know they'll need?

    Thanks!
    I once killed a humgii, y'know.

    JSYK she/her pronouns!
  • Everything in lua is a table. A table is a key = value structure (in cmud, a database variable, or record variable).

    When you create a function, for example, the function name is the KEY in some table, and the function itself is the value. The value can be a string, integer, function, boolean, another table, or probably one of a few other types that have slipped my mind, or I just don't know about.

    Even when you create a "simple" variable, that is to say:
    target = "ezalor"

    you are just adding another entry into the global table, which is called _G

    Try this:
    target = "mhun"
    display( target )
    display( _G.target)
    You'll get the same result - because by default, we can reference individual keys in the global table without having to specify the _G (however, sometimes it can be really useful to do so, which is why I mentioned it).

    Now do:

    pipes = {
    elm = "123",
    valerian = "456",
    skullcap = "789",
    }
    display( pipes )
    pipes.artifact = false

    function pipes.light()
    if not pipes.artifact then
    send("light pipes")
    end
    end
    display(pipes)

    Now you can see that you can have a single table with multiple TYPES inside - in this case, simple strings (text data), a true/false, and a function.

    This is pretty neat - it lets you contain/compartmentalise scripts, making them easy to share and resistant to being interfered with by other scripts given to you by other people.


    NOW that I am sure you're on the right page, I'll answer your question. I apologise if I explained what you already knew.

    if you create a variable as I did above, then it is available globally to any script. The value will not persist between sessions though - if you want to learn how to save values between sessions, ask that question separately (and check out the remember() function. Also saveTable()

    If you wish a variable to be LOCAL to the script or loop you create it in, then you must create the variable this way:

    local varname = value

    Be aware that if you create it inside a for loop, it will not exist outside the loop. The same goes for IF statements/functions etc.


    Samp
  • Irruel said:

    If you wish a variable to be LOCAL to the script or loop you create it in, then you must create the variable this way:

    local varname = value

    Be aware that if you create it inside a for loop, it will not exist outside the loop. The same goes for IF statements/functions etc.

    Thank you so much! This is exactly what I was trying to figure out.

    I really appreciate the Lua refresher course too, and I wasn't even aware _G could be used! I'm not new to scripting/coding, but it's been years since I was in practice so no worries about repeating things I knew because it's super helpful to be reminded. I'll look into saving tables and that stuff too!
    I once killed a humgii, y'know.

    JSYK she/her pronouns!
    Riluo
  • So, I foolishly did a "gmcp = nil" to try and reset my GMCP table*. My want was to do that and then cause some GMCP events so my table wouldn't have old information on it. Since Aet doesn't send every Message at login, is there a way to clean out the old table so I'm not seeing Update and CombatMessage from the last time I logged on?

    * Even though I was still in debug mode, I quit receiving notifications for GMCP events after setting gmcp to nil, and the table never updated. I closed Mudlet without saving my profile and am fine after resetart. Does anyone know what would've happened if I DID save my profile?

    Thanks! <3
    I once killed a humgii, y'know.

    JSYK she/her pronouns!
  • gmcp = nil takes it away from a table value. gmcp = {} might have fixed it. Aaaaaand uh, there are some events that only update under certain occurrences, and I have no idea how to 'clean those out' - you'd be better off just activating a script and setting local variables whenever those values change.

    Arbre-Today at 7:27 PM

    You're a vindictive lil unicorn
    ---------------------------

    Lartus-Today at 7:16 PM

    oh wait, toz is famous

    Karhast-Today at 7:01 PM

    You're a singularity of fucking awfulness Toz
    ---------------------------
    Didi's voice resonates across the land, "Yay tox."
    ---------------------------

    Ictinus11/01/2021

    Block Toz
    ---------------------------

    limToday at 10:38 PM


    you disgust me
    ---------------------------
    (Web): Bryn says, "Toz is why we can't have nice things."

    Samp
  • SheirosiaSheirosia Sheffield, UK.
    Hi, Samp.

    Yeah, setting it to nil was bad as you found out. You could take the advice from Toz, but honestly, that's really never needed. If you might elaborate a little on what you're actually trying to accomplish, it might help to better advise you. Had you saved your profile, you'd have been fine after a restart as the gmcp namespace is declared when Mudlet raises the sysConnectionEvent event handler.
    Samp
  • @Sheirosia It isn't something I need in the long run. I'm just working on a few scripts and I wanted to be able to test them against varying gmcp tables, and having some of the information not change made it hard to know if my scripts were doing anything or not.
    I once killed a humgii, y'know.

    JSYK she/her pronouns!
  • The trick is figuring out what does make them change. Room items for example; just leave the room and return. If you're testing the add/remove parts, then drop something/pick it up. For char vitals, just hit yourself/focus.

    No doubt you've noticed in debug mode that the gmcp updates are made obvious in the main window.

    Have you read through Lin's thread, 'How to SHOT gmcp'?
  • Quick question. I was wondering if there was a way to enable/disable a class folder in Mudlet like on cmud? I tried using the disableAlias("x") and enableAlias("x") commands but they don't seem to work. Where x is the name of the folder. I also tried the versions for trigger and got nothing.
    image
  • disableTrigger("x")
    enableTrigger("x")
    Mudlet Bashing System for sale. Message if interested
  • {
    Start = "clt6",
    Text = {
    text = "[0;1;34m(Dion an Duir): Illidan says, \"It was the an eclipse tarot, angwe.
    \"[0m[0;37m",
    talker = "Illidan",
    channel = "clt6"
    },
    End = "clt6",


    When doing chancap via gmcp, how do I turn the ansi control codes into actual colours, so I can preserve the colours when I push the text into the miniconsoles?

    I studied the way TW handles chancap and it is horrendous. Chancap is honestly not that difficult, I don't see why there needs (or even how there can) to be 300 lines of code :/ But with the vox iterators around, there is no way I'm going to attempt to do it with triggers. YATCO is outdated anyway.


Sign In or Register to comment.