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
Cyrn
Beginner


Joined: 01 Dec 2000
Posts: 17
Location: USA

PostPosted: Fri Jun 28, 2002 12:33 pm   

Cyrn's 'Smart' Autospellup Script
 
This 'Smart' Autospellup Script was written for a Smaug derivative, but should be fairly easy to modify for other codebases. It will spell you up without spamming commands so you can chat/move around while spelling up, will recast fizzled spells, and will automatically generate a list of spells you don't have 'up' from an affect listing.


Paste the following into a text file and import it into zMUD:
------START-------
#CLASS {autospell}
#ALIAS rmspell {#if (%ismember( %1 %2, @spellstocast)) {#delitem spellstocast {%1}};#T- autospell|spellcasted;castnext}
#ALIAS castnext {#IF (%numitems( @spellstocast)) {cast ~'%item( @spellstocast, 1);#T+ autospell|spellcasted} {#echo Fully Spelled Up;#T- autospell|spellcasted}}
#ALIAS resetspells {#var spellstocast "animal affinity|barkskin|blazeward|dragonskin|earthshield|elemental armor|elemental join|elemental reconstruc|wall of air|wings of air" {autospell};#T+ autospell|checkaffects;#variable spellsfound {};aff}
#VAR spellstocast {} {}
#VAR spellsfound {} {}
#CLASS 0

#CLASS {autospell|spellcasted}
#TRIGGER {Something distracts you, and you lose your concentration.} {castnext}
#TRIGGER {An itch on your leg keeps you from properly casting your spell.} {castnext}
#TRIGGER {A tickle in your nose prevents you from keeping your concentration.} {castnext}
#TRIGGER {Something in your throat prevents you from uttering the proper phrase.} {castnext}
#TRIGGER {A twitch in your eye disrupts your concentration for a moment.} {castnext}
#TRIGGER {You failed.} {#delitem spellstocast {%eval( %item( @spellstocast, 1))};castnext}
#TRIGGER {You lost your concentration.} {castnext}
#TRIGGER {You get a mental block mid-way through the casting.} {castnext}
#TRIGGER {You begin to float in mid-air...} {rmspell float}
#TRIGGER {Your skin turns to stone} {rmspell stoneskin}
#TRIGGER {The ground below you swirls beneath your feet...} {rmspell earthshield}
#TRIGGER {The four elemental lords smile down upon your call....} {rmspell {elemental displacement}}
#TRIGGER {Torrents of cascading energy form around you} {rmspell shockshield}
#TRIGGER {Mystical flames rise to enshroud you.} {rmspell fireshield}
#TRIGGER {A glistening hail of ice encompasses you.} {rmspell iceshield}

#CLASS 0

#CLASS {autospell|wearoffs}
#TRIGGER {The magical warmth within you subsides.} {#additem spellstocast {inner warmth}}
#TRIGGER {Your body returns to its weaker alignment.} {#additem spellstocast {elemental reconstruc}}
#TRIGGER {Your skin turns to flesh} {#additem spellstocast {stoneskin}}
#TRIGGER {The wind slows and sets you on the ground.} {#additem spellstocast {wings of air}}
#TRIGGER {Your flesh sheds its draconian aspects.} {#additem spellstocast {dragonskin}}
#TRIGGER {You feel less like an ANIMAL and more like yourself.} {#additem spellstocast {animal affinity}}

#CLASS 0

#CLASS {autospell|checkaffects}
#TRIGGER {^Racial affect : invisible detect_invis} {#T- autospell|checkaffects;#echo %sort( @spellstocast)}
#TRIGGER {%d~) ({@spellstocast})%smodifies} {#if (%ismember( %1, @spellsfound)) { #gag} {#break;#if (%ismember( {%1}, @spellstocast)) {#delitem spellstocast {%1};#additem spellsfound {%1}}}}

#CLASS 0
-------END--------


