|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: 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 |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: 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 |
|
|
|
Santel Novice
Joined: 07 Feb 2003 Posts: 32
|
Posted: 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 |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: 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 |
|
|
|
|
|