Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Urit
Novice


Joined: 23 Jun 2005
Posts: 32

PostPosted: Mon Oct 18, 2010 2:20 am   

Feature Request: %roomCoords([roomid],x,y,z)
 
I'd like to request a new room function: %roomcoords(roomid,x,y,z)

Leave any field blank to leave the coords unchanged.

Right now the IRE muds pass back room coords in the GMCP output, and I use a custom SQL script to write those to the map DB. I'd like to do this in a supported manner.

This would also immediately update the map view (unlike my custom script does - I have to manually reload the map).

For reference, my script looks like:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="read-map" copy="yes">
    <value>#sqldb Midkemia.dbm
Data = %sql( Midkemia, "SELECT RefNum, X, Y, Z, UserStr FROM ObjectTbl WHERE Deleted = 'N' AND UserInt != 1 AND UserStr NOT LIKE '%Coordinates|%'  AND UserStr LIKE '%Coordinates%' ORDER BY ZoneID,RefNum")
UserCoords = %null
#echo Reading Data.
#WHILE (!@Data.Eof()) {
  $data = @Data.Item("UserStr")
  #addkey UserCoords {@Data.Item("RefNum")} {%db( $data, "Coordinates")}
  #CALL @Data.Next
  }
#echo Data read complete.
Data = %sql( Midkemia, "SELECT RefNum, X, Y, Z, UserStr FROM ObjectTbl WHERE Deleted = 'N' AND UserInt != 1 AND UserStr NOT LIKE '%Coordinates|%'  AND UserStr LIKE '%Coordinates%' ORDER BY ZoneID,RefNum")</value>
  </alias>
  <alias name="write-coords" copy="yes">
    <value>#echo Writing room coords to SQL.
#loopdb @userCoords {
  $roomnum = %key
  $x = (%word( %val, 2, ",")*240)
  $y = (%word( %val, 3, ",")*-240)
  $z = (%word( %val, 4, ","))
  $sqlCmd = %concat( "SELECT refnum, x, y, z, UserStr, UserInt FROM ObjectTbl WHERE refnum = ", %key)
  $Data = %sql( Midkemia, $sqlCmd)
  #CALL $Data.Edit
  $Data.Item("X") := $x
  $Data.Item("Y") := $y
  $Data.Item("Z") := $z
  $Data.Item("UserInt") := 1
  #CALL $Data.Post
  }
#echo Done writing room coords to SQL.</value>
  </alias>
</cmud>


The roomnotes I make are like:
Coordinates=63,-1,-4,-1|Area=the town of Margrave's Port|Environment=urban|Details=""
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Oct 18, 2010 3:54 am   
 
Any reason you're not using %roomnote() and/or %roomflags()? The former references the Room Notes field, which appears underneath the Room Description textarea in the Room Properties. The latter references the UserStr field, and for all intents and purposes is %roomnote() part 2.
_________________
EDIT: I didn't like my old signature
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Mon Oct 18, 2010 5:12 pm   
 
You can already access and change the X,Y,Z values using the COM-based mapper scripting that is part of CMUDPro.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Oct 18, 2010 10:19 pm   
 
Aren't those the room-drawing coordinates? I don't think he is interested in those, so much as an easier way to record the arbitrary numbering system used by MUDs to determine where a room is located.
_________________
EDIT: I didn't like my old signature
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Tue Oct 19, 2010 12:35 am   
 
Oh, sorry, yes I misunderstood. If he just wants to record some arbitrary data from the MUD, then using the %roomflags to store a string value (which could be a database variable or string list) would be the way to go.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Tue Oct 19, 2010 2:20 am   
 
I would say he's already using the roomflags field. His script copies the X, Y, Z coordinates he has stored in the roomflags/userstr field into the actual room-drawing coordinates. He was looking for a way to access those coordinates "natively" without having to use SQL... At least, that's my interpretation :P
Reply with quote
Urit
Novice


Joined: 23 Jun 2005
Posts: 32

PostPosted: Tue Oct 19, 2010 3:44 am   
 
I DO actually want to set the Mapper DRAWING coordinates, yes. That's exactly what I am doing with my ghetto SQL script. I'm using the MUD's coords to set the drawing coords.

I wasn't aware of a magical COM script way of doing this.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Tue Oct 19, 2010 5:17 pm   
 
Download the zMapper program from the Downloads page and there is an old *.HLP help file with it. There is an advanced topic in the help file that explains the COM-based mapper scripting stuff. This scripting is available within CMUDPro, or within CMUD if you buy zMapper. If you use CMUDPro and don't buy zMapper, be sure and delete the zMapper.exe file so that CMUDPro doesn't try to check for a zMapper license (which would expire after the 30-day zMapper trial).

Eventually I'll try to get this documentation moved into the CMUDPro help files.

But it is by-design that most advanced mapper stuff requires either CMUDPro or zMapper.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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