Difference between revisions of "Zmud Spellbot (Guaritore)"

From AvatarWiki
Jump to navigation Jump to search
m (Zmud Scripting moved to Zmud Spellbot (Guaritore): Article name too general.)
 
(9 intermediate revisions by one other user not shown)
Line 1: Line 1:
This trigger counts the number of kills, amount of experience you have gained (or lost) and the amount of levels gained on a run and shows it to the group. It also counts bashes, trips, throws and rescues, succesful or not.
+
This script produces a spellbot with a queuing system. It was designed using zmud v7.21
  
 
== Code ==
 
== Code ==
''Copy each line individually and then paste them into zMud'' <sup>[1]</sup>'':''
+
The prompt used for this bot is:<BR>
#TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 1} {runcounter}
+
Spells: %m mana<BR>
#TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
+
If you use a different prompt you must edit the trigger that captures your current
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
+
mana from your prompt.<BR>
#TRIGGER {^You throw (%*) to the ground!} {#ad throw 1;#ad sucthrow 1;#hi} {runcounter}
+
I'm not 100% sure everything has been captured in this trigger, so if any parts don't
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
+
work properly please let me know.
#TRIGGER {^You try to grab a hold, but miss!} {#ad throw 1} {runcounter}
 
#TRIGGER {^You successfully rescue} {#ad rescue 1;#ad sucrescue 1} {runcounter}
 
#TRIGGER {^You sweep, but they are just a little too quick for you.} {#ad trip 1} {runcounter}
 
#TRIGGER {^You fail to rescue} {#ad rescue 1} {runcounter}
 
#TRIGGER {^You successfully rescue} {#ad rescue 1;#ad sucrescue 1} {runcounter}
 
#TRIGGER {^Your tail whacks (%*) in the head! They are stunned} {#ad tail 1} {runcounter}
 
#TRIGGER {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad deathloss %1;#ad exp -%1} {runcounter}
 
#TRIGGER {^You flee (%*)! What a COWARD! You lose (%d) exps!} {#ad netxp -%2;#ad fleexp %2} {runcounter}
 
#TRIGGER {^You couldn't get away!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
 
#TRIGGER {^You recall from combat!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
 
#TRIGGER {^You failed!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
 
#TRIGGER {^You are (%*) and a worshipper of (%x).} {#var worship %2} {runcounter}
 
#TRIGGER {^You are (%*) and a devoted worshipper of (%x).} {#var worship %2} {runcounter}
 
#TRIGGER {^Your gain is: (%d)/(%d) hp, (%d)/(%d) m, (%d)/(%d) mv (%d)/(%d) prac.} {#ad lev 1;emote increases in power!!  |by|%1 |y|hps|n|, |br|%3 |r|mana|n|, |bw|%7 |w|practices|n|.} {runcounter}
 
#VAR worship {Snikt}
 
#ALIAS runreport {get_color;gtell |bk|This run, |@bclr|@worship |bk|gave me: |@bclr|@exp |bk|xp, |@bclr|@cnt |bk|kills, |@bclr|@lev |bk|level(s).;#if {@death=0 && @fleexp=0} {} {gtell |bk|I've lost %if( @death!=0, ~|@bclr~|@deathloss ~|bk~|xp ~|bk~|by ~|@bclr~|@death ~|bk~|death~(s~))%if( @death!=0 and @fleexp!=0, ~|bk~| ~and ~|bk~|)%if( @fleexp!=0, ~|@bclr~|@fleexp ~|bk~|xp from fleeing ~and~/~or recalling) so my net gain is |@bclr|@netxp|bk| xp.};stats}
 
#ALIAS stats {#if {@bash=0 && @trip=0 && @throw=0 && @rescue=0 && @tail=0} {} {gtell %if( @bash!=0, ~|bk~| Bashes: ~|@bclr~|@sucbash~|@bclr~|~/~|@bclr~|@bash)%if( @trip!=0, ~|bk~| Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip)%if( @throw!=0, ~|bk~| Throws: ~|@bclr~|@sucthrow~|bk~|~/~|@bclr~|@throw)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue)%if( @tail!=0, ~|bk~| Tails: ~|@bclr~|@tail) ~|w~|}}
 
