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
Sir Runsalot
Beginner


Joined: 18 May 2002
Posts: 20

PostPosted: Fri Feb 14, 2003 11:09 am   

How to expand a path ?!
 
I wish to exapand a path to work with it
programatically. How do I do this ? I am going crazy trying to find a solution to this simple problem, PLEASE HELP!

(I.e what I want to do is for example
%expandpath(peppers) where peppers is a path I saved earlier)

/Sir Runsalot
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Feb 14, 2003 12:30 pm   
 
Use %exec:
#SH %exec(.peppers)

Notice that the path is returned in stringlist form.

Kjata
Reply with quote
Sir Runsalot
Beginner


Joined: 18 May 2002
Posts: 20

PostPosted: Fri Feb 14, 2003 1:44 pm   
 
Thank you thank you thank you.

This will simplify things a lot. :)
Reply with quote
pcghost2k
Newbie


Joined: 24 Feb 2003
Posts: 5
Location: USA

PostPosted: Sun Jul 27, 2003 2:24 am   
 
> #SH %exec(.peppers)

okay, this is the key to my current scripting scenario, but how do I expand a variable in place of "peppers"?

Example:

#trigger {&player tells you to visit area (*).} {
#var location %1
#show @{player}'s DIRs are: %exec(.@location}
}

yes, I realize (at least for the example above) that I could just use %1 throughout the #trigger, or perhaps even use "&%*{location}" instead if it might contain a semi-colon, but there are other places I want to use the %exec(.@location) scenario, like on the command-line:

#SHOW PATH: %exec(.@location)

if @location contains an area "name", for example, the above command does not expand @location at all, but treats it as a literal string. Instead, it should expand its value:

%exec(.@location)
would be translated, on the fly, to
%exec(.The Temple of Jello)
if @location, indeed, had the value of "The Temple of Jello".

Thanks for any suggestions...
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jul 27, 2003 5:12 pm   
 
I have no problem with making %exec expand a variable. Perhaps you can try forcing expansion:
#EXEC {%concat("#SH %exec(.", @location, ")")}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jul 27, 2003 5:49 pm   
 
I would suggest you use the %defined function to determine if the contents of @location are actually a stored path. If they are not then you should use one of the room finding scripts in the forums and %walk to get a valid path.
Reply with quote
pcghost2k
Newbie


Joined: 24 Feb 2003
Posts: 5
Location: USA

PostPosted: Mon Jul 28, 2003 2:42 pm   
 
THANKS, Kjata! worked like a charm with some minor editing:
[ so that all the | are replaced by ; ]
#EXEC {%concat("#SH %replace(%exec(.", @location, ")"),"|","`;")}

thanks, too, go out to Vijilante, for your reply... not that I exactly understand it, but thanks just the same. *wry smile*
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