[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Having some strange problems
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Having some strange problems

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


Posted by Hisoka   (1 post)  [Biography] 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
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] 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().
[Go to top] 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.


2,547 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]