Usage:
1. The 'resetspells' alias will figure out which spells you don't have 'up' from your affect listing and echo them at the end of the affects list.
2. The 'castnext' alias will, one at a time, cast the spells you don't have 'up', recasting on fizzles. This is much better than sending all the spells at once and not being able to do anything for 5 minutes.


Modifying it to suit your MUD(the red parts):

Red Block Number 1: Change the 'resetspells' alias to contain the spells you want to cast. Replace Animal affinity, barkskin, etc in the imported script with your list of spells (seperated by "|" as in the sample).
IMPORTANT: The blue 'aff' is the command to list your affects. Modify it if needed.

Red Block Number 2: Modify the various 'lost concentration' type messages to match those on your mud. I believe the samples provided are the smaug defaults. Then add triggers for successful casting of each spell, following the format of the sample spells.
IMPORTANT: The 'You failed.' trigger means the you already have the spell affecting you. This prevents you from casting the same spell over and over if your 'successfully casted' trigger is broken or something odd goes wrong. You probably want to modify this for your mud.

Red Block Number 3:
Add triggers for the wearoffs of each of the spells that will automatically add them to the casting list. If you have Red Block 4 working the script will work fine without them.


Red Block Number 4:
--Modify the first trigger to disable the class at the end of your mud's affect listing (for speed's sake).
--Modify the second trigger to get the name of the spell from your mud's affect listing. This will probably the the hardest part. The current trigger pattern catches:
12) somespellname modifies [....]
13) someotherspellname modifies [....]
I've done some gagging of the affect listing, you may wish to remove it...


VERY IMPORTANT:
The spells name in the various triggers/alias for the same spell MUST all be the same, and be the same as what you are capturing from the affects listing or it will not work.

I'll cross post this to the finished scripts forum if I didn't totally screw it up trying to post it. Post if this works for you.


-Cyrn
Reply with quote
Death
Apprentice


Joined: 25 Jun 2002
Posts: 109
Location: USA

PostPosted: Fri Jun 28, 2002 6:36 pm   
 
I'm not quite sure if it's working correctly or not...this is what I copied in...

#CLASS {autospell}
#ALIAS rmspell {#if (%ismember( %1 %2, @spellstocast)) {#delitem spellstocast {%1}};#T- autospell|spellcasted;castnext}
#ALIAS castnext {#IF (%numitems( @spellstocast)) {cast ~'%item( @spellstocast, 1);#T+ autospell|spellcasted} {#echo Fully

Spelled Up;#T- autospell|spellcasted}}
#ALIAS resetspells {#var spellstocast "stone skin|armor|shield|haste|giant strength|frenzy|bless|fly|pass

door|infravision|visegrip|sanctuary|detect good|detect evil|detect magic|detect hidden|detect invis|detect

sneak|invisibility" {autospell};#T+ autospell|checkaffects;#variable spellsfound {};aff}
#VAR spellstocast {} {}
#VAR spellsfound {} {}
#CLASS 0

#CLASS {autospell|spellcasted}
#TRIGGER {You failed.} {#delitem spellstocast {%eval( %item( @spellstocast, 1))};castnext}
#TRIGGER {You lost your concentration.} {castnext}
#TRIGGER {Your feet rise off the ground.} {rmspell fly}
#TRIGGER {Your skin turns to stone.} {rmspell stone skin}
#TRIGGER {You feel someone protecting you.} {rmspell armor}
#TRIGGER {You feel righteous.} {rmspell bless}
#TRIGGER {You are filled with holy wrath!} {rmspell frenzy}
#TRIGGER {Your muscles surge with heightened power!} {rmspell giant strength}
#TRIGGER {You turn translucent.} {rmspell pass door}
#TRIGGER {Your eyes glow red.} {rmspell infravision}
#TRIGGER {You are surrounded by a white aura.} {rmspell sanctuary}
#TRIGGER {You couldn't be disarmed by the biggest of giants!} {rmspell visegrip}
#TRIGGER {You are surrounded by a force shield.} {rmspell armor}
#TRIGGER {You fade out of existence.} {rmspell invisibility}
#TRIGGER {Your awareness improves.} {rmspell detect hidden}
#TRIGGER {You begin seeing as you never have before.} {rmspell detect sneak}
#TRIGGER {Your eyes tingle.} {rmspell detect invis}
#TRIGGER {Your eyes tingle.} {rmspell detect evil}
#TRIGGER {Your eyes tingle.} {rmspell detect good}
#TRIGGER {Your eyes tingle.} {rmspell detect magic}
#CLASS 0

