Help with my first simple trigger?

dss
Posts: 12
Joined: Tue Apr 13, 2010 4:17 pm

Re: Help with my first simple trigger?

Post by dss »

With regards to targeting:

I have created the following alias:

Code: Select all

Pattern: ^af (\w+)$
Script: target = matches[2]
And I have created this trigger:

Code: Select all

Perl Regex: ^(.+) leaves (\w+).$

Script: if matches[2]:find(target) then
send(matches[3])
end
I enter a room with a tiny sand fly, I type "af The tiny sand fly" (and have alternately tried "af fly" "af sand fly" and "af tiny sand fly") and the mud reports back with "What?"

I get this error:

Code: Select all

ERROR: object:<auto follow target> function:<Trigger 11>
<[string "function Trigger11()..."]:2 bad argument #1 to 'find' (string expected, got nil)>
And I do not follow.

So clearly I still don't quite understand the whole targeting thing. I really want to. What am I doing wrong?

Yugosan
Posts: 4
Joined: Wed Mar 31, 2010 11:33 am

Re: Help with my first simple trigger?

Post by Yugosan »

insted of:

Code: Select all

Pattern: ^af (\w+)$
Script: target = matches[2]
try

Code: Select all

Pattern: ^af (.+)$
Script: target = matches[2]
this should allow for a string of word, insted of a single word

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Help with my first simple trigger?

Post by tsuujin »

open the debug console, then try and execute the trigger with the console OPEN, see if it tells you anything.

Post Reply