Genesis Forums
https://www.genesismud.org/forums/

Tracking kills?
https://www.genesismud.org/forums/viewtopic.php?f=37&t=4199
Page 1 of 1

Author:  bashere [ 21 Nov 2017 23:50 ]
Post subject:  Tracking kills?

Using webui or perhaps in-game means, is there a way to keep running stats on total kills, kills by race, species, etc.?

Author:  bashere [ 22 Nov 2017 00:11 ]
Post subject:  Re: Tracking kills?

Google Analytics tagging might work.. Just searching ideas atm.

Author:  cotillion [ 22 Nov 2017 13:36 ]
Post subject:  Re: Tracking kills?

It's fairly easy in the web client.
Here's a quick example that should work.

Create a regexp trigger
Pattern: ^You killed the (.*) ([a-z]+).$

Code:
gwc.userdata.kills = gwc.userdata.kills || {};
var race = args['2'];

function increment(type) {
  gwc.userdata.kills[type] = (gwc.userdata.kills[type] || 0) + 1;
  return gwc.userdata.kills[type];
}

var total = increment('total');
if (total % 100 == 0) {
  gwc.output.append('You have killed ' + total + ' enemies', 'red');
}

total = increment(race);
if (total % 10 == 0) {
  gwc.output.append('You have killed ' + total + ' ' + race, 'red');
}

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/