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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  trigger regex help

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

trigger regex help

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Sgbarter   (6 posts)  [Biography] bio
Date Thu 28 Aug 2008 09:36 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Bottomfeeder   (42 posts)  [Biography] bio
Date Reply #1 on Thu 28 Aug 2008 10:12 PM (UTC)  quote  ]

Amended on Thu 28 Aug 2008 10:15 PM (UTC) by Bottomfeeder

Message
Try using (\w*) or possibly, (.*?) instead of the (.*) in your trigger.
[Go to top] top

Posted by WillFa   USA  (517 posts)  [Biography] bio
Date Reply #2 on Fri 29 Aug 2008 02:12 AM (UTC)  quote  ]
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")
[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.


1,439 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]