|
ToyMage Apprentice
Joined: 01 Sep 2005 Posts: 120
|
Posted: Wed Dec 14, 2005 3:00 am
Spellup Failure recast |
Its me again!!
Another problem.
#VAR SpellList {armor|shield|sanctuary}
#FORALL @SpellList {Cast ~"%i~"}
My mud uses a common phrase for failing a spell. So I’m having problem configuring a trigger that re-cast the failed spell.
#TR {You lost your concentration.} { ??? }
Can anyone solve this?
Toy |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Dec 14, 2005 9:03 am |
Don't use #FORALL. Use an index variable that you increment on each success, and retry on each failure.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
ToyMage Apprentice
Joined: 01 Sep 2005 Posts: 120
|
Posted: Wed Dec 14, 2005 9:54 am |
Stumped... How do I use a "index variable"?
Success
"You feel someone protecting you."
"You are surrounded by a force field."
"You are surronded by a white aura."
Failure
"You lost your concentration."
Toy |
|
|
|
Slaem Apprentice
Joined: 20 Sep 2005 Posts: 135
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Dec 14, 2005 11:32 pm |
The short of it...
Code: |
#CLASS Spellup
#VARIABLE SuccessfulCasts {You feel someone protecting you|You are surrounded by a force field|You are surronded by a white aura}
#VAR SpellList {armor|shield|sanctuary}
#VAR SpellIndex {1} {1}
#VAR SpellTarget {} {}
#TRIGGER {^{@SuccessfulCasts}.$} {#ADD SpellIndex 1;#IF (@SpellIndex<=%numitems(@SpellList)) {cast '%item(@SpellList,@SpellIndex)' %if(@SpellTarget,@SpellTarget)} {SpellIndex=1}}
#TR {You lost your concentration.} {cast '%item(@SpellList,@SpellIndex)' %if(@SpellTarget,@SpellTarget)}
#ALIAS SpellUp {SpellIndex=1;SpellTarget="%-1";cast '%item(@SpellList,@SpellIndex)' %if(@SpellTarget,@SpellTarget)}
#CLASS 0 |
Sorry I didn't have time to write this up this morning. As with all my scripts, this is written off the top of my head with no testing. Siply copy and paste into the command line and if I didn't make a mistake all will be well. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
ToyMage Apprentice
Joined: 01 Sep 2005 Posts: 120
|
Posted: Thu Dec 15, 2005 9:03 am |
Hi,
I was reading through the code, but I don't understand what does "SpellTarget="%-1" do?
#ALIAS SpellUp {SpellIndex=1;SpellTarget="%-1";cast '%item(@SpellList,@SpellIndex)' %if(@SpellTarget,@SpellTarget)}
What is "%-1"???
Thanks. |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
|
|
|
|
|