mIRC Home    About    Download    Register    News    Help

Print Thread
Game Counter #184287 27/08/07 12:22 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
Hi i was wondering if it was possible for someone to write me a script ill try to explain as best i can...

$won - If someone typed it then what happens is the bot would ask for proof, so then they have to post some proof like a image of the game that they have just won, then when they have posted the link they have to type $proof, then the bot would say something like please wait for confirmation off someone in the channel, then someone from the channel would look at the image and if its right they would type $yes but then it needs two more people to type that then that person would get 10 points added to his nick and count that as a win and the bot would say something but if they said $no then it would need two more people to type $no then the bot would not add anything and say some other stuff.

$lost - Basically would just count that as a loss.

$draw - Same as $won but only add 5 points.

$stats - Would post the players points Example: Rank: 1 - You Have 30 Points with: 2 Wins - 2 Draws - 1 Losers, eles You have no points BuTLeR

$scores - Would post the the top 10 players i.e 1)BuTLeR: 30 - 2)Nick2: 25 - 3)Nick3: 15 etc...

$deduct (nick) (points) - If the owner types that then it would deduct the points from that nicks score.

$clear (nick) - If the owner types that then it would clear all the nicks points.

$clearall - If the owner types that then it would clear all the points in its database

Well thats it i know its alot to ask for but i would really appreciate it if some nice person would do this for me thankyou.


At Your Service.
Re: Game Counter [Re: BuTLeR] #184833 01/09/07 11:38 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
anyone? =/


At Your Service.
Re: Game Counter [Re: BuTLeR] #184841 02/09/07 01:40 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, let's see...

