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
Zener
Wanderer


Joined: 31 May 2004
Posts: 54
Location: USA

PostPosted: Thu Jun 24, 2004 12:25 am   

Seeking Help...
 
What I am looking to write seems so easy and yet I can't seem to find a place to start, so I am asking for anyones help, which is much appreciated.

I have triggers set up to automatically cast spells that have worn off, via Spell Wear-Off message triggers, and every once in a while my character doesn't successfully cast the spell. I need a way to put the spell that is being casted to be put into a variable then if I receive a fail message, automatically recast the spell based on the value in the variable.

All my spell wear-off triggers looks like this.

#TRIGGER {You slowly float to the ground.} {cast 'fly'}
#TRIGGER {Your force shield shimmers then fades away.} {cast 'shield'}

What I don't want is for my script to activate if I fail when I am fighting or something, therefore I use the longest version of casting a spell, instead of just type c fly or cast fly I insert the spell in apostrophes, which I do not do while fighting.

Also, would there be a way to add this to my spell bot where it would automatically recast the spell it failed instead of going through all the spells and recasting the ones it missed afterwards?

Here is what my spell bot trigger looks like.

^(%w) says 'spell up'

#T- Spellup
#T- Healup
#VAR PC
cast 'armor' @PC
cast 'bless' @PC
cast 'nimbus' @PC
cast 'scry' @PC
cast 'fly' @PC
cast 'sanctuary' @PC
cast 'fireshield' @PC
cast 'shockshield' @PC
emote falls into a deep trance...
trance

I would love to be able to provide *all* the spells to everyone 100% of the time, not if the person is lucky that my spell bot messes up and doesn't cast a spell correctly, and then has to wait 'till my spell bot is finished trancing.

Again, any help appreciated!

~Zener
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Thu Jun 24, 2004 12:58 am   
 
I suggest you look at using multistate triggers. Check out the library article on it, and see if you get any ideas: http://www.zuggsoft.com/library/trigadv.htm
Reply with quote
Mike Z Red
Beginner


Joined: 11 Jun 2004
Posts: 11
Location: USA

PostPosted: Thu Jun 24, 2004 2:33 am   
 
I have to disagree with geniusClown; I don't think multistate triggers will help here - the problem he seems to have is that he needs to re-attempt the cast if it's unsuccessful.

I'm still learning, but I don't think multistates would function in this situation - the 'wear off' text won't be in the same text block (from the mud) as the success/failure message, so the second state would never fire. [B)]

Here's what I would do.

#FUNCTION spellUp {cast %concat("'",@toCast,"'")}

Then you replace the triggers you have:
#CLASS wearOffs
#TRIGGER fly {You slowly float to the ground.} {toCast="fly"; spellUp}
#TRIGGER shield {Your force shield shimmers then fades away.} {toCast="fly";spellUp}
#CLASS 0


And add two triggers:
#CLASS spellCasting
#TRIGGER success {You complete your spell...} {toCast=null}
#TRIGGER failure {You lost your concentration!} {#IF (@toCast != null) {spellUp} }
#CLASS 0

Here's a timeline:
1- You attempt to cast the original spell (manually, for now).
2- (Assume Success) The 'success' trigger fires, and sets toCast=null
3- Later your fly spell wears off, and the 'fly' trigger fires. toCast="fly" and spellUp is called.
4- spellUp tries to cast the spell.
5- (Assume failure) The 'failure' trigger fires, sees that toCast != null, and calls spellUp again.
6- spellUp tries to cast the spell
7- (Assume success) The 'success' trigger fires, and sets toCast=null

---
I would also add two aliases:
#ALIAS fighting {toCast=null; #T- spellCasting}
#ALIAS doneFighting {#T+ spellCasting}

If you aren't proficient at the spell and it takes several attempts to cast it (or if all your spells run out at once), you might not want the lag it takes to successfully cast it if you are, say, attacked in the middle of trying to cast.

The 'fighting' alias will let you fight or flee or whatever you need to do without the delay of trying to cast spells.

The 'doneFighting' alias lets you re-enable your spell-ups. You WILL have to manually spell-up again if your spells ran out after you used the 'fighting' alias.

This post seems long enough, so I'll post info on the spellBot question (a whole different can of worms) in another post. Very Happy

BTW, the success/failure messages I used are just generic, obviously you need to set them specific to your mud.
Reply with quote
Mike Z Red
Beginner


Joined: 11 Jun 2004
Posts: 11
Location: USA

