Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
njms
Newbie


Joined: 22 Sep 2004
Posts: 8

PostPosted: 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?
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: 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.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net