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
cstegmann
Beginner


Joined: 30 Sep 2004
Posts: 14

PostPosted: Sun Feb 20, 2005 3:32 pm   

Sending exits to a var
 
Hey there, i've seen a couple of posts of trigs, but i never got them to work properly.

What i'm trying to do is send all the exits to a variable as a datarecord.

the patterns look like so:

You see exits leading north and south.
You see exits leading north, up and south.
You see exits leading north (open door), up, south (closed door) and west.

Any tips on how i could do this?

Thanks
_________________
cstegmann.talkhost.info
cstegmann.talkhost.info
http://cstegmann.talkhost.info

Last edited by cstegmann on Mon Sep 26, 2005 10:17 pm; edited 1 time in total
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Feb 20, 2005 4:19 pm   
 
if all the possible exit values are known before this will work

#TRIGGER {You see exits leading (*)} {
#var exitvar ""
#fo {north|east|south|west|up|down} {
#if %regex("%1",%i) {#additem exitvar %i}
}
#echo found:@exitvar
}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
cstegmann
Beginner


Joined: 30 Sep 2004
Posts: 14

PostPosted: Sun Feb 20, 2005 4:35 pm   
 
Thanks, that works great.
Reply with quote
cstegmann
Beginner


Joined: 30 Sep 2004
Posts: 14

PostPosted: Mon Feb 21, 2005 8:21 pm   
 
Ok, just encountered a problem with that script.

trigger looks like so:

#TRIGGER {You see exits leading (*)} {
#var exitvar ""
#fo {north|northeast|east|southeast|south|southwest|west|northwest|out|in|up|down} {
#if %regex("%1",%i) {#additem exitvar %i}
}
#echo found:@exitvar
}

I get this:

A long corridor.
You see exits leading north, south, and west.
3160h, 3136m, 16024e, 16800w cexkdb@-*|22:17:33:669|*-Exits: north|south|west|out

The only place i can see "out" is in the word sOUTh, how would i stop it from doing this?

Thanks
_________________
cstegmann.talkhost.info
cstegmann.talkhost.info
http://cstegmann.talkhost.info

Last edited by cstegmann on Mon Sep 26, 2005 10:18 pm; edited 1 time in total
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Feb 21, 2005 8:35 pm   
 
no problem

#TRIGGER {You see exits leading (*)} {
#var exitvar ""
#fo {north|northeast|east|southeast|south|southwest|west|northwest|out|in|up|down} {
#if %regex("%1","\b%i\b") {#additem exitvar %i}
}
#echo found:@exitvar
}

the part in bold is the change
the \b forces the pattern to match a word boundary,so enclosing the pattern within them forces it to match a complete word
\bout\b wont match the out in south

\bsouth\b wount match the south in southwest etc
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
cstegmann
Beginner


Joined: 30 Sep 2004
Posts: 14

PostPosted: Mon Feb 21, 2005 8:38 pm   
 
ah, perfect, thanks
_________________
cstegmann.talkhost.info
cstegmann.talkhost.info
http://cstegmann.talkhost.info

Last edited by cstegmann on Mon Sep 26, 2005 10:19 pm; edited 1 time in total
Reply with quote
aliensurfer
Beginner


Joined: 11 Apr 2005
Posts: 17

PostPosted: Thu Sep 22, 2005 11:35 am   
 
This does work well, however there is another syntax for when there is only one exit:

You see a single exit leading <direction>

How can I add that into the trigger to pick that up?
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Sep 22, 2005 12:50 pm   
 
#TRIGGER {You see (*) leading (*)} {
#var exitvar ""
#fo {north|northeast|east|southeast|south|southwest|west|northwest|out|in|up|down} {
#if %regex("%2","\b%i\b") {#additem exitvar %i}
}
#echo found:@exitvar
}

Try that
_________________
http://www.Aardwolf.com
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