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
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Thu Aug 15, 2002 1:52 am   

Need help with door script
 
Ok, one of the muds I play on (Towers of Jadri) has an exit line like this:

[Exits: (D)north east (D)south west]

or:
[Exits: (O)north east (O)south west]

with the D's being closed doors, and the O's open. I'm trying to script it to automatically add the doors to the map, when in mapping mode. Here's the script I'm using:
#TRIGGER {~[(%d)hp (%d)en~]} {#var hp %1;#var en %2;#tag prompt;#gag;#if (%class Automapper) { #while (%numitems( @doors)) { #door %pop( doors)}} { #while (%numitems( @doors)) { #deli doors 1}}}
#TRIGGER {~(O~)(%w)} {#sub %1;#additem doors %1} "System|Automapper"
#TRIGGER {~(D~)(%w)} {#sub %1;#additem doors %1} "System|Automapper"

Now, what SHOULD happen, is that for every door, it adds the direction to the doors list variable, and removes the door indication, then when it gets to the prompt, it adds the doors on the map. It works, some of the time, but occassionally I'll get a line like this:
[Exits: north (D)east south (D)west]
and it produces output similar to this:
[Exits: north east south west
#additem doors west]

Any suggestions?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Aug 15, 2002 3:18 am   
 
Try using the direction wildcard %t, this should eliminate the possibility of the ] being included in the in captured word. Also as a general rule any time %1..%99 is not being used for a number it should be enclosed in quotes to prevent script confusions like you are seeing.

One fine point you do not need the second #WHILE loop in your prompt trigger, as %pop deletes the items as it goes. Also if it ever failed to do so you would have an infinite loop and would be unhappy.
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Thu Aug 15, 2002 4:05 am   
 
The second #while loop executes if mapping is turned off, and just clears the list variable.

They'll never BOTH execute.

And I'll try your recommendations as soon as my mud comes back online. *twiddle*

AzCowboy
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Thu Aug 15, 2002 4:21 am   
 
I tested it offline, and it still doesn't work with %t ended up with 4 triggers like this:

#TRIGGER {~(O~)(east)} {#sub "%1";#additem doors "%1"} "System|Automapper"

now it works... not very elegant, though. Ah, well.. I guess I've kludged worse.

AzCowboy
Reply with quote
AzCowboy
Adept


Joined: 09 Nov 2000
Posts: 222
Location: USA

PostPosted: Thu Aug 15, 2002 4:23 am   
 
Actually:

#TRIGGER {~(?~)(east)} {#sub "%1";#additem doors "%1"} "System|Automapper"

so that the same four triggers match open or closed doors.

Now, if my mud would just come back up. *sigh* Wish I had the admins phone #, I'd call him up and whine.

AzCowboy
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