sj
Joined: 22 Jan 2012 Posts: 16 Location: Manchester, England
|
Posted: Wed Jul 25, 2012 11:56 am Post subject: Variables in macros |
|
|
Hi, I'm trying to do the following:
| Code: |
#var {keybind} {
{1} {Harm}
{2} {Magic Missile}
{3} {Trip}
{4} {Bash}
{\eOu} {North}
{\eOs} {East}
{\eOr} {South}
{\eOq} {West}
{\eOy} {Up}
{\eOv} {Down}
}
#alias {RemoveKeybinds} {
#foreach {$keybind[]} {index} {
#unmacro {$index}
}
}
#alias {AddKeybinds} {
#foreach {$keybind[]} {index} {
#macro {$index} {$keybind[$index]}
}
}
#alias {tt} {
#format {length} {%L} {%1};
#if {$length == 0} {
#var {target} {Nobody};
RemoveKeybinds;
};
#else {
#format {target} {%n} {%0};
AddKeybinds;
};
UpdateStatus;
}
|
But the result is the following:
| Code: |
#MACRO {\eOq}={$keybind[$index]}
#MACRO {\eOr}={$keybind[$index]}
#MACRO {\eOs}={$keybind[$index]}
#MACRO {\eOu}={$keybind[$index]}
#MACRO {\eOv}={$keybind[$index]}
#MACRO {\eOy}={$keybind[$index]}
#MACRO {1}={$keybind[$index]}
#MACRO {2}={$keybind[$index]}
#MACRO {3}={$keybind[$index]}
#MACRO {4}={$keybind[$index]}
|
If I replace the #macro commands with #showme, the output is as I'd expect. |
|