Code:
on *:text:$*:#yourchan: {
  if (!$hget(GameStats)) { 
    hmake GameStats 100
    if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
  }
  if ($1- == $won || $1- == $draw) {
    msg $chan Please provide proof of your win, then type $proof followed by a link to your proof.  Eg. $proof http://www.proof.com/
    if ($hget(Won. $+ $nick)) { hfree Won. $+ $nick }
    hmake Won. $+ $nick 5
    hadd Won. $+ $nick Type $right($1,-1)
  }
  elseif ($1 == $proof) {
    if (!$hget(Won. $+ $nick)) { msg $chan Please type $won before using $proof. | return }
    if (!$2) { msg $chan Please include a link to your proof.  Eg. $proof http://www.proof.com/ | return }
    msg $chan Please wait for confirmation.
    hadd Won. $+ $nick Proof $2-
  }
  elseif ($1 == $yes || $1 == $no) {
    if (!$2) { msg $chan Please include the nick who you are confirming.  Eg. $yes Nick | return }
    if (!$hget(Won. $+ $2)) { msg $chan $2 hasn't used $won yet. | return }
    if (!$hget(Won. $+ $2,Proof)) { msg $chan $2 hasn't used $proof yet. | return }
    if ($istok($hget(Won. $+ $2,Yes)),$nick,32) || $istok($hget(Won. $+ $2,No)),$nick,32)) { msg $chan You have already voted on the proof. | return }
    if ($1 == $yes) { hadd Won. $+ $2 Yes $hget(Won. $+ $2,Yes) $nick }
    elseif ($1 == $no) { hadd Won. $+ $2 No $hget(Won. $+ $2,No) $nick }
    if ($numtok($hget(Won. $+ $2,Yes),32) >= 3) {
      if ($hget(Won. $+ $2,Type) == Won) {
        msg $chan $2 gets 10 points for the win.
        hinc GameStats $nick $+ .Points 10
        hinc GameStats $nick $+ .Wins
      }
      elseif ($hget(Won. $+ $2,Type) == Draw) {
        msg $chan $2 gets 5 points for the draw.
        hinc GameStats $nick $+ .Points 5
        hinc GameStats $nick $+ .Draws
      }
      hsave GameStats $scriptdir GameStats.hsh
    }
    elseif ($numtok($hget(Won. $+ $2,No),32) >= 3) {
      msg $chan $2 gets 0 points because of a lack of good proof.
      hfree Won. $+ $2
    }
  }
  elseif ($1 == $lost) {
    hinc GameStats $nick $+ .Loses
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $stats) {
    if (!$2) {
      var %Nick = $nick
    }
    else {
      var %Nick = $2
    }
    if ($hget(GameStats,%Nick $+ .Points)) {
      hsave -n GameStats $scriptdir\GameStats.tmp
      filter -ffcuten 1 32 $scriptdir\GameStats.tmp
      hsave -i GameStats $scriptdir\GameStats2.tmp
      var %line = $read($scriptdir\GameStats2.tmp,s,%Nick $+ =)
      var %line = $calc($readn - 1)
      var %rank = $read($scriptdir\GameStats.tmp,s,%line $+ $chr(32))
      var %rank = $readn
      msg $chan Rank: %rank - $iif(%Nick == $nick,You have,%Nick has) $hget(GameStats,%Nick $+ .Points) with: $hget(GameStats,%Nick $+ .Wins) Wins - $hget(GameStats,%Nick $+ .Draws) Draws - $hget(GameStats,%Nick $+ .Loses) Loses.
      .remove $scriptdir\GameStats.tmp
      .remove $scriptdir\GameStats2.tmp
    }
    else msg $chan $iif(%Nick == $nick,You have,%Nick has) no points.
  }
  elseif ($1 == $scores) {
    hsave -n GameStats $scriptdir\GameStats.tmp
    filter -ffcuten 1 32 $scriptdir\GameStats.tmp
    var %cnt = 1
    var %lines = $iif($lines($scriptdir\GameStats.tmp) < 10,$v1,10)
    while (%cnt <= %lines) {
      var %data = $read($scriptdir\GameStats.tmp,%cnt)
      var %Top10 = $iif(%Top10,$chr(32) $+ -) %cnt $+ $chr(41) $hget(GameStats,$gettok(%data,1,32)).item $+ : $gettok(%data,2,32)
      inc %cnt
    }
    msg $chan Top Players: %Top10
    .remove $scriptdir\GameStats.tmp
  }
}
on *:input:*: {
  if ($* iswm $1) {
    if (!$hget(GameStats)) { 
      hmake GameStats 100
      if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
    }
  }
  if ($1 == $deduct) {
    if ($3 !isnum) { echo -a Please include a nick and points to deduct.  Eg. $deduct $me 5 | return }
    echo -a Points deducted from $2 -- $hget(GameStats,$2 $+ .Points) - $3 = $calc($hget(GameStats,$2 $+ .Points) - $3)
    hdec GameStats $2 $+ .Points $3
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clear) {
    if (!$2) { echo -a Please include a nick to clears stats for. | return }
    hdel GameStats $2 $+ .Points
    hdel GameStats $2 $+ .Wins
    hdel GameStats $2 $+ .Draws
    hdel GameStats $2 $+ .Loses
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clearall) {
    hfree GameStats
    .remove $scriptdir\GameStats.hsh
  }
}


This may not be the best way, but it should work. It's not tested, though, so let me know of any problems. I've included "error" messages when commands aren't done the right way. You can change the wording, add colors/formatting, or remove them as needed.


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: Riamus2] #184869 02/09/07 10:55 AM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
Thanks Riamus2 for helping but nothing seems to be working for me =[

Any idea why?


At Your Service.
Re: Game Counter [Re: BuTLeR] #184871 02/09/07 12:53 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Add these aliases and it may work:

Code:
alias lost return $!lost
alias draw return $!draw
alias stats {
  if ($isid) return $!stats
  else stats $1- 
}
alias scores return $!scores
alias deduct return $!deduct
alias clear {
  if ($isid) return $!clear
  else clear $1-
}
alias clearall {
  if ($isid) return $!clearall
  else clearall
}


I haven't tried checking if there are any other mistakes in his code and there are better ways to fix it, but this is the easiest grin

Re: Game Counter [Re: hixxy] #184872 02/09/07 01:03 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
I still get nothing =[


At Your Service.
Re: Game Counter [Re: BuTLeR] #184881 02/09/07 03:11 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As I said, it wasn't tested and writing something that big without testing can be problematic. In any case, please be more exact in what isn't working for you. What messages do you get? Check the status window.

Remember that the client running the script cannot use any commands other than the ones you said only the "owner" could do.


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: hixxy] #184882 02/09/07 03:12 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
hixxy, what will those do differently?


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: Riamus2] #184899 02/09/07 05:33 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You have made the script so that it evaluates all of the triggers.

