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


Joined: 12 Oct 2000
Posts: 32
Location: USA

PostPosted: Mon Dec 23, 2002 4:52 pm   

Mapping via scripts and area file reading
 
After numerous headaches trying to get #TAG working to recognize a simple Vnum in a line between the room name and exits, as it would keep stalling on me, search for previous posts if interested.

Thus, this prompted me to take a different approach to the problem, a complete disregard for the mapper's autoconfiguration and use Zmud's scripting capabilities to read the area files and convert them to maps. So far, this method has worked out fairly well, however I've run into a minor annoyance. Is it possible to easily create one-way links, or toggle the locked settings via the %roomlink command or any other hidden feature? Since %roomlink insists on continuously making 2 way links when specified with a destination, I've drafted a one-way link method that goes something like this:

Prior to making the link, check the reverse exit of the destination room to see if there's a link in the reverse direction to our origin. If there isn't then when creating
the link from a to b, after the link is created delete the reverse direction of b, which should erase the most recent link, this disconnects a, and makes it loop back to itself, then relink a to b, which produces a 1-way link.

Alternatively, I just realized I could link a to itself, delete the reverse direction link, creating the a->a link in my target direction and relink that.

Apparently deleting the reverse direction doesn't work as it eliminates the link that's first created, so it looks like it's back to the drawing board. An alternative is deleting all the links from an exit and storing them in a list but that gets messy if I need to relink the old links and have them be one way.

I was also wondering if the mapper is capable of doing the following things, via scripting:
Creating/Deleting a zone
Deleting a room
Changing x,y,z coordinates of a room
Deleting a room description/name, closest thing I can get is a space as passing %null as the second argument ends up displaying it instead.
Deleting Doors, Toggling 'locked' state of doors

I'm open to solutions involving COM object manipulation of the mapper as I'm eager to learn and my eventual goal is to be able to create a system that can essentially read the area file, cluster rooms together, and move things to the right level as currently, it creates a block of rooms, 10 per row and I have to manually rearrange the rooms to make things appear correctly.

I've also noticed the following bug, or outdated help file, when manipulating files
it appears to use the same working dir as the mapper to look for its files as opposed
to reading from the same initial dir as the Zmud executable. Only if the mapper has been unopened on that run of Zmud will it use the same dir as the Zmud executable, once the mapper has been opened Zmud will use that dir to look for files.

One other odd quirk I noticed was when trying to recognize the ~ in an area file, designating the end of a string. Any idea why the following snip wouldn't work?

#WHILE (%left( @line, 1) != ~~) {
#SH @line_num : @line
#SH %if( %left( @line, 1) != ~~, true, false)
#ADD line_num 1
#VAR line %read( 1, @line_num)
}
Sample output:
466 : room description
true
467 : room description
true
468 : ~
false
469 : 0 0 2
true

It seems to completely ignore that I've exited the loop, the only thing I could think of is that the tilde is being applied to a potential crlf. I've tried encapsulating the ~ in {} and "" to no avail. As a quickfix, I just changed the quote character to an odd character.

-Phazic
zMapper 1.15/zMUD 6.40 on WinXP
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Dec 24, 2002 12:00 am   
 
Lasts things first. Use %quote(@line) or %expand(@line,1). Currently when @line gets expanded it then expands the ~ and its next character out which is causing the tilde to get lost.

On to mapping:
Creating a zone by script would have to be done by the menu command and require user input.

Deleteing a room is a similar situation. I would suggest you just set aside rooms that need to be deleted then when they have accumulated to a sufficient number have your script delete them, again you will have to hit yes on a dialog.

XYZ coordinate of rooms can be changed since you have zMapper. Reading the help file for zMapper explains the necessary things. Keep in mind that the value for X&Y is in pixels, default spread plus room width appears to be 140. For Z it matches level number. Example codes that changes Z of room then changes it back after 10 seconds: "#VAR StoredZ %map.curroom.z;#VAR %map.curroom.z {1};#CALL %map.curroom.update;#ALARM {+10} {#VAR %curroom.z @StoredZ;#CALL %curroom.update}" Note that %curroom is predefined to match %map.curroom.

Doors and the locked state can be set by the KindID property of the link. The help file also says setting OneWay to true will automattically delete the reverse exit. An example doing this would be: "#VAR TargLink %curroom.ExitDir(h);#VAR TargLink.OneWay 1;#CALL @TargLink.Update;#UNVAR TargLink"

It appears there may be some problems with these examples. First thing you should make sure on your scripts is that you are in map mode or have set %maplocked to 0. If there are further problems make sure you post to the beta forum so they can be fixed for the next public version.
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