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.
Entire forum
➜ MUSHclient
➜ Lua
➜ trigger regex help
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Sgbarter
(6 posts) Bio
|
Date
| Thu 28 Aug 2008 09:36 PM (UTC) |
Message
| I get these compile errors whenever I am trying to use a trigger that tries to assign multiple words to a variable:
[string "Trigger: "]:1: ')' expected near 'a'
This is the regex I am matching to:
^(.*) tells you \'of (.*) which is in the general area\'$
And the match text is like this:
Questgiver tells you 'of Inside a large tent which is in the general area'
Then in the trigger code it's doing this:
SetVariable ("quest_room", %2)
What am I doing wrong? If I do it correctly, quest_room should == Inside a large tent
But the compile error comes up when the trigger finds a match.
| Top |
|
Posted by
| Bottomfeeder
(42 posts) Bio
|
Date
| Reply #1 on Thu 28 Aug 2008 10:12 PM (UTC) Amended on Thu 28 Aug 2008 10:15 PM (UTC) by Bottomfeeder
|
Message
| Try using (\w*) or possibly, (.*?) instead of the (.*) in your trigger. | Top |
|
Posted by
| WillFa
USA (525 posts) Bio
|
Date
| Reply #2 on Fri 29 Aug 2008 02:12 AM (UTC) |
Message
| SetVariable ("quest_room", "%2")
Quote the %2, otherwise the expansion happens before the compile and the scripting engine ends up looking for 3
variables named Inside, the, tent;
i.e. SetVariable ("quest_room", Inside the room)
instead of one string "Inside the tent"
i.e. SetVariable ("quest_room", "Inside the tent") | 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,289 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top