Difference between revisions of "Zmud Run Stats Counter"

From AvatarWiki
Jump to navigation Jump to search
m
(And here's the new thing I've made. Well, modified a _lot_ from someone else's version.)
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, throws 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:''
 
''Copy each line individually and then paste them into zMud:''
  #VAR runexp {0}
+
  #TRIGGER {^You receive (%d) experience points.} {#ad exp %1;#ad cnt 1} {runcounter}
  #VAR runkills {0}
+
#TRIGGER {^You attempt to bash} {#ad bash 1;stand} {runcounter}
  #TRIGGER {^You receive (%d) experience points.} {#AD runexp %1;#AD runkills 1}
+
#TRIGGER {^You bash into (%*) goes down!} {#ad bash 1;#ad sucbash 1} {runcounter}
  #ALIAS showstats {gtell We killed @runkills Mob(s) for a total of @runexp experience!}
+
#TRIGGER {^You throw (%*) to the ground!} {#ad throw 1;#ad sucthrow 1;#hi} {runcounter}
  #ALIAS resetstats {#VAR runkills 0;#VAR runexp 0}
+
#TRIGGER {^You trip (%*) goes down!} {#ad trip 1;#ad suctrip 1} {runcounter}
 
+
#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 {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad dloss %1;#ad exp -%1} {runcounter}
 +
#TRIGGER {You are (%*) and a 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} {gtell |bk|By |@bclr|@death |bk|death(s) I've lost |@bclr|@deathloss |bk|xp, so net gain is @netxp.};stats}
 +
#ALIAS stats {#if {@bash=0 && @trip=0 && @throw=0 && @rescue=0} {} {gtell %if( @bash!=0, ~|bk~|Bashes: ~|@bclr~|@sucbash~|@bclr~|~/~|@bclr~|@bash~|w~|) %if( @trip!=0, ~|bk~|Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip~|w~|) %if( @throw!=0, ~|bk~|Throws: ~|@bclr~|@sucthrow~|bk~|~/~|@bclr~|@throw~|w~|) %if( @rescue!=0, ~|bk~|Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue~|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;#ec --- Resetting counters ---}
 +
 
== 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 it will snow Snikt, for atheist.
To reset the stats to 0, type <B>resetstats</B><BR>
 
 
 
== How It Works ==
 
  
#VAR runexp {0}
+
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, 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.
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.''
+
The command '''resetrun''' will reset the counters.
  
#TRIGGER {^You receive (%d) experience points.} {#AD runexp %1;#AD runkills 1}
+
== How It Works ==
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>.
+
I really don't want to get into that now :P I'll do it later.
 
 
''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 { }.''
 
 
 
''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.''
 
 
 
''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.
 
 
 
''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.
 
 
 
#ALIAS showstats {gtell We killed @runkills Mob(s) for a total of @runexp experience!}
 
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>.
 
 
 
''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.''
 
 
 
''This is the line you would change if you wanted to send your own custom line to the mud.''
 
 
 
#ALIAS resetstats {#VAR runkills 0;#VAR runexp 0}
 
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 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.
 
 
 
''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]]
 
[[Category: Zmud Scripting]]

Revision as of 15:04, 10 May 2007

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.

Code

Copy each line individually and then paste them into zMud:

#TRIGGER {^You receive (%d) experience points.} {#ad exp %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 throw (%*) to the ground!} {#ad throw 1;#ad sucthrow 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 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 {^Death sucks (%*) experience points from you as payment for resurrection.} {#ad death 1;#ad dloss %1;#ad exp -%1} {runcounter}
#TRIGGER {You are (%*) and a 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} {gtell |bk|By |@bclr|@death |bk|death(s) I've lost |@bclr|@deathloss |bk|xp, so net gain is @netxp.};stats}
#ALIAS stats {#if {@bash=0 && @trip=0 && @throw=0 && @rescue=0} {} {gtell %if( @bash!=0, ~|bk~|Bashes: ~|@bclr~|@sucbash~|@bclr~|~/~|@bclr~|@bash~|w~|) %if( @trip!=0, ~|bk~|Trips: ~|@bclr~|@suctrip~|bk~|~/~|@bclr~|@trip~|w~|) %if( @throw!=0, ~|bk~|Throws: ~|@bclr~|@sucthrow~|bk~|~/~|@bclr~|@throw~|w~|) %if( @rescue!=0, ~|bk~|Rescues: ~|@bclr~|@sucrescue~|bk~|~/~|@bclr~|@rescue~|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;#ec --- Resetting counters ---}

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 it will snow Snikt, for atheist.

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, 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.

The command resetrun will reset the counters.

How It Works

I really don't want to get into that now :P I'll do it later.