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


Joined: 31 Dec 2002
Posts: 41
Location: USA

PostPosted: Tue Feb 11, 2003 6:24 pm   

help mapping doors
 
this is a sample output from my mud

< 69H 34M 68F 40293G 5768X > n
A Quiet Clearing

You are standing in the middle of a little clearing surrounded by large trees. You notice that most of the trees in this section of the forest are larger than normal. One of the trees is the largest you seen yet, it looks as if it could hold a city in its branches. A small path leads south out of the clearing and another winds to the west towards a small building.

Exits: South West Up[trapdoor]


< 69H 34M 66F 40293G 5768X >


Green in exits are names of door
i need help setting up a script to capture the door name like this trapdoor headed up
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Feb 11, 2003 11:42 pm   
 
#TR {^Exits: (*)$} {#VAR ExitLine {%replace("%1","[","|")};#IF (%version<653) {#ALARM {+1} {onroomcreate}}}
#ALIAS onroomcreate {#LOOP 1,%numwords(@ExitLine) {#IF (%item(%word(@ExitLine,%i),2)) {#DOOR %item(%word(@ExitLine,%i),1) %leftback(%item(%word(@ExitLine,%i),1),1)}}}

This captures the exit information, then when the mapper has finished making the room the door is added. I think the onroomcreate was added in a beta version after 6.40, but last I heard Zugg planned to have another public release soon, hence the version check in the trigger.
Reply with quote
theoldone
Novice


Joined: 31 Dec 2002
Posts: 41
Location: USA

PostPosted: Wed Feb 19, 2003 8:32 pm   
 
The trigger sets the doors in the right place but gives them the wrong name

my firest post would get a door named "u"
one to the west would be named "wes"
north would be "nort"
Reply with quote
Santel
Novice


Joined: 07 Feb 2003
Posts: 32

PostPosted: Wed Feb 19, 2003 11:19 pm   
 
Take a look at the scrip i got a lot of help writing for RoD in the zMud Scripts Forum. It's Called RoD Add door to mapper.
Reply with quote
theoldone
Novice


Joined: 31 Dec 2002
Posts: 41
Location: USA

PostPosted: Thu Feb 20, 2003 12:59 am   
 
Very nice
I don't understand how theese 2 differnt scrpits work but it looks like it would look at "trapdoor" as a door and the exit dir not as the door headed up

I can't connect to the mud to test them for about the next 2 weeks
quote:
RoD Exits description: Exits: [north] east [south] west
Where [] are doors

#var doordir ""
#var exitstring ""
#VAR exitstring %replace( "%1", "[", "/")
#VAR exitstring %replace( @exitstring, " ", "|")
#var i 1
#FORALL @exitstring {#add i 1}
#delnitem exitstring @i
#forall @exitstring {#if (%pos( "/", %i)>0) {} {#delitem exitstring %i}}
#var doordir %replace( @exitstring, "/", "")
#var doordir %replace( @doordir, "]", "")
#var doordir %replace( @doordir, "north", "n")
#var doordir %replace( @doordir, "south", "s")
#var doordir %replace( @doordir, "east", "e")
#var doordir %replace( @doordir, "west", "w")
#var doordir %replace( @doordir, "northwest", "nw")
#var doordir %replace( @doordir, "northeast", "ne")
#var doordir %replace( @doordir, "southwest", "sw")
#var doordir %replace( @doordir, "southeast", "se")
#if (@doordir = "") {} {#alarm {+0.5} {#forall @doordir {#door %i}}}

The last line with the #alarm code is needed due to the fact that zmud moves a lot faster than the mapper. With no alarm code you would get doors from the room you are entering into the room from where you left. You might have to adjust the time but 0.5sec is good for me.

Santel
Realms of Despair
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Feb 20, 2003 4:54 am   
 
quote:
my firest post would get a door named "u"
one to the west would be named "wes"
north would be "nort"

Obviously, the script is deleting the last character from each direction. Since this isn't what you want, you probably shouldn't use the %leftback function.
#AL onroomcreate {#LOOP 1,%numwords( @ExitLine) {#IF (%item( %word( @ExitLine, %i), 2)) {#DOOR %item( %word( @ExitLine, %i), 1) %item( %word( @ExitLine, %i), 1)}}}

LightBulb
Advanced Member
Reply with quote
theoldone
Novice


Joined: 31 Dec 2002
Posts: 41
Location: USA

PostPosted: Fri Feb 21, 2003 4:15 am   
 
without the %leftback the door in named up and not trapdoor
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Feb 21, 2003 8:45 am   
 
Yes, and with %leftback it's named u and not trapdoor.

When you complained that up came out as "u", west as "wes", and north as "nort", I thought you wanted the directions spelled out correctly. Had you mentioned at the time that you wanted "trapdoor" (or other door name) instead, you'd have probably saved some time.

The latest modification to Vijilante's script. This is probably how he intended it in the first place.

#TR {^Exits: (*)$} {#VAR ExitLine {%replace("%1","[","|")};#IF (%version<653) {#ALARM {+1} {onroomcreate}}}
#ALIAS onroomcreate {#LOOP 1,%numwords(@ExitLine) {#IF (%item(%word(@ExitLine,%i),2)) {#DOOR %item(%word(@ExitLine,%i),1) %leftback(%item(%word(@ExitLine,%i),2),1)}}}

LightBulb
Advanced Member
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Feb 21, 2003 12:10 pm   
 
Yep, nobody is perfect.
Reply with quote
theoldone
Novice


Joined: 31 Dec 2002
Posts: 41
Location: USA

PostPosted: Fri Feb 21, 2003 4:47 pm   
 
Your right LightBulb, I should have mentioned. I will test thid new script next time i can.
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