|
Sir Runsalot Beginner
Joined: 18 May 2002 Posts: 20
|
Posted: 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 |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Feb 14, 2003 12:30 pm |
Use %exec:
#SH %exec(.peppers)
Notice that the path is returned in stringlist form.
Kjata |
|
|
|
Sir Runsalot Beginner
Joined: 18 May 2002 Posts: 20
|
Posted: Fri Feb 14, 2003 1:44 pm |
Thank you thank you thank you.
This will simplify things a lot. :) |
|
|
|
pcghost2k Newbie
Joined: 24 Feb 2003 Posts: 5 Location: USA
|
Posted: 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... |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: 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, ")")} |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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.
|
|
|
|
pcghost2k Newbie
Joined: 24 Feb 2003 Posts: 5 Location: USA
|
Posted: 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* |
|
|
|
|
|