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
Zwartje
Novice


Joined: 08 Feb 2007
Posts: 45

PostPosted: Wed May 02, 2007 10:24 pm   

using variables in pathnames
 
I cannot figure out how to do this, any advice welcome.

I have a defined path:
Name: path1
Value: 5ej2e

Now I want to dinamically run this path using a variable:
Name: runpath
Value:
#VAR varpath %concat(.,path,%1)
#send (@varpath)

This doesnt work however.
What I want is that when I use 'runpath 1' CMUD sends .5ej2e to the mud

I also tried
.{@varpath}
#exec @varpath

to no avail
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu May 03, 2007 3:03 am   
 
paths can be named. No need for a variable, just #send .mypath or whatever is the proper method (not sure if paths will expand in a #SEND, but they should).
_________________
EDIT: I didn't like my old signature
Reply with quote
Zwartje
Novice


Joined: 08 Feb 2007
Posts: 45

PostPosted: Thu May 03, 2007 7:13 am   
 
Thanks for the answer MattLofton, but its not entirely what I am looking for.

The idea is that I could dynamically call a path.

Now I only have path1, but the purpose is to have many more, path2, path3, ...

I could of course put a
#switch (%1=1) {.path1} (%1=2) {.path2} ...

but I hoped for another way
Reply with quote
Zwartje
Novice


Joined: 08 Feb 2007
Posts: 45

PostPosted: Fri May 04, 2007 4:24 pm   
 
Bump!

Anyone has an idea how to do it?

I found a topic on the zmud forum about this, but the options provided there do not work in CMUD it seems
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=8986&start=0&postdays=0&postorder=asc&highlight=variable+path
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri May 04, 2007 5:03 pm   
 
$path=%concat(%exec(.path1),%exec(.%1))
#forall $path {#send %i}

This is untested as I am at work. Also I am not sure exactly what you want. I haven't read the other thread.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


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

PostPosted: Fri May 04, 2007 5:25 pm   
 
This worked for me:

Code:
#PATH path1 {.5ej2e}
#alias runpath {#EXEC %concat(".",%1)}
runpath path1

You need to make sure you have the English Directions package loaded. If you just try to test this in the default "untitled" session, it won't work because English Directions isn't loaded. But if you create a new session that has English Directions in the list of loaded packages, then it works fine.
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