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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Sun Nov 03, 2013 3:11 pm   

Distance between rooms on map.
 
Hi again everyone,

Trying to work out a way for the map to return the distance between two different rooms (or from my current location to a list of rooms), returned as a number of steps.
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Sun Nov 03, 2013 3:14 pm   
 
The reason for this is so I can workout where the closest healer is to me from wherever I am on the map. The quick get around would be to give all healers on the MUD the same room nickname/shortcut and let the mapper work out what is closest, however this would cause certain problems for various unrelated reasons.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 03, 2013 6:15 pm   
 
Check out %pathfrom().
_________________
EDIT: I didn't like my old signature
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Tue Nov 05, 2013 7:23 pm   
 
Yeah, trying out a few methods.

With that method I would need to get the pathfrom, expand it, and then count the ";" to see how many steps.

I just made an alias that changes all the room IDs of the healers to "healer" and hoped that a simple #WALK would go to closest one, aparently it doesnt... just picks a random one to travel to... odd!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4548
Location: Pensacola, FL, USA

PostPosted: Tue Nov 05, 2013 9:39 pm   
 
%numitems(%pathexpand(%pathfrom(, there)))
_________________
Discord: Shalimar#3679
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Nov 08, 2013 7:46 am   
 
Keep in mind that any extra commands (open door, unlock door, etc) will be counted as a "step", too, so you may find:

Nearest healer:
unw2nwnd

2nd nearest:
open d;d;open w;w;open n;n;open n;2n

In reality, the second is actually shorter (dw3n), but because of the open doors, it'll count them as steps and seem longer.
Reply with quote
clk4suport
Newbie


Joined: 21 Nov 2013
Posts: 8
Location: NOida

PostPosted: Tue Dec 17, 2013 12:49 pm   
 
Hi there,

okay :)
Reply with quote
teion
Wanderer


Joined: 03 May 2005
Posts: 71

PostPosted: Wed Jan 08, 2014 7:47 pm   
 
Anyone have an idea on this? I play on the same mud as Scarn and I have a list of rooms in a string variable called healers

healers - 22754,34454 etc etc

I want to cmud calculate the distance to all the rooms in the variable and save the lowest three to 3 aliases - heal1, heal2, heal3


I'm not exactly sure how to make cmud do the math for this. Somone mentioned using the pathfrom command. so maybe i could use that in a loop to calculate steps and then save the lowest ones.
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Mon Feb 03, 2014 3:21 pm   
 
I figured it out Teion, I'll give you a shout on the MUD to help you.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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