For example,

Code:
elseif ($1 == $proof) {


This means that when somebody types whatever $proof evaluates to, the script within will trigger. He wants it so that somebody can literally use the text "$proof" as a trigger, so what I've done is made a bunch of aliases that return their own names.

Re: Game Counter [Re: hixxy] #184913 02/09/07 07:40 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ah. I wasn't thinking about that. I never use $ with triggers, so didn't think about them causing that problem.


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: Riamus2] #184915 02/09/07 08:01 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
Originally Posted By: Riamus2
As I said, it wasn't tested and writing something that big without testing can be problematic. In any case, please be more exact in what isn't working for you. What messages do you get? Check the status window.

Remember that the client running the script cannot use any commands other than the ones you said only the "owner" could do.


Nothing is working i dont even get any thing in the status window =/


At Your Service.
Re: Game Counter [Re: BuTLeR] #184917 02/09/07 08:10 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
You know the script is for remote right?

Someone else have to type the commands that are in the on text event.
Only the on input command you can trigger yourself.

It needs to be on a bot.

Re: Game Counter [Re: OrionsBelt] #184919 02/09/07 08:18 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
Yes i know that xD


At Your Service.
Re: Game Counter [Re: BuTLeR] #184988 03/09/07 04:14 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Did you try what hixxy suggested? Alternatively, you can change all $* stuff to !* or another character. The $ is making it think it's an identifier rather than a trigger. hixxy's addition should fix that problem, but you can save yourself the problem in the first place by not using $. As I mentioned, I wasn't thinking about the $ being a problem when I wrote it.


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: Riamus2] #185335 08/09/07 07:20 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
-[ 20:12.13 ]- -( @`g4z0rz- ): $won
-[ 20:12.19 ]- -( @`g4z0rz- ): $lost
-[ 20:12.26 ]- -( @`g4z0rz- ): $draw
-[ 20:12.28 ]- -( @`TiNy ): Please provide proof of your win, then type followed by a link to your proof. Eg. http://imageshack.us/
-[ 20:12.34 ]- -( @`g4z0rz- ): $scores
-[ 20:12.35 ]- -( @`TiNy ): Top Players:
-[ 20:13.08 ]- -( @`g4z0rz- ): $stats
-[ 20:13.09 ]- -( @`TiNy ): You have no points.
-[ 20:13.21 ]- -( @`g4z0rz- ): $deduct
-[ 20:13.25 ]- -( @`g4z0rz- ): $clear
-[ 20:13.30 ]- -( @`g4z0rz- ): $clearall
-[ 20:14.47 ]- -( @`g4z0rz- ): $yes
-[ 20:14.48 ]- -( @`TiNy ): Please include the nick who you are confirming. Eg. $yes Nick
-[ 20:14.53 ]- -( @`g4z0rz- ): $no
-[ 20:14.54 ]- -( @`TiNy ): Please include the nick who you are confirming. Eg. $yes Nick
-[ 20:15.06 ]- -( @`g4z0rz- ): =/


see...


