Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: 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
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: 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
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Wed Dec 14, 2005 9:25 pm   
 
Try this one
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=21238&highlight=spellup
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: 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.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Dec 15, 2005 1:18 pm   
 
%-1 means everything after the last part if more than one word.

spellup vitae
would be %1

spellup vitae bloodbane
would be %-1

Edit:
Better explanation:
http://forums.zuggsoft.com/phpbb/viewtopic.php?p=88244&highlight=#88244
and the one below it
_________________
http://www.Aardwolf.com
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net