Difference between revisions of "Zmud Run Stats Counter"

From AvatarWiki
Jump to navigation Jump to search
 
m
 
(23 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This trigger counts the number of kills and amount of experience you have gained on a run and shows it to the group.
+
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, tosses and rescues, succesful or not.
 
 
This is a basic example, and it could be modified to show more information such as:
 
* Number of kills per hour / day
 
* Average amount of experience per kill
 
  
 
== Code ==
 
== Code ==
 +
''Copy each line individually and then paste them into zMud'' <sup>[1]</sup>'':''
 +
#TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 1} {runcounter}
 +
#TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
 +
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
 +
#TRIGGER {^You toss (%*) to the ground!} {#ad toss 1;#ad suctoss 1;#hi} {runcounter}
 +
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
 +
#TRIGGER {^You try to grab a hold, but miss!} {#ad toss 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 {^You attempt a critical golden strike!} {#ad gstrike 1} {runcounter}
 +
#TRIGGER {^You attempt a golden strike!} {#ad gstrike 1} {runcounter}
 +
#TRIGGER {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad deathloss %1;#ad netxp -%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}
 +
#TRIGGER {^You raise a level!!(%*)Your gain is: (%d)/(%d) hp, (%d)/(%d) m, (%d)/(%d) mv (%d)/(%d) prac.} {#ad lev 1;emote increases in power!! |by|%2 |y|hps|n|, |br|%4 |r|mana|n|, |bw|%8 |w|practices|n|.}
 +
#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 && @toss=0 && @rescue=0 && @tail=0 && @gstrike=0} {} {gtell %if( @bash!=0, ~|bk~| Bashes: ~|@bclr~|@sucbash~|bk~|~/~|@bclr~|@bash)%if( @trip!=0, ~|bk~| Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip)%if( @toss!=0, ~|bk~| Tosses: ~|@bclr~|@suctoss~|bk~|~/~|@bclr~|@toss)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue)%if( @tail!=0, ~|bk~| Tails: ~|@bclr~|@tail)%if( @gstrike!=0, ~|bk~| Golden strikes: ~|@bclr~|@gstrike) ~|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 toss 0;#var suctoss 0;#var rescue 0;#var sucrescue 0;#var death 0;#var deathloss 0;#var netxp 0;#var fleexp 0;#var tail 0;#var gstrike 0;#ec --- Resetting counters ---}
  
''Copy each line individually and then paste them into zMud:''
+
<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.
#VAR runexp {0}
 
#VAR runkills {0}
 
#TRIGGER {^You receive (%d) experience points.} {#AD runexp %1;#AD runkills 1}
 
#ALIAS showstats {gtell We killed @runkills Mob(s) for a total of @runexp experience!}
 
#ALIAS resetstats {#VAR runkills 0;#VAR runexp 0}
 
  
 
== Usage ==
 
== Usage ==
 +
After adding everything line by line, be sure to use resetrun at least once before you run, so all the variables exist.
  
To show the stats, type <B>showstats</B> at any time.<BR>
+
To set the worship part to the right deity, just look at your score. Otherwise, or for atheist, it will show Snikt.
To reset the stats to 0, type <B>resetstats</B><BR>
 
  
== How It Works ==
+
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, tnossed or rescued, it will show you the, succesful and total, number of those.
  
#VAR runexp {0}
+
The command '''resetrun''' will reset the counters.
This line creates a new Variable <tt>#VAR</tt> called "runexp" <tt>runexp</tt> and sets the initial value to 0 <tt>{0}</tt>
 
#VAR runkills {0}
 
This line creates a new Variable <tt>#VAR</tt> called "runkills" <tt>runkills</tt> and sets the initial value to 0 <tt>{0}</tt>
 
  
''zMud uses variables such as these to store data, it can store numbers like this example uses, but they could also be used to store letters or words.''
+
== How It Works ==
 
+
  #TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 1} {runcounter}
  #TRIGGER {^You receive (%d) experience points.} {#AD runexp %1;#AD runkills 1}
+
#TRIGGER {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad deathloss %1;#ad exp -%1} {runcounter}
This line creates a new Trigger <tt>#TRIGGER</tt> which will activate when it sees "You receive (%d) experience points." from the mud <tt>{^You receive (%d) experience points.}</tt>. It will then add the correct amount of experience points to our runexp variable <tt>{#AD runexp %1</tt> and add one kill to our run kills variable <tt>;#AD runkills 1}</tt>.
+
#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}
''zMud uses triggers to interpret information sent from the mud. A trigger accepts at least two arguments. The first argument tells it which line from the mud will make the trigger activate, and the second argument tells it what it should do when it is activated. Arguments are generally placed inside brackets { }.''
+
#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}
''There are a couple of things of interest here. First off, the caret ^ in front of the first argument tells zMud to only activate if the text is seen at the beginning of the line. We do this so if someone in chat says: "You receive 581982051 experience points." then our trigger won't mistakenly add experience points. The caret operator is very useful against trigger abuse.''
+
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.
  
''Also, look at the <tt>(%d)</tt> in the first argument. There are two important things to notice about it. We use %d instead of an actual number because there are many possible numbers that the mud could send here. You could get 5 exp from a mob or you could 128 exp. By putting %d, we tell zMud to accept any number here. The %d is in parentheses to tell zMud that we want to keep track of specifically which number the mud outputs. In the second argument, you can see a <tt>%1</tt>. This is where the number is actually used.
+
#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}
 +
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.
  
''Whenever you see a pound sign before a word (generally in caps) such as <tt>#AD</tt> you know that there is a zMud command being sent. In this case, AD is short for the 'add' command which adds a number to a variable.
+
#TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
 +
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
 +
#TRIGGER {^You toss(%*) to the ground!} {#ad toss 1;#ad suctoss 1;#hi} {runcounter}
 +
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
 +
#TRIGGER {^You try to grab a hold, but miss!} {#ad toss 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}
 +
All these count the number of bashes, tosses, trips and rescues. It also keeps track of whether or not you fail them.
  
  #ALIAS showstats {gtell We killed @runkills Mob(s) for a total of @runexp experience!}
+
  #VAR worship {Snikt}
This line makes a new Alias <tt>#ALIAS</tt> which will activate when you type <tt>showstats</tt> thus sending a group tell to the mud saying the amount of exp and kills so far <tt>{gtell We killed @runkills Mob(s) for a total of @runexp experience!}</tt>.
+
#TRIGGER {You are (%*) and a worshipper of (%x).} {#var worship %2} {runcounter}
 +
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.
  
''zMud aliases are very similar to [[Alias |aliases in avatar]]. They are essentially shortcuts. Anytime you type the first argument (in this case "showstats"), it will send the second argument to the mud. Unlike an avatar alias however, you can use a zMud alias to send variables, which we do twice in this example. When zMud sees a word with <tt>@</tt> in front of it, it will replace that word with whatever number/word/letter is in the variable of the same name. So we use our runkills and runexp aliases from before to show the number of kills and experience.''
+
#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}
 +
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.
  
''This is the line you would change if you wanted to send your own custom line to the mud.''
+
#ALIAS stats {#if {@bash=0 && @trip=0 && @toss=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( @toss!=0, ~|bk~| Tosses: ~|@bclr~|@suctoss~|bk~|~/~|@bclr~|@toss)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue) ~|w~|}}
 +
Stats outputs your bash, trip, toss 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 Tosses: 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 resetstats {#VAR runkills 0;#VAR runexp 0}
+
  #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 line creates a new Alias <tt>#ALIAS</tt> which will activate when you type resetstats <tt>resetstats</tt> and then reset our variables to 0 <tt>{#VAR runkills 0;#VAR runexp 0}</tt>.
+
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.
  
''This is an example of a zMud alias that doesn't actually send any information to the mud. Note that there are two different commands taking place in the second argument. Whenever you want to send two different commands in the same argument, make sure they are seperated by a semicolon.
+
#ALIAS resetrun {#var exp 0;#var cnt 0;#var lev 0;#var bash 0;#var sucbash 0;#var trip 0;#var suctrip 0;#var toss 0;#var suctoss 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.
  
''The #VAR command takes 2 arguments, the first is the name of the variable to be modified, and the second is the new value of the variable. This command will replace whatever information is currently in the variable.
+
[[Category: Zmud Scripting]]

Latest revision as of 07:25, 29 October 2009

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, tosses and rescues, succesful or not.

Code

Copy each line individually and then paste them into zMud [1]:

#TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 1} {runcounter}
#TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
#TRIGGER {^You toss (%*) to the ground!} {#ad toss 1;#ad suctoss 1;#hi} {runcounter}
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
#TRIGGER {^You try to grab a hold, but miss!} {#ad toss 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 {^You attempt a critical golden strike!} {#ad gstrike 1} {runcounter}
#TRIGGER {^You attempt a golden strike!} {#ad gstrike 1} {runcounter}
#TRIGGER {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad deathloss %1;#ad netxp -%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}
#TRIGGER {^You raise a level!!(%*)Your gain is: (%d)/(%d) hp, (%d)/(%d) m, (%d)/(%d) mv (%d)/(%d) prac.} {#ad lev 1;emote increases in power!! |by|%2 |y|hps|n|, |br|%4 |r|mana|n|, |bw|%8 |w|practices|n|.}
#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 && @toss=0 && @rescue=0 && @tail=0 && @gstrike=0} {} {gtell %if( @bash!=0, ~|bk~| Bashes: ~|@bclr~|@sucbash~|bk~|~/~|@bclr~|@bash)%if( @trip!=0, ~|bk~| Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip)%if( @toss!=0, ~|bk~| Tosses: ~|@bclr~|@suctoss~|bk~|~/~|@bclr~|@toss)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue)%if( @tail!=0, ~|bk~| Tails: ~|@bclr~|@tail)%if( @gstrike!=0, ~|bk~| Golden strikes: ~|@bclr~|@gstrike) ~|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 toss 0;#var suctoss 0;#var rescue 0;#var sucrescue 0;#var death 0;#var deathloss 0;#var netxp 0;#var fleexp 0;#var tail 0;#var gstrike 0;#ec --- Resetting counters ---}

[1] 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

After adding everything line by line, be sure to use resetrun at least once before you run, so all the variables exist.

To set the worship part to the right deity, just look at your score. Otherwise, or for atheist, it will show Snikt.

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, tnossed or rescued, it will show you the, succesful and total, number of those.

The command resetrun will reset the counters.

How It Works

#TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad netxp %1;#ad cnt 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}

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 {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}

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 {^You attempt to bash} {#ad bash 1;stand} {runcounter}
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
#TRIGGER {^You toss(%*) to the ground!} {#ad toss 1;#ad suctoss 1;#hi} {runcounter}
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
#TRIGGER {^You try to grab a hold, but miss!} {#ad toss 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}

All these count the number of bashes, tosses, trips and rescues. It also keeps track of whether or not you fail them.

#VAR worship {Snikt}
#TRIGGER {You are (%*) and a worshipper of (%x).} {#var worship %2} {runcounter}

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.

#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}

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 && @toss=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( @toss!=0, ~|bk~| Tosses: ~|@bclr~|@suctoss~|bk~|~/~|@bclr~|@toss)%if( @rescue!=0, ~|bk~| Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue) ~|w~|}}

Stats outputs your bash, trip, toss 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 Tosses: 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 toss 0;#var suctoss 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.