At Your Service.
Re: Game Counter [Re: BuTLeR] #185382 08/09/07 11:56 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
on *:text:$*:#: {
  if (!$hget(GameStats)) { 
    hmake GameStats 100
    if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
  }
  if ($1- == $won || $1- == $draw) {
    msg $chan Please provide proof of your win, then type $proof followed by a link to your proof.  Eg. $proof http://www.proof.com/
    if ($hget(Won. $+ $nick)) { hfree Won. $+ $nick }
    hmake Won. $+ $nick 5
    hadd Won. $+ $nick Type $right($1,-1)
  }
  elseif ($1 == $proof) {
    if (!$hget(Won. $+ $nick)) { msg $chan Please type $won before using $proof. | return }
    if (!$2) { msg $chan Please include a link to your proof.  Eg. $proof http://www.proof.com/ | return }
    msg $chan Please wait for confirmation.
    hadd Won. $+ $nick Proof $2-
  }
  elseif ($1 == $yes || $1 == $no) {
    if (!$2) { msg $chan Please include the nick who you are confirming.  Eg. $yes Nick | return }
    if (!$hget(Won. $+ $2)) { msg $chan $2 hasn't used $won yet. | return }
    if (!$hget(Won. $+ $2,Proof)) { msg $chan $2 hasn't used $proof yet. | return }
    if ($istok($hget(Won. $+ $2,Yes),$nick,32) || $istok($hget(Won. $+ $2,No),$nick,32)) { msg $chan You have already voted on the proof. | return }
    if ($1 == $yes) { hadd Won. $+ $2 Yes $hget(Won. $+ $2,Yes) $nick }
    elseif ($1 == $no) { hadd Won. $+ $2 No $hget(Won. $+ $2,No) $nick }
    if ($numtok($hget(Won. $+ $2,Yes),32) >= 3) {
      if ($hget(Won. $+ $2,Type) == Won) {
        msg $chan $2 gets 10 points for the win.
        if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),1,32) + 10),1,32)
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),2,32) + 1),2,32)
      }
      elseif ($hget(Won. $+ $2,Type) == Draw) {
        msg $chan $2 gets 5 points for the draw.
        if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),1,32) + 5),1,32)
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),3,32) + 1),3,32)
      }
      hsave GameStats $scriptdir\GameStats.hsh
    }
    elseif ($numtok($hget(Won. $+ $2,No),32) >= 3) {
      msg $chan $2 gets 0 points because of a lack of good proof.
      hfree Won. $+ $2
    }
  }
  elseif ($1 == $lost) {
    if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
    hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),4,32) + 1),4,32)
    hsave GameStats $scriptdir\GameStats.hsh
    msg $chan Loss added to $nick $+ .
  }
  elseif ($1 == $stats) {
    if (!$2) {
      var %Nick = $nick
    }
    else {
      var %Nick = $2
    }
    if ($hget(GameStats,%Nick)) {
      hsave -n GameStats $scriptdir\GameStats.tmp
      filter -ffcuten 1 32 $scriptdir\GameStats.tmp $scriptdir\GameStats.tmp
      hsave -i GameStats $scriptdir\GameStats2.tmp
      var %line = $read($scriptdir\GameStats2.tmp,w, [ %Nick ] $+ =*)
      var %line = $calc($readn - 1)
      var %rank = $read($scriptdir\GameStats.tmp,s, [ %line ] )
      var %rank = $readn
      tokenize 32 $hget(GameStats,%Nick)
      msg $chan Rank: %rank - $iif(%Nick == $nick,You have,%Nick has) $1 points with: $2 Wins - $3 Draws - $4 Loses.
      .remove $scriptdir\GameStats.tmp
      .remove $scriptdir\GameStats2.tmp
    }
    else msg $chan $iif(%Nick == $nick,You have,%Nick has) no points.
  }
  elseif ($1 == $scores) {
    hsave -n GameStats $scriptdir\GameStats.tmp
    filter -ffcuten 1 32 $scriptdir\GameStats.tmp $scriptdir\GameStats.tmp
    var %cnt = 1
    var %lines = $iif($lines($scriptdir\GameStats.tmp) < 10,$v1,10)
    while (%cnt <= %lines) {
      var %data = $read($scriptdir\GameStats.tmp,%cnt)
      var %Top10 = %Top10 $iif(%Top10,$chr(32) $+ -) %cnt $+ $chr(41) $hget(GameStats,$gettok(%data,1,32)).item $+ : $gettok(%data,2,32)
      inc %cnt
    }
    msg $chan Top Players: %Top10
    .remove $scriptdir\GameStats.tmp
  }
}
on *:input:*: {
  if ($* iswm $1) {
    if (!$hget(GameStats)) { 
      hmake GameStats 100
      if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
    }
  }
  if ($1 == $deduct) {
    if ($3 !isnum) { echo -a Please include a nick and points to deduct.  Eg. $deduct $me 5 | return }
    echo -a Points deducted from $2 -- $gettok($hget(GameStats,$2),1,32) - $3 = $calc($gettok($hget(GameStats,$2),1,32) - $3)
    if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
    hadd GameStats $2 $puttok($hget(GameStats,$2),$calc($gettok($hget(GameStats,$2),1,32) - $3),1,32)
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clear) {
    if (!$2) { echo -a Please include a nick to clears stats for. | return }
    echo -a All points removed for $2 $+ .
    hdel GameStats $2
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clearall) {
    echo -a All scores deleted.
    hfree GameStats
    .remove $scriptdir\GameStats.hsh
  }
}
alias won return $!won
alias lost return $!lost
alias draw return $!draw
alias proof return $!proof
alias stats {
  if ($isid) return $!stats
  else stats $1- 
}
alias scores return $!scores
alias deduct return $!deduct
alias clear {
  if ($isid) return $!clear
  else clear $1-
}
alias clearall {
  if ($isid) return $!clearall
  else clearall
}


