trigger regex help

Posted by Sgbarter on Thu 28 Aug 2008 09:36 PM — 3 posts, 14,870 views.

#0
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.
#1
Try using (\w*) or possibly, (.*?) instead of the (.*) in your trigger.
Amended on Thu 28 Aug 2008 10:15 PM by Bottomfeeder
USA #2
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")