#ALIAS get_color {#var colors {y|g|b|r|c|p};#var bright_colors {by|bg|bb|br|bc|bp};#ad ccc 1;#if (@ccc>%numitems(@colors)) {#var ccc 1};#var clr %item(@colors,@ccc);#var bclr %item(@bright_colors,@ccc)}
 
#ALIAS resetrun {#var exp 0;#var cnt 0;#var lev 0;#var bash 0;#var sucbash 0;#var trip 0;#var suctrip 0;#var throw 0;#var sucthrow 0;#var rescue 0;#var sucrescue 0;#var death 0;#var deathloss 0;#var netxp 0;#var fleexp 0;#var tail 0;#ec --- Resetting counters ---}
 
  
<sup>[1]</sup> Instead, you could just copy and paste it into a *.txt file. Then, in zMUD, go to "Settings -> File -> Import Text" and select the file you saved to.
 
  
== Usage ==
+
#CLASS {spells}
After adding everything line by line, be sure to use resetrun at least once before you run, so all the variables exist.
+
#VAR mana ""
 
+
#VAR spellcount ""
To set the worship part to the right deity, just look at your score. Otherwise, or for atheist, it will show Snikt.
+
#VAR spelltarget ""
 
+
#VAR spelllist ""
The command '''runreport''' shows run stats. If you haven't died and did nothing special, it will just show your xp. If you've died or fled, it will show you what you lost. If you've bashed, tripped, thrown or rescued, it will show you the, succesful and total, number of those.
+
#TRIGGER {%1 tells the group 'full'} {#var spelltarget %1;#if (!%ismember( %1, @spelllist)) {gt You're not on the list. GT 'next' without the quotes to be added};#if (%ismember( %1, @spelllist)) {#IF ((%1 != %item( @spelllist, 1)) & (@mana < 1500)) {gt You'll have to wait your turn and I need more mana. @mana/1600};#IF ((%1 != %item( @spelllist, 1)) & (@mana >= 1500)) {gt You'll have to wait your turn};#IF ((%1 = %item( @spelllist, 1)) & (@mana < 1500)) {gt You're next but I need more mana. @mana/1500};#IF ((%1 = %item( @spelllist, 1)) & (@mana >= 1500)) {#ad spellcount 1;wake;tell %1 water will be last;c 'holy sight' %1;c foci %1;c fort %1;c invin %1;c awen %1;tell %1 all done;c wa %1;#delitem spelllist %1;sleep;#ad spells/list/%1 1}}}
 
+
  #TRIGGER {%1 tells the group 'split'} {#var spelltarget %1;#if (!%ismember( %1, @spelllist)) {gt You're not on the list. GT 'next' without the quotes to be added};#if (%ismember( %1, @spelllist)) {#IF ((%1 != %item( @spelllist, 1)) & (@mana < 1500)) {gt You'll have to wait your turn and I need more mana. @mana/1600};#IF ((%1 != %item( @spelllist, 1)) & (@mana >= 1500)) {gt You'll have to wait your turn};#IF ((%1 = %item( @spelllist, 1)) & (@mana < 1500)) {gt You're next but I need more mana. @mana/1500};#IF ((%1 = %item( @spelllist, 1)) & (@mana >= 1500)) {#ad spellcount 1;wake;tell %1 water will be last;c 'holy sight' %1;c foci %1;c fort %1;c invin %1;c armor %1;c 'holy armor' %1;c 'holy aura' %1;c bless %1;c sanc %1;tell %1 all done;c wa %1;#delitem spelllist %1;#ad spells/list/%1 1;sleep}}}