#CLASS {autospell|wearoffs}
#TRIGGER {You feel less righteous.} {#additem spellstocast {bless}}
#TRIGGER {Your rage ebbs.} {#additem spellstocast {frenzy}}
#TRIGGER {Your skin feels soft again.} {#additem spellstocast {stoneskin}}
#TRIGGER {You feel less armored.} {#additem spellstocast {armor}}
#TRIGGER {Your force shield shimmers then fades away.} {#additem spellstocast {shield}}
#TRIGGER {You feel weaker.} {#additem spellstocast {giant strength}}
#TRIGGER {You feel yourself slow down.} {#additem spellstocast {haste}}
#TRIGGER {You no longer see in the dark.} {#additem spellstocast {infravision}}
#TRIGGER {You feel solid again.} {#additem spellstocast {pass door}}
#TRIGGER {You slowly float to the ground.} {#additem spellstocast {fly}}
#TRIGGER {The white aura around your body fades.} {#additem spellstocast {sanctuary}}
#TRIGGER {Your hands relax as your grip weakens.} {#additem spellstocast {visegrip}}
#TRIGGER {The red in your vision disappears.} {#additem spellstocast {detect evil}}
#TRIGGER {The gold in your vision disappears.} {#additem spellstocast {detect good}}
#TRIGGER {You feel less aware of your surroundings.} {#additem spellstocast {detect hidden}}
#TRIGGER {You no longer see invisible objects.} {#additem spellstocast {detect invis}}
#TRIGGER {The detect magic wears off.} {#additem spellstocast {detect magic}}
#TRIGGER {You no longer see stealthy players.} {#additem spellstocast {detect sneak}}
#TRIGGER {You are no longer invisible.} {#additem spellstocast {invisibility}}
#CLASS 0

#CLASS {autospell|checkaffects}
#TRIGGER {^Racial affect : invisible detect_invis} {#T- autospell|checkaffects;#echo %sort( @spellstocast)}
#TRIGGER {%d~) ({@spellstocast})%smodifies} {#if (%ismember( %1, @spellsfound)) { #gag} {#break;#if (%ismember( {%1},

