|
cosine_omerta Wanderer
Joined: 14 Oct 2007 Posts: 50
|
Posted: Sun Dec 14, 2008 8:42 am
Communicating aliases |
I'm always telling people the directions on how to get somewhere with cut and paste. I was curious if there is a way to set up something that would send and alias or a path to the mud in a tell or in a mud say?
Any suggestions are starting points on something of this sort would be helpful. Thanks. |
|
Last edited by cosine_omerta on Tue Dec 16, 2008 5:19 am; edited 1 time in total |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Dec 15, 2008 2:42 pm |
It should be possible, but the first thing we will need to know is where you are trying to get this path from. Is it stored in a variable? extracted from the map? What are you currently cutting and pasting from?
|
|
|
|
cosine_omerta Wanderer
Joined: 14 Oct 2007 Posts: 50
|
Posted: Tue Dec 16, 2008 5:17 am |
I cut and paste from aliases and paths.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Dec 16, 2008 3:32 pm |
Curious, there doesn't seem to be a function to return a named path as a string. I thought that %pathexpand() would work on a named path, but apparently it doesn't. Anyone else have any ideas on that?
Here is some code I use to reformat paths to a readable format. It might be useful to you.
Code: |
<func name="pathtodirlist" id="48">
<value>#local $newlist
#forall %1 {
#switch (%i)
("l") {$newlist = %additem("se", $newlist)}
("j") {$newlist = %additem("ne", $newlist)}
("k") {$newlist = %additem("sw", $newlist)}
("h") {$newlist = %additem("nw", $newlist)}
{$newlist = %additem(%i, $newlist)}
}
#return $newlist</value>
</func>
<var name="pathtodir" id="37">%expandlist(@pathtodirlist(%pathexpand(%1)),",")</var>
|
This code defines a function, @pathtodir(), which reformats a path to a comma separated list:
Quote: |
#show @pathtodir(".w2l3j(enter town)")
> w,se,se,ne,ne,ne,enter town
|
|
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Tue Dec 16, 2008 6:12 pm |
cosine_omerta
May be you'll be able to do what you want with Lua? Personally I do not want to learn Lua, so I can't be of much help here.
id=zs.func.prompt("Path ID?")
path=zs.getpath(id)
print(path)
pathvalue=path.value
print(pathvalue)
zs.cmd.send("tell Someone You should go "..pathvalue) |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Dec 17, 2008 5:39 pm |
You can use the %alias function to grab the data from either a path or alias. A simple alias to handle it would be
Code: |
#ALIAS ptell($Name) {$Data=%alias($Person,$Name)
#IF ($Data) {
$Exp=%pathexpand($Data)
#IF ($Exp!=$Data) {tell $Person path $Name is $Exp} {#SHOW {Path $Name didn't expand properly}}
} {
#SHOW {No aliases or paths named $Name}
}} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Dec 17, 2008 6:20 pm |
Ah, good, %alias(). Note that %pathexpand will not translate cmud's 1-letter directions into readable directions, e.g., k to sw. You can modify my functions above to do the translation you need.
|
|
|
|
|
|