The command '''resetrun''' will reset the counters.
+
  #TRIGGER {%1 tells the group 'next'} {#additem spelllist %1;gt |BC|People in line: @spelllist;gt |BC|gt |BR|split full |BC|or |BR|help|BC| to see a list of all other spells/commands;gt |BM|Please check your alignment, i cannot fullspell evil chars;gt |BC|gt 'split awen' without the quotes if you didn't check your align and just need the awen spells}
 
+
  #TRIGGER {joins your group.} {gt |BC|gt |BR|'next'|BC| without the quotes to be added to the queue for |BR|FULL |BC|and |BR|SPLIT |BC|spells;gt |BC|gt |BR|help |BC|for a list of all available spells/commands;gt |BC|if someone is not responding or queue is not empty when it should be gt clear then gt next to rejoin the queue.}
== How It Works ==
+
#TRIGGER {%1 tells the group 'help'} {gt |BC|gt split, full, invin, invis, sanc, frenzy, fort, foci, wa(waterbreathing), invig, holy sight, remove curse, div, div2, div3, div4, div5, split awen(just awen spells), pp(portal), next(to be added to the queue), line(for list of queue), clear(clears queue DO NOT ABUSE)}
#TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 1} {runcounter}
+
  #TRIGGER {%1 tells the group 'sanc'} {wake;c sanc %1;sleep}
  #TRIGGER {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad deathloss %1;#ad exp -%1} {runcounter}
+
  #TRIGGER {%1 tells the group 'split awen'} {wake;c armor %1;c 'holy armor' %1;c 'holy aura' %1;c bless %1;c sanc %1;sleep}
#TRIGGER {^You flee (%*)! What a COWARD! You lose (%d) exps!} {#ad netxp -%2;#ad fleexp %2} {runcounter}
+
  #TRIGGER {%1 tells the group 'invin'} {wake;c invin %1;sleep}
#TRIGGER {^You couldn't get away!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
+
  #TRIGGER {%1 tells the group 'div'} {wake;c div %1;sleep}
#TRIGGER {^You recall from combat!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
+
#TRIGGER {%1 tells the group 'div2'} {wake;augment 2;c div %1;augment off;sleep}
  #TRIGGER {^You failed!  You lose (%d) exps.} {#ad netxp -%1;#ad fleexp %1} {runcounter}
+
  #TRIGGER {%1 tells the group 'div3'} {wake;augment 3;c div %1;augment off;sleep}
All of these keep track of your xp gains and losses. 'exp' is the variable for the experience gained, whereas 'netxp' is the netto xp, with losses from fleeing and deaths subtracted. 'cnt' is the number of kills.
+
  #TRIGGER {%1 tells the group 'div4'} {wake;augment 4;c div %1;augment off;sleep}
 
+
#TRIGGER {%1 tells the group 'div5'} {wake;augment 5;c div %1;augment off;sleep}
  #TRIGGER {Your gain is: (%d)/(%d) hp, (%d)/(%d) m, (%d)/(%d) mv (%d)/(%d) prac.} {#ad lev 1;emote increases in power!!  |by|%1 |y|hps|n|, |br|%3 |r|mana|n|, |bw|%7 |w|practices|n|.} {runcounter}
+
  #TRIGGER {%1 stops following you.} {#delitem spelllist %1}
This line keeps track of the amount of levels you get. It also outputs, in an emote for all to see, what your gains are.
+
#TRIGGER {%1 tells the group 'clear'} {#var spelllist "";sleep}
 
+
  #TRIGGER {%1 tells the group 'remove curse'} {wake;c 'remove curse' %1;sleep}
  #TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
+
#TRIGGER {%1 now follows you.} {group %1}
  #TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
+
  #TRIGGER {Your senses return to normal.} {wake;heighten;sleep}
  #TRIGGER {^You throw (%*) to the ground!} {#ad throw 1;#ad sucthrow 1;#hi} {runcounter}
+
#TRIGGER {%1 tells the group 'line'} {gt People in line: @spelllist}
  #TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
+
  #TRIGGER {tells you} {#cap spellcap}
  #TRIGGER {^You try to grab a hold, but miss!} {#ad throw 1} {runcounter}
