Triggers/script for keeping statistics of spells and displaying them?

Posted by Quintosh on Sun 24 Aug 2014 05:04 PM — 3 posts, 14,404 views.

#0
So hi, first of all I have to say that I'm not any good at doing these kind of things and most of my experience comes making more simpler triggers, and I just started using MUSHclient after I could no longer use my trusted zmud 7.04 (great sadness :< ) so I'm a bit unfamiliar with it.

What I want to do is to create a trigger/script that captures certain actions from the mud and keeps count of them so you could view them in some fancy boxes, here's a very simplified example what I had in mind:


+--------------------------------------------------------+
|hit messagebox  |spirit | elemental|beast|behemoth|demon|
+--------------------------------------------------------+
|reaves          |nmbrs of hits by beast type| | | |     |
+--------------------------------------------------------+
|tears           |   #   |   #      | #   |  #     |     |
+--------------------------------------------------------+
|viciously reaves|  #    |   #      |  #  |  #     |     |
+--------------------------------------------------------+



Something like that. So basicly what happens is that you cast a spell, and then some "minion" comes out from it, spirit elemental etc. And depending on how hard it hits, the hit messages change. What I want to do is somehow make a trigger to count the hits made by the separate "minions" and also make a command to view these statistics. An example of the hits:

The abominable elemental brutally slashes Willem hitting his torso with its monstrous claws, causing shards of bone and pieces of tissue to JOLT away!

or

The dreadful spirit tears Willem hitting his left foreleg with its horrible claws, causing bones to sparkle and break with the hit!

who hit and how hard and how many times.

[EDIT] Code tags added.
Amended on Sun 24 Aug 2014 08:00 PM by Nick Gammon
#1
Another thing that I want to do, with the similar statistical view is to make a counter to see what "minions" I draw out from the portals, elemental type and size of the minion".

few examples.

"A voltaic spirit of oppression appears from the yellow portal." where the 'spirit' part is the size of the minion, and the color part 'yellow' tells the type, which would be lightning in this case.

or

"A freezing elemental of destruction appears from the blue portal." Same thing, 'elemental' for the size, and 'blue' for the type, which would be cold.

the tablet would look something like this.


+---------------+-------+----+-----+------+
|         |Blue |Yellow |Red |White| Brown|
+---------+-----+-------+----+-----+------+
|Demon    |  #  |  #    | #  |  #  |  #   |
+------- -+-----+-------+----+-----+------+
|Behemoth |  #  |  #    | #  |  #  |  #   |
+-------- +-----+-------+----+-----+------+
|Beast    |  #  |  #    | #  |  #  |  #   |
+---------+-----+-------+----+-----+------+
|Elemental|  #  |  #    | #  |  #  |  #   |
+---------+-----+-------+----+-----+------+
|Spirit   |  #  |  #    | #  |  #  |  #   |
+---------+-----+-------+----+-----+------+


where the # are the number of the "minions" that appear from the portals. I have absolutely no clue how to even begin doing this, I could use all the help I can get, or if someone manages to build a working scripts for that, I might even give you some compensation :P

(edit. damn tablet got borked on submit and broke my fancy ascii, but I think you guys understand what I mean regardless)
Amended on Sun 24 Aug 2014 07:52 PM by Nick Gammon
Australia Forum Administrator #2
Quote:

(edit. damn tablet got borked on submit and broke my fancy ascii, but I think you guys understand what I mean regardless)


Template:codetag
To make your code more readable please use [code] tags as described here.






Well, before you display those nice tables you have to collect the data. Make some simple triggers that match those messages, and display the results. This is the first step.

Here is an example to get you started:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^An? (?&lt;element&gt;\w+) (?&lt;size&gt;\w+) of (?&lt;type&gt;\w+) appears from the (?&lt;portal&gt;\w+) portal\.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

Note ("element = %&lt;element&gt;")
Note ("size = %&lt;size&gt;")
Note ("type = %&lt;type&gt;")
Note ("portal = %&lt;portal&gt;")

</send>
  </trigger>
</triggers>



Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Test output:


A voltaic spirit of oppression appears from the yellow portal.
element = voltaic
size = spirit
type = oppression
portal = yellow
A freezing elemental of destruction appears from the blue portal.
element = freezing
size = elemental
type = destruction
portal = blue