Rat Counter

by Unknown

Back to Mechanic's Corner.

Unknown2007-09-04 05:44:46
I'm doing a lot of ratting right now...yes I know I asked myself why too.

Anyways, I was wondering if someone could help me make a rat counter script for Lua in MushClient please. Would be greatly appreciated.
Arundor2007-09-04 05:56:07
You can pretty much do this with a single trigger and alias.

CODE
    match="^You have slain(.+)rat"
    enabled="y"
    regexp="y"
    send_to="12"
    sequence="100"
    >
    
        SetVariable("rats", GetVariable("rats") + 1)
    



    match="rats"
    enabled="y"
    send_to="12"
    sequence="100"
    >
    
        Note("You have slain " .. GetVariable("rats") .. " rats."
    

Unknown2007-09-04 06:24:16
Error number: 0
Event: Compile error
Description: :1: ')' expected near ''
Called by: Immediate execution


I got that message after putting the stuff in and hit rats to test it. What does it mean and how do I fix it?
Arundor2007-09-04 06:46:21
Meh, my fault for not testing. Sorry. Try this.

CODE
    enabled="y"
    match="^You have slain(.+)rat"
    regexp="y"
    send_to="12"
    sequence="100"
    >
    
    if (GetVariable("rats") ~= nil) then
        SetVariable("rats", GetVariable("rats") + 1)
    else
        SetVariable("rats", "1")
    end
    



    match="rats"
    enabled="y"
    send_to="12"
    sequence="100"
    >
    
    if (GetVariable("rats") ~= nil) then
        Note("You have slain " .. GetVariable("rats") .. " rats.")
    else
        Note("You have slain 0 rats.")
    end
    

Unknown2007-09-14 03:01:48
I use VBscript in mush. How could I do the same thing? It'd be a Kephera counter, though. Any help would be appreciated biggrin.gif
Arundor2007-09-14 03:25:55
I am not familiar with VBscript. However, you can use Lua and VBscript at the same time with MUSHClient's plugin system.

Try the attached plugin. It is modified to count kephera simply by changing all instances of the word "rat" to "kephera", and as a plugin it should work alongside any other scripts in other languages you may have.

Type 'kephera' to get your kephera kill count.

Unknown2007-09-14 05:44:43
Thanks man. Works like a charm.

Much <3