+
  #TRIGGER {You dream of %1 telling you} {#cap spellcap}
  #TRIGGER {^You successfully rescue} {#ad rescue 1;#ad sucrescue 1} {runcounter}
+
  #TRIGGER {%1 tells the group 'fort'} {wake;c fort %1;sleep}
  #TRIGGER {^You sweep, but they are just a little too quick for you.} {#ad trip 1} {runcounter}
+
#TRIGGER {%1 tells the group 'foci'} {wake;c foci %1;sleep}
  #TRIGGER {^You fail to rescue} {#ad rescue 1} {runcounter}
+
  #TRIGGER {%1 tells the group 'wa'} {wake;c wa %1;sleep}
  #TRIGGER {^You successfully rescue} {#ad rescue 1;#ad sucrescue 1} {runcounter}
+
  #TRIGGER {tells the group 'pp %1'} {wake;c portal %1;sleep}
All these count the number of bashes, throws, trips and rescues. It also keeps track of whether or not you fail them.
+
#TRIGGER {%1 tells the group 'invig'} {wake;c invig %1;sleep}
 
+
  #TRIGGER {%1 tells the group 'frenzy'} {wake;c frenzy %1;sleep}
  #VAR worship {Snikt}
+
  #TRIGGER {You fail to heighten your senses.} {wake;heighten;sleep}
  #TRIGGER {You are (%*) and a worshipper of (%x).} {#var worship %2} {runcounter}
+
#TRIGGER {%1 tells the group 'holy sight'} {wake;c 'holy sight' %1;sleep}
For the final output, it can matter what deity you worship since some modify your xp gains or losses. Whenever you check your score window, this line will switch you to your deity. Default is Snikt, declared in the #VAR line.
+
#TRIGGER {%1 tells the group 'invis'} {wake;c invis %1;sleep}
 
+
  #TRIGGER {Spells: %1 mana} {#var mana %1}
  #ALIAS runreport {get_color;gtell |bk|This run, |@bclr|@worship |bk|gave me: |@bclr|@exp |bk|xp, |@bclr|@cnt |bk|kills, |@bclr|@lev |bk|level(s).;#if {@death=0 && @fleexp=0} {} {gtell |bk|I've lost %if( @death!=0, ~|@bclr~|@deathloss ~|bk~|xp ~|bk~|by ~|@bclr~|@death ~|bk~|death~(s~))%if( @death!=0 and @fleexp!=0, ~|bk~| ~and ~|bk~|)%if( @fleexp!=0, ~|@bclr~|@fleexp ~|bk~|xp from fleeing ~and~/~or recalling) so my net gain is |@bclr|@netxp|bk| xp.};stats}
