A few alias, trigger, and speedwalking questions

Post Reply
Bigglesbee
Posts: 24
Joined: Wed Aug 10, 2022 4:13 pm

A few alias, trigger, and speedwalking questions

Post by Bigglesbee »

Hey guys, been trying to figure out some triggers and aliases, as well as a couple of speedwalking things. I'm new to all this and have figured out most things I've needed, but I'm stuck on these five things, so bear with these five questions please!
  1. First, I have a trigger that picks up and wields a weapon once it's been disarmed. So far, it seemingly works for any combination of names, except weapons that have a single word for a name. I realize it must be something with <weapon>, just can't figure out what it's missing:

    Code: Select all

    ^(?<disarmer>[\w\s-']+) DISARMS your[\w\s'-]+ (?<weapon>[\w-]+)!
  2. Second, been trying to make a login trigger based off text that has []. The below code doesn't work, but it does work if I remove the $. Why?

    Code: Select all

    ^Press (enter...|\[ENTER\])$
  3. Third, in the Mudlet documentation, it says you can use words as directions, like if you have speedwalk("5w, IN, 2s") that the "IN" will send that command. However, that's not working for me with more complex words, like "cauldron" for instance. The below code will break up the world "cauldron" and only spam the directional characters, u, d, n. So far, I've just split it into two speedwalk() and did a send("cauldron") in between, which seems like I could just use send() instead at that point. How can I get the below to work using the proper speedwalk() function?

    Code: Select all

    speedwalk("5w, cauldron, 2s")
  4. Fourth, is there a way to get some quick alias-style batch commands that work for on-the-fly speedwalking and general commands? So I could type something like "b8 drink mug" and then it would send "drink mug" 8 times? This would also work for on-the-fly speedwalking, like "sp 8w2s" which would turn into speedwalk("8w2s"). Haven't been successful with these either.
  5. Finally, I read the documentation on how to set variables on-the-fly from the command line, but pretty much nothing happens. I'd also want this to edit permanent variables (the ones clicked with the checkbox). So for example, I get a new weapon, then I can change the my_weapon variable's keyword in the command prompt without having to open up the variables menu and edit it there.

    Thanks in advance, and I apologize for the bunch of questions!

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: A few alias, trigger, and speedwalking questions

Post by demonnic »

1. What's the line you're matching against look like? A working and non-working example, if you could. I think your regex is only capturing the last word, and it seems like it is designed specifically to do that. So I'd like to see the text you're matching to make sure I'm not missing something before I suggest an alternative.

2. The $ signifies the end of the line. If removing it makes it work, that likely means there are characters you can't see behind the [ENTER] on the line. You could change the $ to \s*$ and it will catch any trailing spaces

3. I will have to come back to this after taking a look at the speedwalk function again, I haven't used it myself in ages as I primarily use the mapper for my automated walking.

4. Sure, if you wanted to to the repeat one for instance you could make the pattern "^b (\d+) (.+)" without the "s and then make the code
Code: [show] | [select all] lua
for i = 1, tonumber(matches[2]) do
  send(matches[3])
end
And for the sp one you could do the pattern "^sp (.+)" without the "s and for the code use
Code: [show] | [select all] lua
speedwalk(matches[2])
5. Check in your package manager and make sure "run-lua-code-v4" is listed. If not you can download the package xml from https://raw.githubusercontent.com/Mudle ... ode-v4.xml and install it and it'll get you the lua alias back.

Bigglesbee
Posts: 24
Joined: Wed Aug 10, 2022 4:13 pm

Re: A few alias, trigger, and speedwalking questions

Post by Bigglesbee »

Thanks for replying to my question spam!
  1. The line can vary, like "Demonnic DISARMS your big giant weapon!" Or "A small demonnic DISARMS your Thing!" Or stuff with punctuation in the names like the possessive 's and such. I figured capturing the last word would also count if there's only one word, but I guess not! Not sure how to do that.
  2. You were totally right about hidden characters after the [ENTER], there's a space that I never knew was there.
  3. Cool yeah, not sure what's wrong. In the interim, splitting up the speedwalk() with a send() does the job at least.
  4. These work great so far!
  5. I do have that package listed in the package manager. Maybe I'm doing something wrong for this? When I type "lua my_weapon = sword", nothing appears in the Variables section. If I already have a my_weapon that I manually set, it doesn't change the value of the variable, it instead seems to remove the variable from the list entirely.

Bigglesbee
Posts: 24
Joined: Wed Aug 10, 2022 4:13 pm

Re: A few alias, trigger, and speedwalking questions

Post by Bigglesbee »

Scratch #5 from the last post, realized I wasn't putting quotes around the new name!

User avatar
demonnic
Posts: 884
Joined: Sat Dec 05, 2009 3:19 pm

Re: A few alias, trigger, and speedwalking questions

Post by demonnic »

for 1, I would change the 'your[\w\s'-]+' to `your[\w\s'-]*` ... like so

Code: Select all

^(?<disarmer>[\w\s-']+) DISARMS your[\w\s'-]* (?<weapon>[\w-]+)!
The difference is that * is "zero or more" and + is "one or more", so the one you have now requires there to be more than one word, but with the * it should allow for there to be only one word.

Bigglesbee
Posts: 24
Joined: Wed Aug 10, 2022 4:13 pm

Re: A few alias, trigger, and speedwalking questions

Post by Bigglesbee »

Ah great, that worked and makes sense, thanks!

Post Reply