Kill counter for cMUD

by Ilyarin

Back to Mechanic's Corner.

Ilyarin2008-01-19 17:25:10
KILLS to see what you've killed.
RESETKILLS to reset what you've kileld.

It should work for all cMUD versions, but it was created on 1.34.

CODE
#alias kills {#if (@killDatabase != %null) {
  #if (%-1 == %null) {
    #echo You have killed:
    $num = 1
    $key = 0
    #loopdb @killDatabase {
      #if ($num = 1) {
        #echop ~ %key
        #addkey killDatabase key %key
        $num = 0
      } {
        #echo %ansi(grey)%repeat(" ",35-%len(@killDatabase.key))~ %key
        $num = 1
      }
    }
    #if ($num = 0) {
      #echop %null
    }
  } {
    #echo you have killed:
    $num = 1
    $key = 0
    #loopdb @killDatabase {
      #if (%pos({%-1},%key)) {
        #if ($num = 1) {
          #echop ~ %key
          #addkey killDatabase key %key
          $num = 0
        } {
          #echo %ansi(grey)%repeat(" ",35-%len(@killDatabase.key))~ %key
          $num = 1
        }
      }
    }
    #if ($num = 0) {
      #echop %null
    }
  }
  #delkey killDatabase key
} {
  #echo You have not killed anything!
}}


#alias resetKills {#echo Resetting the kill Database.
#var killDatabase %null}





#trigger {^You have slain (*).$} {#if (%iskey(@killDatabase,{%1})) {
  $num = %db(@killDatabase,{%1}) + 1
  #addkey killDatabase {%1} $num
} {
  #addkey killDatabase {%1} 1
}}