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
Santel
Novice


Joined: 07 Feb 2003
Posts: 32

PostPosted: Sat Feb 08, 2003 4:30 pm   

Mapper - Add Doors
 
Here is my Exit desc:
Exits: [north] east west [southeast]

[] indicate that it is a door.

I want to automaticly create these doors in the mapper.

I tried this trigger and it works on rooms where there are only one door.
Exits:*~[&doordir~]
@doordir = direction

If i use this trigger in the exit example
Exits: [north] east west [southeast]
@doordir = southeast

I tried to add a second trigger (to caputre only the first [north])
Exits: ~[&doordir~]
@doordir = north] east west [southeast

Conclusion: Im a twat.
I can make it work with rooms that have only one door. Rooms with multiple doors i can not get to work.

Your help would be much appriciated.

Santel
Realms of Despair
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sat Feb 08, 2003 5:43 pm   
 
your problem is that a trigger will only fire once per line. I'm going to show you a solution similar to the one i posted for kaset, where we take the whole string and then cut out the parts we don't want:
#tr {Exits: (*)} {
#var doordir ""
#var exitstring ""
#VAR exitstring %replace( "%1", "[", "/")
#VAR exitstring %replace( @exitstring, " ", "|")
i = 1
#FORALL @exitstring {
#IF (%pos( "]", %i)) {
} {
#DELNITEM exitstring @i
}
#add i 1
}
doordir = %replace( @exitstring, "/", "")
doordir = %replace( @doordir, "]", "")
}

and the final variable @doordir should be a string list with the directions of the rooms that are doors.

--edit--
left out crucial part..the trigger pattern
--------

moon.icebound.net:9000
Reply with quote
Santel
Novice


Joined: 07 Feb 2003
Posts: 32

PostPosted: Sun Feb 09, 2003 2:53 pm   
 
Thanks Emit for your quick response, but it didnt work ;)
I had to change the #forall code to this one

#forall @exitstring {#if (%pos( "/", %i)>0) {} {#delitem exitstring %i}}

Zmud got confused by using
#DELNITEM exitstring @i in your #forall statement. It deleted wrong doors and some time it didnt delete the door it should delete.

So i went through your code (and all the help files i could find) and came up with the solution above.

Thanks for your time and effort

Best Regards

Santel
Realms of Despair
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sun Feb 09, 2003 4:49 pm   
 
yeah, i had some problems with that too, i thought it was stripping the []'s from the string, which is why i came up with the solution of replacing in the "/". i'm glad its working now at least

--------

moon.icebound.net:9000
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