PostPosted: Thu Jun 24, 2004 2:48 am   
 
Okay, so the spellBot question. I'm not going to write out the entire spellBot, that's a pain. But here's a couple basic things you'll need, they should get you started.


#CLASS spellUps
#FUNCTION castSpellUp {#CHOOSE @curSpell {cast 'armor' @PC|cast 'bless' @PC|cast 'nimbus' @PC|cast 'scry' @PC|cast 'fly' @PC|cast 'sanctuary' @PC|cast 'fireshield' @PC|cast 'shockshield' @PC}

#ONINPUT {spell me up!} {pc="self";curSpell=1; castSpellUp}

#TRIGGER success {You complete your spell...} {#IF (curSpell != null AND curSpell != 8 ) {curSpell=%eval(@curSpell+1);spellUp} {curSpell=null;emote falls into a deep trance...;trance}
#TRIGGER failure {You failed to complete your spell} {#IF (curSpell != null) {spellUp} }
#CLASS 0


Okay, so that actually is the majority of the "bot," except for a trigger for other people to use, and some other minor things.
Reply with quote
Mike Z Red
Beginner


Joined: 11 Jun 2004
Posts: 11
Location: USA

PostPosted: Thu Jun 24, 2004 2:49 am   
 
Note, by the way, that I wrote both those posts without actually testing them, so if there's a typo or something, I apologize, I'm sure you can debug it, though ; )
Reply with quote
Zener
Wanderer


Joined: 31 May 2004
Posts: 54
Location: USA

PostPosted: Thu Jun 24, 2004 6:17 am   
 
I play on Realms of Despair, so there is nothing that I can see to work with this, #TRIGGER success {You complete your spell...}, which what you wrote seems heavily dependant on. I could be wrong. Although you've given me many ideas. Thanks!

~Zener
Reply with quote
Ryntrax
Wanderer


Joined: 15 Mar 2004
Posts: 55
Location: USA

PostPosted: Thu Jun 24, 2004 2:37 pm   
 
I would say that when spells wear off, simply have the trigger add them to a string, and on an alias just send the alias to the mud; such as when you stand.

#TRIGGER {You slowly float to the ground.} {#additem spelloutlist {"cast fly"}}
#alias castwornoff {#FORALL @spelloutlist {#send %i}}

seems a little easie but who knows.

You could use the same trigger for fumbled spells.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jun 24, 2004 3:20 pm   
 
You left out a critical piece of information. How will you tell when a spellcasting has failed? However, adding spells to a list is quite easy, do it at the same time you cast them, using #ADDITEM. Use #DELITEM to remove them from the list after a successful cast.
#TR {You slowly float to the ground.} {#ADDI SpellsDown {fly};cast 'fly'}

Mike seems to have confused #FUNCTION with #ALIAS. Also, #CHOOSE isn't part of the zMUD command set, he might have meant #PICK. His ideas may be useful, but he's clearly not very familiar with zMUD, and I'd recommend caution using any of his scripts.
Reply with quote
Mike Z Red
Beginner


Joined: 11 Jun 2004
Posts: 11
Location: USA

PostPosted: Thu Jun 24, 2004 10:54 pm   
 
I meant #CASE, actually.

And I said right off that I'm still learning about zMud.

But don't hold back, Lightbulb - tell me what you really think. Wink
-
As far as using my scripts, I'd just say try it and test it when it's not going to cost you your character's life. I would say that about ANYBODYs script, no matter how long they've been scripting for zMud.

I use a similar algorithm for a couple functions on my own char and it works great.
----------------------------------------------------------------------

Zener -
The script isn't actually dependent on the success message. It's there, though, so that if you manually cast a spell and it fails, the script doesn't re-cast the spell that's in @toCast.

The easiest alternative is to skip that 'success trigger' and add
toCast=null
to all your spellcasting aliases (in the non-bot script) or
curSpell=null
in the bot script.

Not sure why I changed my variable name, your guess is as good as mine. If you don't set the variable to null when you cast a spell manually, the 'failure' trigger will go off and will re-cast whatever spell is in @toCast or @curSpell , wether you want it to or not.


I think Ryntrax and LB missed the main point of your original post, though - you want to continue to re-cast until successful, which the triggers they gave you won't do - they'll try a second time, and that's it, so if you fail the 2nd time, too, you have to do it manually.


------

Glad I gave you some ideas. Hope this and the other help ya.

Happy mudding = )
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