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
Savi
Newbie


Joined: 12 Aug 2008
Posts: 2

PostPosted: Tue Aug 12, 2008 2:37 pm   

Help with spell cycle macro/script
 
Hi,

I thought that this would be the best place to ask, if its not please excuse the ignorance.

My question pertains to the cycling of spells in a macro. I currently play on a skill based mud so you gain adepts over time, I currently have three spells of the same level that I would like to rotate every time I gain an adept in the specific spell.

My thinking is that I need to define a variable that is changed through a trigger and then to use an if statement for the casting itself. The syntax on the mud itself are rather simple, casting: c 'spell name' and for skill improvement "You have become more adept in spell name"

My problem is as follows, I firstly have an idea where to start but thats not working and secondly I have no idea how to link the spell name from casting to the trigger.

In essence what I want to happen is that if I press my key it casts the same spell until I gain an adept at which point it moves to the next spell then repeat for the next spell and then when I gain an adept in the third spell got back to spell 1.

Any help would be greatly appreciated.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Tue Aug 12, 2008 2:43 pm   
 
We need some output from your MUD first and then we can start thinking. Right now I can only give general suggestions and burst out
different commands and I doubt it will help you much even more so as you don't have much idea about scripting under ZMud.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
Savi
Newbie


Joined: 12 Aug 2008
Posts: 2

PostPosted: Tue Aug 12, 2008 5:43 pm   
 
Well basically output from the mud is as follows:

c 'chill' p
Ok.
You chill a giant green parrot; remember to put flowers on his grave.
A giant green parrot is dead!
You gain 317 experience points.
You loot the corpse of its 20 coins.
Your blood freezes as you hear a giant green parrot's death cry.
You have become more adept at chill!

The two lines I'm specifically concerned with would be:

c 'chill' p to cast a spell at the target or just c 'chill' while in combat to target current mob; and
You have become more adept at chill! to trigger the rotation to the next spell.

I currently have 3 buttons set up to individually cast "chill", "sparks" and "shards". I want 1 button to cast one of the three spells switching each time I become more proficient in the spell I'm casting.

In my mind the script would be:
Define a variable
If the variable is x c 'chill' else if the variable is y c 'sparks' else c 'shards'
and then a trigger to pick up from the mud when an adept is gained in the spell that was cast and move to the next spell

As you said I unfortunately don't know enough abou zMud to do this my self, so help is really appreciated.
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Tue Aug 12, 2008 7:03 pm   
 
This is pretty simplistic, and untested but I think it should work.

Code:
#VAR CurrentSpell chill
#TR "trgSpellIncreaseSwitch" {^You have become more adept at (%w)!$} {#IF (%1 = "chill") {#VAR CurrentSpell sparks};#IF (%1 = "sparks") {#VAR CurrentSpell shards};#IF (%1 = "shards") {#VAR CurrentSpell chill}}
#ALIAS SpellAttack {#EXEC %concat("c '",@CurrentSpell,"'")}


Edit: Well I was too lazy to do a button, but #EXEC %concat("c '",@CurrentSpell,"'") should work in a button.

Erasmus
_________________
Erasmus
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Fri Aug 15, 2008 12:48 am   
 
Actually you are all OVER complicating it.

Code:
#KEY F1 {
#IF (!@spelltocast) {#VAR spelltocast 1}
cast '%item(@spellsF1, @spelltocast)'
#IF (@spelltocast >= %numitems(@spellsF1)) {#VAR spelltocast 1} {#ADD spelltocast 1}
}


Then its just a simple matter of pressing F1 to cast the spell. And it'll rotate through whatever spells are listed in @spellsF1, which I'm sure you know how to define a list var... if not...

Code:
#VAR spellsF1 {chill|sparks|shards|this is a spell with spaces example|anotherspell|etc etc etc...}


MUCH simpler. :)
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
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