Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Having some strange problems

Having some strange problems

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Hisoka   (1 post)  Bio
Date Sat 11 Jun 2011 02:55 PM (UTC)
Message
Greetings,

I'm having some strange problems.

First:
I'm not able to use \w+ for any letters.

Alias: target (\w+)
Send: Note(%1)

If I type: target 333, it says 333.
If I type: target abc, it says nil.
If I type: target a1, it says nil.

Second:
Trigger: ((\w+) feels fine)
Send: Send(%1)

Error:
Compile error
World: Avalon
Immediate execution
[string "Trigger: "]:1: ')' expected near 'feels'


RegEx is enabled, I'm using LUA as script language.

Thanks for any advices,
Hisoka
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Sat 11 Jun 2011 05:40 PM (UTC)
Message
Look at your input and the way it is evaluated.

Trigger: target (\w+)
Send: Note(%1)

From this, we can reason towards:

Captured groups: just one, which is matched by the regexp \w+
Substituted 'Send' for 'target 333': Note(333)
Substituted 'Send' for 'target abc': Note(abc)
Substituted 'Send' for 'target a1': Note(a1)

Does that clear it up any? The clue is that you are using Send to Script.

Your problem is that you do not properly understand how MUSHclient and Lua work together. Basically, when MUSHclient substitutes wildcards and variables, the resulting text has to be a valid script.

And while the commands are a valid script, they are not what you intended for anything but the number case. Note(abc) will output the contents of the Lua variable abc. Instead, you want the literal string abc, so you want the substituted Send to look like Send("abc"). In comparison Note(123) interprets 123 as a number, which Lua knows how to turn into a string for this purpose.

Thus, you need:
Send: Note("%1")

The exact same cause lies at the roots of your other example with Send().
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,177 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.