@spellstocast)) {#delitem spellstocast {%1};#additem spellsfound {%1}}}}
#CLASS 0
Reply with quote
Cyrn
Beginner


Joined: 01 Dec 2000
Posts: 17
Location: USA

PostPosted: Sat Jun 29, 2002 4:05 pm   
 
quote:

I'm not quite sure if it's working correctly or not...this is what I copied in...

#CLASS {autospell}
#ALIAS rmspell {#if (%ismember( %1 %2, @spellstocast)) {#delitem spellstocast {%1}};#T- autospell|spellcasted;castnext}
#ALIAS castnext {#IF (%numitems( @spellstocast)) {cast ~'%item( @spellstocast, 1);#T+ autospell|spellcasted} {#echo Fully Spelled Up;#T- autospell|spellcasted}}
#ALIAS resetspells {#var spellstocast "stone skin|armor|shield|haste|giant strength|frenzy|bless|fly|pass door|infravision|visegrip|sanctuary|detect good|detect evil|detect magic|detect hidden|detect invis|detect sneak|invisibility" {autospell};#T+ autospell|checkaffects;#variable spellsfound {};aff}
#VAR spellstocast {} {}
#VAR spellsfound {} {}
#CLASS 0

#CLASS {autospell|spellcasted}
#TRIGGER {You failed.} {#delitem spellstocast {%eval( %item( @spellstocast, 1))};castnext}
#TRIGGER {You lost your concentration.} {castnext}
#TRIGGER {Your feet rise off the ground.} {rmspell fly}
Multiple word spells need to be enclosed in brackets, for example, the following line should be:
#TRIGGER {Your skin turns to stone.} {rmspell {stone skin}}
#TRIGGER {You feel someone protecting you.} {rmspell armor}
#TRIGGER {You feel righteous.} {rmspell bless}
#TRIGGER {You are filled with holy wrath!} {rmspell frenzy}
#TRIGGER {Your muscles surge with heightened power!} {rmspell giant strength}
#TRIGGER {You turn translucent.} {rmspell pass door}
#TRIGGER {Your eyes glow red.} {rmspell infravision}
#TRIGGER {You are surrounded by a white aura.} {rmspell sanctuary}
#TRIGGER {You couldn't be disarmed by the biggest of giants!} {rmspell visegrip}
#TRIGGER {You are surrounded by a force shield.} {rmspell armor}
#TRIGGER {You fade out of existence.} {rmspell invisibility}
#TRIGGER {Your awareness improves.} {rmspell detect hidden}
#TRIGGER {You begin seeing as you never have before.} {rmspell detect sneak}
The following 4 triggers will be problematic, you'll probably need to do a little work to figure out which one of them you actually casted.
#TRIGGER {Your eyes tingle.} {rmspell detect invis}
#TRIGGER {Your eyes tingle.} {rmspell detect evil}
#TRIGGER {Your eyes tingle.} {rmspell detect good}
#TRIGGER {Your eyes tingle.} {rmspell detect magic}
#CLASS 0

#CLASS {autospell|wearoffs}
#TRIGGER {You feel less righteous.} {#additem spellstocast {bless}}
#TRIGGER {Your rage ebbs.} {#additem spellstocast {frenzy}}
#TRIGGER {Your skin feels soft again.} {#additem spellstocast {stoneskin}}
#TRIGGER {You feel less armored.} {#additem spellstocast {armor}}
#TRIGGER {Your force shield shimmers then fades away.} {#additem spellstocast {shield}}
#TRIGGER {You feel weaker.} {#additem spellstocast {giant strength}}
#TRIGGER {You feel yourself slow down.} {#additem spellstocast {haste}}
#TRIGGER {You no longer see in the dark.} {#additem spellstocast {infravision}}
#TRIGGER {You feel solid again.} {#additem spellstocast {pass door}}
#TRIGGER {You slowly float to the ground.} {#additem spellstocast {fly}}
#TRIGGER {The white aura around your body fades.} {#additem spellstocast {sanctuary}}
#TRIGGER {Your hands relax as your grip weakens.} {#additem spellstocast {visegrip}}
#TRIGGER {The red in your vision disappears.} {#additem spellstocast {detect evil}}
#TRIGGER {The gold in your vision disappears.} {#additem spellstocast {detect good}}
#TRIGGER {You feel less aware of your surroundings.} {#additem spellstocast {detect hidden}}
#TRIGGER {You no longer see invisible objects.} {#additem spellstocast {detect invis}}
#TRIGGER {The detect magic wears off.} {#additem spellstocast {detect magic}}
#TRIGGER {You no longer see stealthy players.} {#additem spellstocast {detect sneak}}
#TRIGGER {You are no longer invisible.} {#additem spellstocast {invisibility}}
#CLASS 0

#CLASS {autospell|checkaffects}
I suspect that you still need to edit the following two triggers to work with your mud
#TRIGGER {^Racial affect : invisible detect_invis} {#T- autospell|checkaffects;#echo %sort( @spellstocast)}
#TRIGGER {%d~) ({@spellstocast})%smodifies} {#if (%ismember( %1, @spellsfound)) { #gag} {#break;#if (%ismember( {%1}, @spellstocast)) {#delitem spellstocast {%1};#additem spellsfound {%1}}}}
#CLASS 0




I'll assume that the extra line breaks are from the forum, if not, they shouldn't be there.
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