+
#CLASS 0
Here's where it gets tricky. All the tildes (~) are used to make sure zMUD outputs them into your window, since they're all parts of commands if not prefixed with a tilde. The first thing it does is call get_color, to select a random color (see #ALIAS get_color). Then the reports come in. The first line will look like this:
 
  This run, Snikt gave me: a xp, b kills, c levels.
 
After that, the #if's begin. The next line, between the semicolons (;) checks if you've died or fled/recalled from combat. If so, it will tell you how much you've lost from this, and outputs your net gains. It will look like this:
 
I've lost a xp by b deaths and c xp from fleeing and/or recalling so my net gain is d xp.
 
After that, the alias calls the next alias, stats.
 
 
 
  #ALIAS stats {#if {@bash=0 && @trip=0 && @throw=0 && @rescue=0} {} {gtell %if( @bash!=0, ~|bk~| Bashes: ~|@bclr~|@sucbash~|@bclr~|~/~|@bclr~|@bash)%if( @trip!=0, ~|bk~| Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip)%if( @throw!=0, ~|bk~| Throws: ~|@bclr~|@sucthrow~|bk~|~/~|@bclr~|@throw)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue) ~|w~|}}
 
Stats outputs your bash, trip, throw and rescue scores, in that order. But, only when you've used the commands during your run. In the initial #if, it checks if you've used any of the commands. If you've used them, then it will continue with what's further down the line between the curly brackets ({}). There, between the brackets, it checks per skill if you've used them, and if so, it will output the results. It will look something like this:
 
  Bashes: 1/2 Trips: 1/2 Throws: 1/2 Rescues: 1/2
 
Assuming, of course, you've used all commands twice and failed em all once out of the two attempts.
 
 
 
  #ALIAS get_color {#var colors {y|g|b|r|c|p};#var bright_colors {by|bg|bb|br|bc|bp};#ad ccc 1;#if (@ccc>%numitems(@colors)) {#var ccc 1};#var clr %item(@colors,@ccc);#var bclr %item(@bright_colors,@ccc)}
 
This is an alias that stores all the possible colors in an array. You can (randomly) change the color used with get_color, use that color with @clr or the bright version of that color with @bclr. Can be nice, makes for a dynamic output.
 
 
 
  #ALIAS resetrun {#var exp 0;#var cnt 0;#var lev 0;#var bash 0;#var sucbash 0;#var trip 0;#var suctrip 0;#var throw 0;#var sucthrow 0;#var rescue 0;#var sucrescue 0;#var death 0;#var deathloss 0;#var netxp 0;#var fleexp 0;#ec --- Resetting counters ---}
 
This is the last alias, and it sets your variables all to 0 (except for worship, which shouldn't have to reset itself since it's not used cumulatively. The last part, '#ec --- Resetting counters ---' is only visible to you, as a local echo.
 
  
 +
You can copy and paste this code into your command line or copy and paste it into a text file and import it.
 
[[Category: Zmud Scripting]]
 
[[Category: Zmud Scripting]]

Latest revision as of 10:33, 9 August 2008

This script produces a spellbot with a queuing system. It was designed using zmud v7.21

Code

The prompt used for this bot is:
Spells: %m mana
If you use a different prompt you must edit the trigger that captures your current mana from your prompt.
I'm not 100% sure everything has been captured in this trigger, so if any parts don't work properly please let me know.


#CLASS {spells}
#VAR mana ""
#VAR spellcount ""
#VAR spelltarget ""
#VAR spelllist ""
#TRIGGER {%1 tells the group 'full'} {#var spelltarget %1;#if (!%ismember( %1, @spelllist)) {gt You're not on the list. GT 'next' without the quotes to be added};#if (%ismember( %1, @spelllist)) {#IF ((%1 != %item( @spelllist, 1)) & (@mana < 1500)) {gt You'll have to wait your turn and I need more mana. @mana/1600};#IF ((%1 != %item( @spelllist, 1)) & (@mana >= 1500)) {gt You'll have to wait your turn};#IF ((%1 = %item( @spelllist, 1)) & (@mana < 1500)) {gt You're next but I need more mana. @mana/1500};#IF ((%1 = %item( @spelllist, 1)) & (@mana >= 1500)) {#ad spellcount 1;wake;tell %1 water will be last;c 'holy sight' %1;c foci %1;c fort %1;c invin %1;c awen %1;tell %1 all done;c wa %1;#delitem spelllist %1;sleep;#ad spells/list/%1 1}}}
#TRIGGER {%1 tells the group 'split'} {#var spelltarget %1;#if (!%ismember( %1, @spelllist)) {gt You're not on the list. GT 'next' without the quotes to be added};#if (%ismember( %1, @spelllist)) {#IF ((%1 != %item( @spelllist, 1)) & (@mana < 1500)) {gt You'll have to wait your turn and I need more mana. @mana/1600};#IF ((%1 != %item( @spelllist, 1)) & (@mana >= 1500)) {gt You'll have to wait your turn};#IF ((%1 = %item( @spelllist, 1)) & (@mana < 1500)) {gt You're next but I need more mana. @mana/1500};#IF ((%1 = %item( @spelllist, 1)) & (@mana >= 1500)) {#ad spellcount 1;wake;tell %1 water will be last;c 'holy sight' %1;c foci %1;c fort %1;c invin %1;c armor %1;c 'holy armor' %1;c 'holy aura' %1;c bless %1;c sanc %1;tell %1 all done;c wa %1;#delitem spelllist %1;#ad spells/list/%1 1;sleep}}}
#TRIGGER {%1 tells the group 'next'} {#additem spelllist %1;gt |BC|People in line: @spelllist;gt |BC|gt |BR|split full |BC|or |BR|help|BC| to see a list of all other spells/commands;gt |BM|Please check your alignment, i cannot fullspell evil chars;gt |BC|gt 'split awen' without the quotes if you didn't check your align and just need the awen spells}
#TRIGGER {joins your group.} {gt |BC|gt |BR|'next'|BC| without the quotes to be added to the queue for |BR|FULL |BC|and |BR|SPLIT |BC|spells;gt |BC|gt |BR|help |BC|for a list of all available spells/commands;gt |BC|if someone is not responding or queue is not empty when it should be gt clear then gt next to rejoin the queue.}
#TRIGGER {%1 tells the group 'help'} {gt |BC|gt split, full, invin, invis, sanc, frenzy, fort, foci, wa(waterbreathing), invig, holy sight, remove curse, div, div2, div3, div4, div5, split awen(just awen spells), pp(portal), next(to be added to the queue), line(for list of queue), clear(clears queue DO NOT ABUSE)}
#TRIGGER {%1 tells the group 'sanc'} {wake;c sanc %1;sleep}
#TRIGGER {%1 tells the group 'split awen'} {wake;c armor %1;c 'holy armor' %1;c 'holy aura' %1;c bless %1;c sanc %1;sleep}
#TRIGGER {%1 tells the group 'invin'} {wake;c invin %1;sleep}
#TRIGGER {%1 tells the group 'div'} {wake;c div %1;sleep}
#TRIGGER {%1 tells the group 'div2'} {wake;augment 2;c div %1;augment off;sleep}
#TRIGGER {%1 tells the group 'div3'} {wake;augment 3;c div %1;augment off;sleep}
#TRIGGER {%1 tells the group 'div4'} {wake;augment 4;c div %1;augment off;sleep}
#TRIGGER {%1 tells the group 'div5'} {wake;augment 5;c div %1;augment off;sleep}
#TRIGGER {%1 stops following you.} {#delitem spelllist %1}
#TRIGGER {%1 tells the group 'clear'} {#var spelllist "";sleep}
#TRIGGER {%1 tells the group 'remove curse'} {wake;c 'remove curse' %1;sleep}
#TRIGGER {%1 now follows you.} {group %1}
#TRIGGER {Your senses return to normal.} {wake;heighten;sleep}
#TRIGGER {%1 tells the group 'line'} {gt People in line: @spelllist}
#TRIGGER {tells you} {#cap spellcap}
#TRIGGER {You dream of %1 telling you} {#cap spellcap}
#TRIGGER {%1 tells the group 'fort'} {wake;c fort %1;sleep}
#TRIGGER {%1 tells the group 'foci'} {wake;c foci %1;sleep}
#TRIGGER {%1 tells the group 'wa'} {wake;c wa %1;sleep}
#TRIGGER {tells the group 'pp %1'} {wake;c portal %1;sleep}
#TRIGGER {%1 tells the group 'invig'} {wake;c invig %1;sleep}
#TRIGGER {%1 tells the group 'frenzy'} {wake;c frenzy %1;sleep}
#TRIGGER {You fail to heighten your senses.} {wake;heighten;sleep}
#TRIGGER {%1 tells the group 'holy sight'} {wake;c 'holy sight' %1;sleep}
#TRIGGER {%1 tells the group 'invis'} {wake;c invis %1;sleep}
#TRIGGER {Spells: %1 mana} {#var mana %1}
#CLASS 0

You can copy and paste this code into your command line or copy and paste it into a text file and import it.