|
jmlester Newbie
Joined: 30 Jun 2007 Posts: 4
|
Posted: Fri Jul 06, 2007 3:03 pm
Variable name manipulation |
Is it possible to dynamically generate the name of a variable?
For example, I have a string list called "MendingHeadCureList." I actually have lots of variables with "_ _ CureList." I want to be able to use the name of the variable in an alias, but have it generated based on input.
I have an alias "resetSalve." I want to be able to pass it the first and second word of the variable i'm trying to reset. For example:
resetSalve mending head
In the alias, I want it to access the MendingHeadCureList variable. So far I have tried:
@%1%2CureList
@%concat(%1,%2,CureList)
These all give me the literal string "@MendingHeadCureList" but I want to be able to access that variable.
Any hints? |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Jul 06, 2007 3:50 pm |
@{%concat(%1,%2,CureList)}
SHOULD be what you are looking for. I'm a zombie today so if it does not work just post again.
If you mean that you want to set the value to something.
#var (%concat(%1,%2,CureList)) {whatever} |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
jmlester Newbie
Joined: 30 Jun 2007 Posts: 4
|
Posted: Fri Jul 06, 2007 3:57 pm |
That worked... thanks!
|
|
|
|
Thinjon100 Apprentice
Joined: 12 Jul 2004 Posts: 190 Location: Canada
|
Posted: Fri Jul 06, 2007 6:17 pm |
Don't forget you can always use #EXEC, too...
$varname = %concat(%1,%2,"CureList")
#EXEC %concat("#VAR ",$varname," {",$value,"}") |
|
_________________ If you're ever around Aardwolf, I'm that invisible guy you can never see. Wizi ftw! :) |
|
|
|
|
|