|
njms Newbie
Joined: 22 Sep 2004 Posts: 8
|
Posted: Sat Jan 29, 2005 1:04 am
spaces in %pos |
let say I have this:
#Trigger {You see (%1) here.} {#If %pos {long, %1} {look} {}}
then I get this line from the MUD:
You see a longbow here.
And the %pos comes back true.
But what I want if for it only to include the word "long" by itself, so I tried making it %pos {" long ", %1} but that doesn't work. Any suggestions? |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Sat Jan 29, 2005 2:11 am |
Well if you just want to know if %1 is exactly long you can just test it straight
#if ("%1" = "long")
but if you want to know if has the word long in %1 you could use regex
#if (%regex(%1, "\blong\b")) .. the \b tests for word boundries ie commas spaces etc
Jesse |
|
_________________ I love deadlines. I like the whooshing sound they make as they fly by. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Jan 29, 2005 3:19 pm |
Functions use parentheses (), not braces {}, around their parameters, and they don't have a space between the function name, %pos, and its parameters.
#IF %pos("long ", %1) {look}
NOT
#IF %pos {"long ", %1} {look}
The preferred scripting would also replace (%1) with (*) in the trigger pattern.
#TR {You see (*) here.} {#IF %pos("long ", %1) {look}} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
|
|