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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Basic question on an "if" script

Basic question on an "if" script

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


Posted by Rena   (9 posts)  [Biography] bio
Date Tue 10 Feb 2009 05:59 PM (UTC)
Message
So I was working through the MUSHclient tutorial (http://www.gammon.com.au/forum/?id=6030) and copied this text from it:

if %1 < 100 then
ColourNote ("white", "red", "Warning! - health is low")
end -- if

It's meant to trigger on your health/mana line.

I changed the 100 to 4000 and had it trigger on this: ^Endurance: */*

But, any time the text of that form shows up, whether the number is above or below 4000, it gives me an error:

[string "Trigger: "]:1: unexpected symbol near '<'

But I'm just doing what the tutorial said! What's going wrong? Lua is what I have set as my scripting language.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 10 Feb 2009 07:04 PM (UTC)

Amended on Tue 10 Feb 2009 07:05 PM (UTC) by Nick Gammon

Message
You are doing what the tutorial said, but you have changed the trigger. ;)

It helps when posting a problem like this to post the whole trigger, so I can see exactly what you have done:

http://mushclient.com/copying

Also post an example of MUD output, so it is possible to test the trigger.

Your trigger text looks a bit like a regular expression because it starts with ^, however the rest is not correct if you have checked "regular expression".

If you have indeed checked the regular expression box, then you need to catch digits, and make them a "capture" otherwise %1 will be empty, which would account for the error message. For instance:


^Endurance: (\d+)/(\d+)



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Rena   (9 posts)  [Biography] bio
Date Reply #2 on Tue 10 Feb 2009 08:24 PM (UTC)
Message
Oh, right, that makes sense. I forgot that regular expressions work totally different with wildcards.

Thanks!
[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.


10,316 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 HostDash]