|
Hronden Newbie
Joined: 25 Jan 2010 Posts: 7
|
Posted: Wed Feb 17, 2010 5:12 am
Multi Line Variable defined by alias |
This one should be fairly easy, I am trying to set up an alias that defines a variable with multiple commands. When I cast a spell I want to store it in a variable for access to recast if it fails. So far it works unless I want multiple commands in the variable. My alias looks something like this:
Alias sanc
wield staff
weave 'sanctuary' %1
wield 1.
#var /recast/lastspell {wield staff;weave 'sanctuary' %1;wield 1.}
but @lastspell pulls up wield staff;weave 'sanctuary' %1;wield 1.
instead of the following which I am trying to accomplish
wield staff
weave 'sanctuary' %1
wield 1.
I'm sure there is an easy answer, but I'll appreciate it just as much as a complicated one.
Thanks
Hronden |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Feb 17, 2010 6:09 am |
I assume you're looking for a stringlist, so just replace ; with |. You will then have to refer to the element you want, ie, %item(@lastspell,1).
If you just want to send those commands to the game, just keep it as-is. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Hronden Newbie
Joined: 25 Jan 2010 Posts: 7
|
Posted: Wed Feb 17, 2010 12:06 pm |
I thought that would work as well, but when I put my input like this:
#var /recast/lastspell {wield staff|weave 'sanctuary' %1|wield 1.}
My output is
wield staff|weave 'sanctuary' self|wield 1.
It doesn't break it into separate commands to the mud when I use @lastspell to fire the variable, and maybe that is the problem, should I be using a different command to fire the variable? |
|
|
|
Hronden Newbie
Joined: 25 Jan 2010 Posts: 7
|
Posted: Wed Feb 17, 2010 12:42 pm |
Quick update on this, I did use the stringlist and then set my trigger to pull commands 1-7 in order, can you give me a hand with writing an if statement that will keep the trigger from sending an empty command to the mud if less than 7 commands were input to the variable? So far what I have is
#if (%item(@lastspell,2) {%item(@lastspell,2}
this is based on the example from the help file that if the argument was nonzero it would execute the command |
|
|
|
Hronden Newbie
Joined: 25 Jan 2010 Posts: 7
|
Posted: Wed Feb 17, 2010 12:54 pm |
Once again I solved my own problem, had a few out of place parenthesis. If anyone is curious it looks like this.
#if (%item(@lastspell,2)) {%item(@lastspell,2)} |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Feb 17, 2010 2:20 pm |
A better solution would be:
Code: |
#forall @lastspell {#send %i} |
Just a note, in your code you have %item(@lastspell,2) as the first word in a commandline (in the TRUE value of the #if). This is not a good idea in Cmud, and can cause errors. A function or variable starting with % should not be used as a command. Instead, precede it with #send, #call, #exec, or something else appropriate. |
|
|
|
|
|