Kills and deaths counter for zmud

by Acrune

Back to Mechanic's Corner.

Acrune2008-01-19 17:09:40
Made this up in about a half hour, since people seem to be interested it. Chances are the death counter will be wrong if you do any fighting vs illusionists, since "You have slain ..." illusions come up, so be aware of that.

QUOTE('Kill counter')
---------------------Killed stuff---------------------
a rat: 1
an old rat: 1
a fearsome tiger shark: 3
a boxturtle: 2
a squat pelican: 1
------------------------------------------------------
Total kills: 8
------------------------------------------------------


QUOTE('Death counter')
-----------------Stuff that killed you-----------------
Acrune: 4
a gigantic panda: 1
-------------------------------------------------------
Total deaths: 5
-------------------------------------------------------


CODE
#CLASS {killCounter}
#ALIAS showkills {
  #VA totalKills 0
  #show ---------------------Killed stuff---------------------
  #LOOPDB @killList {
    #SHOW %replace( %key, '_', ' '): %val
    #ad totalKills %val
    }
  #show ------------------------------------------------------
  #show Total kills: @totalKills
  #show ------------------------------------------------------
  }
#ALIAS resetkills {
  #va killList ""
  #SA
  #SA Kills reset
  }
#ALIAS showdeaths {
  #VA totalDeaths 0
  #show -----------------Stuff that killed you-----------------
  #LOOPDB @deathList {
    #SHOW %replace( %key, '_', ' '): %val
    #AD totalDeaths %val
    }
  #show -------------------------------------------------------
  #show Total deaths: @totalDeaths
  #show -------------------------------------------------------
  }
#ALIAS resetdeaths {
  #va deathList ""
  #SA
  #SA Deaths reset
  }
#VAR killList {a_rat1an_old_rat1a_fearsome_tiger_shark3a_boxturtle2a_squat_pelican1}
#VAR totalKills {8}
#VAR deathList {Acrune4a_gigantic_panda1}
#VAR totalDeaths {5}
#TRIGGER {You have slain (*).} {#add killList.%replace( %1, ' ', '_') 1}
#TRIGGER {You have been slain by (*).} {#add deathList.%replace( %1, ' ', '_') 1}
#CLASS 0


SHOWKILLS shows the kill list
SHOWDEATHS shows the death list
RESETKILLS resets the kill list
RESETDEATHS resets the death list

Edit: Heh, whoops, this doesn't work for some things. Doh. Maybe I'll fix it eventually
Rika2008-01-19 19:08:59
Where do I find 'a gigantic panda'?
Acrune2008-01-20 00:44:27
In the echo alias that I used to test the triggers.