Remember that you can only use the $deduct, $clear, $clearall commands from the bot.


Invision Support
#Invision on irc.irchighway.net
Re: Game Counter [Re: Riamus2] #185434 09/09/07 01:13 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
Thanks it works but i wanted to make the deduct, clear ect commands work for the owner of the bot in the userlist not in the bot its self =/


At Your Service.
Re: Game Counter [Re: BuTLeR] #185442 09/09/07 03:40 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, put the owner in the UserList as:

owner:nick!ident@host.com

(using whatever mask you want for it. You just need owner: in front)

Then use:
Code:
on *:text:$*:#: {
  if (!$hget(GameStats)) { 
    hmake GameStats 100
    if ($isfile($scriptdir\GameStats.hsh)) { hload GameStats $scriptdir\GameStats.hsh }
  }
  if ($1- == $won || $1- == $draw) {
    msg $chan Please provide proof of your win, then type $proof followed by a link to your proof.  Eg. $proof http://www.proof.com/
    if ($hget(Won. $+ $nick)) { hfree Won. $+ $nick }
    hmake Won. $+ $nick 5
    hadd Won. $+ $nick Type $right($1,-1)
  }
  elseif ($1 == $proof) {
    if (!$hget(Won. $+ $nick)) { msg $chan Please type $won before using $proof. | return }
    if (!$2) { msg $chan Please include a link to your proof.  Eg. $proof http://www.proof.com/ | return }
    msg $chan Please wait for confirmation.
    hadd Won. $+ $nick Proof $2-
  }
  elseif ($1 == $yes || $1 == $no) {
    if (!$2) { msg $chan Please include the nick who you are confirming.  Eg. $yes Nick | return }
    if (!$hget(Won. $+ $2)) { msg $chan $2 hasn't used $won yet. | return }
    if (!$hget(Won. $+ $2,Proof)) { msg $chan $2 hasn't used $proof yet. | return }
    if ($istok($hget(Won. $+ $2,Yes),$nick,32) || $istok($hget(Won. $+ $2,No),$nick,32)) { msg $chan You have already voted on the proof. | return }
    if ($1 == $yes) { hadd Won. $+ $2 Yes $hget(Won. $+ $2,Yes) $nick }
    elseif ($1 == $no) { hadd Won. $+ $2 No $hget(Won. $+ $2,No) $nick }
    if ($numtok($hget(Won. $+ $2,Yes),32) >= 3) {
      if ($hget(Won. $+ $2,Type) == Won) {
        msg $chan $2 gets 10 points for the win.
        if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),1,32) + 10),1,32)
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),2,32) + 1),2,32)
      }
      elseif ($hget(Won. $+ $2,Type) == Draw) {
        msg $chan $2 gets 5 points for the draw.
        if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),1,32) + 5),1,32)
        hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),3,32) + 1),3,32)
      }
      hsave GameStats $scriptdir\GameStats.hsh
    }
    elseif ($numtok($hget(Won. $+ $2,No),32) >= 3) {
      msg $chan $2 gets 0 points because of a lack of good proof.
      hfree Won. $+ $2
    }
  }
  elseif ($1 == $lost) {
    if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
    hadd GameStats $nick $puttok($hget(GameStats,$nick),$calc($gettok($hget(GameStats,$nick),4,32) + 1),4,32)
    hsave GameStats $scriptdir\GameStats.hsh
    msg $chan Loss added to $nick $+ .
  }
  elseif ($1 == $stats) {
    if (!$2) {
      var %Nick = $nick
    }
    else {
      var %Nick = $2
    }
    if ($hget(GameStats,%Nick)) {
      hsave -n GameStats $scriptdir\GameStats.tmp
      filter -ffcuten 1 32 $scriptdir\GameStats.tmp $scriptdir\GameStats.tmp
      hsave -i GameStats $scriptdir\GameStats2.tmp
      var %line = $read($scriptdir\GameStats2.tmp,w, [ %Nick ] $+ =*)
      var %line = $calc($readn - 1)
      var %rank = $read($scriptdir\GameStats.tmp,s, [ %line ] )
      var %rank = $readn
      tokenize 32 $hget(GameStats,%Nick)
      msg $chan Rank: %rank - $iif(%Nick == $nick,You have,%Nick has) $1 points with: $2 Wins - $3 Draws - $4 Loses.
      .remove $scriptdir\GameStats.tmp
      .remove $scriptdir\GameStats2.tmp
    }
    else msg $chan $iif(%Nick == $nick,You have,%Nick has) no points.
  }
  elseif ($1 == $scores) {
    hsave -n GameStats $scriptdir\GameStats.tmp
    filter -ffcuten 1 32 $scriptdir\GameStats.tmp $scriptdir\GameStats.tmp
    var %cnt = 1
    var %lines = $iif($lines($scriptdir\GameStats.tmp) < 10,$v1,10)
    while (%cnt <= %lines) {
      var %data = $read($scriptdir\GameStats.tmp,%cnt)
      var %Top10 = %Top10 $iif(%Top10,$chr(32) $+ -) %cnt $+ $chr(41) $hget(GameStats,$gettok(%data,1,32)).item $+ : $gettok(%data,2,32)
      inc %cnt
    }
    msg $chan Top Players: %Top10
    .remove $scriptdir\GameStats.tmp
  }
  elseif ($1 == $deduct && $ulevel == owner) {
    if ($3 !isnum) { msg $nick Please include a nick and points to deduct.  Eg. $deduct $me 5 | return }
    msg $nick Points deducted from $2 -- $gettok($hget(GameStats,$2),1,32) - $3 = $calc($gettok($hget(GameStats,$2),1,32) - $3)
    if (!$hget(GameStats,$nick)) { hadd GameStats $nick 0 0 0 0 }
    hadd GameStats $2 $puttok($hget(GameStats,$2),$calc($gettok($hget(GameStats,$2),1,32) - $3),1,32)
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clear && $ulevel == owner) {
    if (!$2) { msg $nick Please include a nick to clears stats for. | return }
    msg $nick All points removed for $2 $+ .
    hdel GameStats $2
    hsave GameStats $scriptdir\GameStats.hsh
  }
  elseif ($1 == $clearall && $ulevel == owner) {
    msg $nick All scores deleted.
    hfree GameStats
    .remove $scriptdir\GameStats.hsh
  }
}
alias won return $!won
alias lost return $!lost
alias draw return $!draw
alias proof return $!proof
alias stats {
  if ($isid) return $!stats
  else stats $1- 
}
alias scores return $!scores
alias deduct return $!deduct
alias clear {
  if ($isid) return $!clear
  else clear $1-
}
alias clearall {
  if ($isid) return $!clearall
  else clearall
}


Invision Support
#Invision on irc.irchighway.net