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
spidey
Newbie


Joined: 29 Jan 2004
Posts: 2
Location: USA

PostPosted: Thu Jan 29, 2004 12:10 pm   

Total Newbie - Trigger, STW and mapping
 
Ok I'm trying to capture text (directions) like:
[NsEw]

So that it shows up in a status window. I tried this:
#TRIGGER {~[%w%w%w%w~]} {#STW {%1 %2 %3 %4}}

But when my trigger hits the status window is empty. I've read over the forums and I think I've got it right. If I replace the above with
#TRIGGER {~[%w%w%w%w~]} {#STW {a}}

And my trigger goes off an 'a' will apear in the status window - so I know I have it partially right. I just can't figure out what I'm doing wrong (i.e. why I can't trap the values to display).

The reason for this little feature is that I've discovered for some reason the mapper does not react to lower case characters for exits. So when travesing rooms, if the new room I go to has a door closed in it -- the room does not appear on the map. My work around is to force the output to show all capital letters -- but then I need to know which doors are closed so I can open them before walking :> I know this is probably a hack and there is an elegant solution, but I am totally new to scripting. If there is feel an answer to this problem free to point me in the right direction. But I'd still like to hear a solution to the original question because it is bugging me. :>

Thanks!

- spidey
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Thu Jan 29, 2004 1:54 pm   
 
quote:
Originally posted by spidey

[NsEw]
So that it shows up in a status window. I tried this:
#TRIGGER {~[%w%w%w%w~]} {#STW {%1 %2 %3 %4}}

But when my trigger hits the status window is empty. I've read over the forums and I think I've got it right. If I replace the above with
#TRIGGER {~[%w%w%w%w~]} {#STW {a}}



Your trigger fires when it matches the pattern, but to capture wildcards they must be surrounded by parenthesis.

As written, the trigger only looks for the pattern but does not load the matched values into the trigger variables.

Something like this should work to capture the individual direction letters...
#TRIGGER {~[(?)(?)(?)(?)~]} {#STW {%1 %2 %3 %4}} Untested.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 29, 2004 6:28 pm   
 
I think it's likely that the number of exits won't always be 4. Therefore, you should probably use a more general pattern, such as a single %w, and then insert spaces to separate the characters before placing them in the status window. It's not necessary to continually redefine the status window, by using a variable the window will update itself as the variable changes.

#TR {~[(%w)~]} {#VAR Exits %1;#IF (%len( @Exits) > 1) {#LOOP %len( @Exits),2 {#VAR Exits {%insert(" ", {@Exits}, %i)}}}
#STW {@Exits}
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