|
Telos Newbie
Joined: 18 Mar 2004 Posts: 9 Location: USA
|
Posted: Thu Mar 18, 2004 10:20 am
Multiple arguments to alias |
Ok, the casting syntax for my mud is:
cast 'spell name' target
target is optional sometimes, and some spells won't even allow you to use a target (self only spells)
I'm trying to set up a couple aliases so that I can cast a spell, and record which spell I cast in a list. Here's what I have now:
trigger name: scast
cast %1 %2
memList=%addItem( %1, @memList)
trigger name: cc
scast 'cure critical' %1
The problem is that scast is only getting 'cure critical' and not getting the target.
So how can I make it work? I haven't worked on this in a while, but I had tried a few things in the past. There doesn't seem to be a way to get what's between the single quotes as one argument, and what's after the quotes as the next. Spell names are a variable number of words also (ie. natures blessing, barkskin, protection from animals) |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Mar 18, 2004 12:39 pm |
You can use %-1 to signify everything that comes after the alias' name. %-2 is everything after the first parameter, and so on. With this in mind, instead of doing:
cast %1 %2
you should do:
cast %-1 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Mar 18, 2004 7:24 pm |
Use a trigger to record the spells you cast. By the way, the settings you describe are aliases, not triggers. Aliases have "names". Triggers have "patterns".
Trigger pattern: cast '(*)'
memList = %additem( %1, @memList) |
|
|
|
Telos Newbie
Joined: 18 Mar 2004 Posts: 9 Location: USA
|
Posted: Thu Mar 18, 2004 7:34 pm |
Ah, but then how tdo I extract the spell name in order to store it? If I just use %-1, or the trigger version I'll end up storing both the spell name AND the target in my list... which will not be good.
So I still need some way to break up the argument list based on those single quotes... |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu Mar 18, 2004 8:06 pm |
Why are you trying to make this difficult? Use an alias to cast and a trigger to store. There's no need for both actions to be taken by the same setting.
Alias name: scast
cast %-1
Trigger pattern: cast '(*)'
memList = %additem( %1, @memList) |
|
|
|
Telos Newbie
Joined: 18 Mar 2004 Posts: 9 Location: USA
|
Posted: Fri Mar 19, 2004 12:20 am |
My bad, read that wrong this morning. Thanks for the help, it works fine now. :)
|
|
|
|
|
|