Word Scramble Game Script for mIRC Twitch Bot and AnkhBot

By Blasman on Dec 29, 2015

UPDATE (January 3, 2016) ::: I will be updating these scripts and adding more at GitHub rather than here, as it makes things a lot easier. https://github.com/Blasman/mIRC-Twitch-Scripts

Download Here: https://dl.dropboxusercontent.com/u/1231209/mIRCscram.rar

UPDATE (December 31, 2015) ::: Fixed blank name when the bot replies that a targeted user is not in the channel. Made it so that a user can't target the bot as player 2.

This script is for the Scramble Game that I use in my Twitch channel at twitch.tv/Blasman13 . I am using a combination of mIRC and AnkhBot for use with my Twitch bot. What this script does is use the currency database from AnkhBot for adding and removing points, so you do not need a separate point system for the game.

The game is a TWO player word guessing game, where the bot will rearrange the letters of a five-letter word and whisper the scrambled word to the two players that have agreed to play against each other. The first player to successfully whisper the correct unscrambled word back to the bot will win the game as well as the amount of points that were agreed upon from the other player.

Command List:

!scram on = Mod Only. This command will enable the game in your channel.
!scram off = Mod Only. This command will disable the game in your channel.
!scram = This command will give an info message about how to play the game as well as additional commands.
!scram # = Example: !scram 100. This is for a user to start the game as player 1 with X amount of their points on the line. The bot will start a 90 second timer to wait for a second player to join.
!scram # username = Example: !scram 100 blasman. This command is for a user to start the game as player 1, but only the username at the end of the command will be able to join the game as player 2.
!scram accept = When there is a player 1 waiting for a player 2, this command will join the game as player 2.
!scramstats = This command will tell a user their overall win/loss record for the game, as well as their fastest time to win the game.
!scramstats username = This command will tell a user their win/loss record against the username in the command.
!scramtop = This command will list the top 5 players with the most wins, as well as the 5 fastest times to win the game.

Install Instructions

These steps assume that you do not have mIRC installed and running as a Twitch bot. If you do, skip Steps 1 and 2. If you have my Slot Machine script up and running, then you only need to load the last script from Step 5 (you can also delete the twitch_name, addpoints, removepoints, and checkpoints aliases from this script).

Step 1: Download and install mIRC. UNCHECK EVERYTHING except "Scripts" and "Help Files" on the "Choose Components" section of the install, as you don't need most of it. http://www.mirc.com/get.html

Step 2: Get your bot's Twitch account up and running with mIRC, and set up your Twitch channel as an auto-join channel as well. See http://help.twitch.tv/customer/portal/articles/1302780-twitch-irc#mIRC%20guide or https://www.youtube.com/watch?v=k7ULgVCZ3Ns

Step 3: Put all the files from the mIRCscram.rar file into your mIRC's script directory. By default, it should be your mIRC's root directory, something like C:\Users\USERNAME\AppData\Roaming\mIRC\ ... replace "USERNAME" with your Windows username... an easy way to get to this directory is by typing %APPDATA%/mIRC in your Windows Folder titlebar.

Step 4: Edit the scramble.mrc file in a text editor. Change the variables at the top to what they need to be. The only ones that you need to change are %CurrencyDB and %chan. Also, in the unlikely event that something would happen to go wrong, it's a good idea to make a back-up of your CurrencyDB.sqlite file.

Step 5: Load all the scripts that are needed by typing the following commands in mIRC's Status window. Blindly agree to any prompts that may pop-up. If mIRC says "no such file," then you did something wrong, such as putting the files in the wrong directory.

/load -rs JSON.mrc
/load -rs mTwitch.mrc
/load -rs msqlite.mrc
/load -rs scramble.mrc

Step 6: Profit. Type "!scram on" and "!scram off" to activate and deactivate the game. Test it out. Make sure that the points are being added/removed. You can view the sections of my mIRC YouTube video that talk about having mIRC be as unobtrusive as possible and running automatically if you want as well. https://www.youtube.com/watch?v=k7ULgVCZ3Ns

Credits (and most recent versions of scripts):
Original Scramble Script / Inspiration: http://hawkee.com/snippet/2807/
The JSON.mrc script: http://hawkee.com/snippet/10194/
The mTwitch.mrc script: http://hawkee.com/snippet/16487/
The msqlite.mrc script: http://hawkee.com/scripts/11648275/
AnkhBot: http://marcinswierzowski.com/Code/AnkhBotR2/

The script pasted below is the copy of scramble.mrc included in the mIRCscram.rar file.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VARIABLES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/*
HEY!  LOOK HERE!  This is what you need to change in this script...
Where it says "SET %CurrencyDB" below, change the path to the path of
YOUR AnkhBot's CurrencyDB.sqlite file.  Leave the quotation marks in!
It is likely the same path as the example listed, with the exception of
your Windows username.

Change the %scram_minbet and %scram_maxbet to the minimum and maximum
amount of points that must be spent in order to play the game.  The
%scram_cd variable is the per user cooldown time (in seconds) that a user
must wait before being able to use !scram again.  The %curname variable
is the name of your channel currency.  Change %chan to your Twitch
username and keep the # symbol at the start of it.

You will need to UNLOAD and RE-LOAD this script for any changes to the
variables below to take effect.  This can be done by pressing ALT-R in
mIRC > Select "View" > Select "slot.mrc" > Click on "File" > "Unload."
Then, click on "File" and "Load..." and select the slot.mrc file again.

Have fun!!!
*/

ON *:LOAD: {
  SET %CurrencyDB "C:\Users\USERNAME\AppData\Roaming\AnkhHeart\AnkhBotR2\Twitch\Databases\CurrencyDB.sqlite"
  SET %curname points
  SET %scram_minbet 1
  SET %scram_maxbet 500
  SET %scram_cd 120
  SET %chan #Your_Twitch_Name
}

ON *:UNLOAD: {
  UNSET %CurrencyDB
  UNSET %curname
  UNSET %scram_*
  UNSET %chan
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIASES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias twitch_name {

  if (%tn == 1000) %tn = 0
  inc %tn
  JSONOpen -ud twitch_name $+ %tn https://api.twitch.tv/kraken/channels/ $+ $1
  return $json(twitch_name $+ %tn $+ , display_name)
  JSONClose twitch_name $+ %tn
}

alias addpoints {

  set %ankhbot_currency $sqlite_open(%CurrencyDB)
  if (!%ankhbot_currency) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  var %sql_points = SELECT Points FROM CurrencyUser WHERE Name = ' $+ $1 $+ ' COLLATE NOCASE
  var %request_points = $sqlite_query(%ankhbot_currency, %sql_points)
  if (!%request_points) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  $sqlite_fetch_row(%request_points, row)
  var %ankhbot_points = $hget(row, Points)

  SET %newpoints = $calc(%ankhbot_points + $2)
  sqlite_exec %ankhbot_currency UPDATE CurrencyUser SET Points %newpoints WHERE Name = ' $+ $1 $+ ' COLLATE NOCASE
  sqlite_free %request_points
  UNSET %newpoints
}

alias removepoints {

  set %ankhbot_currency $sqlite_open(%CurrencyDB)
  if (!%ankhbot_currency) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  var %sql_points = SELECT Points FROM CurrencyUser WHERE Name = ' $+ $1 $+ ' COLLATE NOCASE
  var %request_points = $sqlite_query(%ankhbot_currency, %sql_points)
  if (!%request_points) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  $sqlite_fetch_row(%request_points, row)
  var %ankhbot_points = $hget(row, Points)

  SET %newpoints = $calc(%ankhbot_points - $2)
  sqlite_exec %ankhbot_currency UPDATE CurrencyUser SET Points %newpoints WHERE Name = ' $+ $1 $+ ' COLLATE NOCASE
  sqlite_free %request_points
  UNSET %newpoints
}

alias checkpoints {

  set %ankhbot_currency $sqlite_open(%CurrencyDB)
  if (!%ankhbot_currency) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  var %sql_points = SELECT Points FROM CurrencyUser WHERE Name = ' $+ $1 $+ ' COLLATE NOCASE
  var %request_points = $sqlite_query(%ankhbot_currency, %sql_points)
  if (!%request_points) {
    echo 4 -a Error: %sqlite_errstr
    return
  }
  if ($sqlite_num_rows(%request_points) == 0) { return false }
  else {
    $sqlite_fetch_row(%request_points, row)
    var %ankhbot_points = $hget(row, Points)
    if (%ankhbot_points < $2) { return false }
    elseif (%ankhbot_points >= $2) { return true }
    sqlite_free %request_points
  }
}

alias scramble {

  IF ($len($1) >= 3) {
    WHILE (($len(%scrambled) < $len($1)) || ($1 == %scrambled)) {
      IF ($1 == %scrambled) { VAR %scrambled = "" | VAR %used = "" }
      VAR %current = $r(1,$len($1))
      IF ($istok(%used,%current,32) == $false) {
        VAR %scrambled = %scrambled $+ $mid($1,%current,1)
        VAR %used = %used %current
      }
    }
    RETURN %scrambled
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;; SCRAMBLE GAME ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

ON $*:TEXT:/^!scram(ble)?\s(on|off)/Si:#: {

  IF ($nick isop $chan) {
    IF ($2 == on) {
      IF (!%GAMES_SCRAM_ACTIVE) {
        SET %GAMES_SCRAM_ACTIVE On
        MSG $chan $twitch_name($nick) $+ , the word scramble game is now enabled!  Type !scram for more info!  Have fun!  PogChamp
      }
      ELSE MSG $chan $twitch_name($nick) $+ , !scram is already enabled.  FailFish
    }
    ELSEIF ($2 == off) {
      IF (%GAMES_SCRAM_ACTIVE) {
        UNSET %GAMES_SCRAM_ACTIVE
        MSG $chan $twitch_name($nick) $+ , the scramble game is now disabled.
      }
      ELSE MSG $chan $twitch_name($nick) $+ , !scram is already disabled.  FailFish
    }
  }
}

ON $*:TEXT:/^!scram(ble)?(\s|$)/iS:#: {

  IF ($($+(%,floodSCRAM.,$nick),2)) halt
  SET -u3 %floodSCRAM. $+ $nick On
  IF (!%GAMES_SCRAM_ACTIVE) {
    IF ((%floodSCRAM_ACTIVE) || ($($+(%,floodSCRAM_ACTIVE.,$nick),2))) halt
    SET -u15 %floodSCRAM_ACTIVE On
    SET -u120 %floodSCRAM_ACTIVE. $+ $nick On
    MSG $chan $twitch_name($nick) $+ , the word scramble game is currently disabled.
    halt
  }
  ELSEIF ($2 isnum %scram_minbet - %scram_maxbet) && (!%scram.p1) {
    IF ($($+(%,SCRAM_CD.,$nick),2)) MSG $nick $twitch_name($nick) $+ , please wait for your cooldown to expire in $duration(%SCRAM_CD. [ $+ [ $nick ] ]) before trying to play scramble again.
    ELSEIF ($checkpoints($nick, $2) == false) MSG $chan $twitch_name($nick) $+ , you don't have enough %curname to play.  FailFish
    ELSEIF (!$3) {
      SET %scram.p1 $twitch_name($nick)
      SET %scram.bet $floor($2)
      MSG $chan KAPOW %scram.p1 has issued a scramble challenge for %scram.bet %curname to the first person to accept within 90 seconds!  To accept this challenge type "!scram accept"
      .timer.scram.wait1 1 90 MSG $chan Sorry, %scram.p1 $+ , but nobody wanted to accept your scramble challenge!  FeelsBadMan
      .timer.scram.wait2 1 90 UNSET %scram.*
      .timer.scram.wait3 1 90 SET -z %SCRAM_CD. $+ $nick %scram_cd
    }
    ELSEIF ($3) && ($3 != $me) {
      IF ($3 ison $chan) {
        IF ($checkpoints($3, $2) == false) MSG $chan $twitch_name($nick) $+ , $twitch_name($3) doesn't have enough %curname to play.  FailFish
        ELSE {
          SET %scram.p1 $twitch_name($nick)
          SET %scram.p2 $twitch_name($3)
          SET %scram.bet $floor($2)
          MSG $chan KAPOW %scram.p1 has issued a scramble challenge for %scram.bet %curname to %scram.p2 $+ !  %scram.p2 now has 90 seconds to accept this challenge by typing "!scram accept"
          .timer.scram.wait1 1 90 MSG $chan Sorry, %scram.p1 $+ , but %scram.p2 didn't want to accept your scramble challenge!  FeelsBadMan
          .timer.scram.wait2 1 90 UNSET %scram.*
          .timer.scram.wait3 1 90 SET -z %SCRAM_CD. $+ $nick %scram_cd
        }
      }
      ELSE MSG $chan $twitch_name($nick) $+ , $3 is not the name of a user here in the channel.  Please check the spelling and make sure that they are actually here.
    }
  }
  ELSEIF ((%scram.p1) && ($nick != %scram.p1) && ($2 == accept)) {
    IF (!%scram.p2) {
      IF ($checkpoints($nick, %scram.bet) == false) MSG $chan $twitch_name($nick) $+ , you don't have enough %curname to play.  FailFish
      ELSE SET %scram.p2 $twitch_name($nick)
    }
    IF ((%scram.p2 == $nick) && (!$timer(.scram.start)) && (!%scram.origword)) {
      .timer.scram.wait* off
      MSG $chan %scram.p2 has accepted the scramble challenge of %scram.p1 $+ !  In a few moments, I will WHISPER both players with the scramble challenge, and the first player to WHISPER the correct answer to me will win %scram.bet %curname from the other player!
      .timer.scram.start 1 10 startscramble1
    }
  }
  ELSEIF (!%scram.p1) {
    IF (%floodSCRAMinfo) halt
    SET -u6 %floodSCRAMinfo On
    MSG $chan Try word scramble with a friend to try and win each others %curname $+ !  Just type "!scram $chr(91) $+ %scram_minbet $+ - $+ %scram_maxbet $+ $chr(93) $+ " to play against ANYONE, -or- type "!scram $chr(91) $+ %scram_minbet $+ - $+ %scram_maxbet $+ $chr(93) username" to play against a specific person! ▌ Example:  !scram %scram_maxbet ▌ Additional Commands: !scramtop  ▌ !scramstats  ▌ !scramstats username
  }
}

alias startscramble1 {

  WRITEINI scramstats.ini %scram.p1 Games $calc($readini(scramstats.ini,%scram.p1,Games) + 1)
  WRITEINI scramstats.ini %scram.p2 Games $calc($readini(scramstats.ini,%scram.p2,Games) + 1)
  SET %scram.origword $read(ScrambleWords.txt)
  SET %scram.scramword $scramble(%scram.origword)
  MSG %scram.p1 %scram.p1 $+ , I'm going to WHISPER you the scrambled word to guess in ten seconds!  You may KEEP GUESSING until you get it right!  Get ready!
  MSG %scram.p2 %scram.p2 $+ , I'm going to WHISPER you the scrambled word to guess in ten seconds!  You may KEEP GUESSING until you get it right!  Get ready!
  .timer.scram.start2 1 10 startscramble2
}

alias startscramble2 {

  MSG %scram.p1 Scrambled word is $qt(%scram.scramword) $+ .  Start guessing now!
  MSG %scram.p2 Scrambled word is $qt(%scram.scramword) $+ .  Start guessing now!
  SET %scram.start $ticks
  .timer.scram.hint1 1 12 MSG %scram.p1 HINT:  $qt($left(%scram.origword,1) $+ ____)
  .timer.scram.hint2 1 12 MSG %scram.p2 HINT:  $qt($left(%scram.origword,1) $+ ____)
  .timer.scram.hint3 1 24 MSG %scram.p1 HINT:  $qt($left(%scram.origword,2) $+ ___)
  .timer.scram.hint4 1 24 MSG %scram.p2 HINT:  $qt($left(%scram.origword,2) $+ ___)
  .timer.scram.hint5 1 36 MSG %scram.p1 HINT:  $qt($left(%scram.origword,3) $+ __)
  .timer.scram.hint6 1 36 MSG %scram.p2 HINT:  $qt($left(%scram.origword,3) $+ __)
  .timer.scram.end1 1 46 MSG %scram.p1 The !scramble game took too long!  Nobody wins!  The word was $qt(%scram.origword) $+ .
  .timer.scram.end2 1 46 MSG %scram.p2 The !scramble game took too long!  Nobody wins!  The word was $qt(%scram.origword) $+ .
  .timer.scram.end3 1 46 WRITEINI scramstats.ini %scram.p1 Losses $calc($readini(scramstats.ini,%scram.p1,Losses) + 1)
  .timer.scram.end4 1 46 WRITEINI scramstats.ini %scram.p1 Losses_VS_ $+ %scram.p2 $calc($readini(scramstats.ini,%scram.p1,Losses_VS_ $+ %scram.p2) + 1)
  .timer.scram.end5 1 46 WRITEINI scramstats.ini %scram.p2 Losses $calc($readini(scramstats.ini,%scram.p2,Losses) + 1)
  .timer.scram.end6 1 46 WRITEINI scramstats.ini %scram.p2 Losses_VS_ $+ %scram.p1 $calc($readini(scramstats.ini,%scram.p2,Losses_VS_ $+ %scram.p1) + 1)
  .timer.scram.end7 1 46 UNSET %scram.*
  .timer.scram.end8 1 47 MSG %chan Nobody won the game of !scramble between %scram.p1 and %scram.p2 $+ !  They were both WAY too slow!  The word was $qt(%scram.origword) scrambled as $qt(%scram.scramword) $+ .
}

ON *:TEXT:*:?: {

  IF (%scram.start) {
    IF (($1 == %scram.origword) && (($nick == %scram.p1) || ($nick == %scram.p2))) {
      VAR %diff = $ticks - %scram.start
      VAR %scram.finish = $regsubex($duration($calc(%diff / 1000),1),/\D+/g,) $+ . $+ $right(%diff,3)
      .timer.scram.* off
      IF ($nick == %scram.p1) { SET %scram.winner %scram.p1 | SET %scram.loser %scram.p2 }
      IF ($nick == %scram.p2) { SET %scram.winner %scram.p2 | SET %scram.loser %scram.p1 }
      WRITEINI scramstats.ini %scram.winner Wins $calc($readini(scramstats.ini,%scram.winner,Wins) + 1)
      WRITEINI scramstats.ini %scram.winner Wins_VS_ $+ %scram.loser $calc($readini(scramstats.ini,%scram.winner,Wins_VS_ $+ %scram.loser) + 1)
      WRITEINI scramstats.ini %scram.loser Losses $calc($readini(scramstats.ini,%scram.loser,Losses) + 1)
      WRITEINI scramstats.ini %scram.loser Losses_VS_ $+ %scram.winner $calc($readini(scramstats.ini,%scram.loser,Losses_VS_ $+ %scram.winner) + 1)
      VAR %w.wins $readini(scramstats.ini,%scram.winner,Wins)
      VAR %w.losses $readini(scramstats.ini,%scram.winner,Losses)
      VAR %l.wins $readini(scramstats.ini,%scram.loser,Wins)
      VAR %l.losses $readini(scramstats.ini,%scram.loser,Losses)
      VAR %vs.wins $readini(scramstats.ini,%scram.winner,Wins_VS_ $+ %scram.loser)
      VAR %vs.losses $readini(scramstats.ini,%scram.winner,Losses_VS_ $+ %scram.loser)
      IF (%w.losses == $null) VAR %w.losses = 0
      IF (%l.wins == $null) VAR %l.wins = 0
      IF (%vs.losses == $null) VAR %vs.losses = 0
      .timer.scram.loser 1 1 MSG %scram.loser You lost, %scram.loser $+ !  %scram.winner got the correct answer!  It was %scram.origword $+ !  FeelsBadMan  [Total Wins: %l.wins $+ ] [Total Losses: %l.losses $+ ] [Wins vs %scram.winner $+ : %vs.losses $+ ] [Losses vs %scram.winner $+ : %vs.wins $+ ]
      .timer.scram.winner 1 2 MSG %scram.winner That's correct! Great job, %scram.winner $+ ! You won %scram.bet %curname from %scram.loser $+ !  PogChamp  [Total Wins: %w.wins $+ ] [Total Losses: %w.losses $+ ] [Wins vs %scram.loser $+ : %vs.wins $+ ] [Losses vs %scram.loser $+ : %vs.losses $+ ]
      MSG %chan Congrats to %scram.winner who just won %scram.bet %curname from %scram.loser in %scram.finish seconds in the scramble challenge!  The word was $qt(%scram.origword) scrambled as $qt(%scram.scramword) $+ .
      ADDPOINTS %scram.winner %scram.bet
      REMOVEPOINTS %scram.loser %scram.bet
      IF ($readini(scramstats.ini,%scram.winner,Best_Time) == $null) WRITEINI scramstats.ini %scram.winner Best_Time %scram.finish
      ELSEIF ($readini(scramstats.ini,%scram.winner,Best_Time) > %scram.finish) {
        WRITEINI scramstats.ini %scram.winner Best_Time %scram.finish
        .timer.scram.newtime 1 5 MSG %scram.winner You got a new personal BEST TIME of %scram.finish seconds for completing a game of scramble!  Congrats!
      }
      SET -z %SCRAM_CD. $+ %scram.p1 %scram_cd
      UNSET %scram.*
    }
  }
}

ON *:TEXT:!scramstats*:#: {

  IF ($($+(%,floodSCRAMstats.,$nick),2)) halt
  SET -u3 %floodSCRAMstats. $+ $nick On
  VAR %nick $twitch_name($nick)
  IF ($ini(scramstats.ini,%nick) == $null) MSG $chan %nick $+ , you have yet to play a game of word scramble here!
  ELSEIF (!$2) {
    VAR %wins $readini(scramstats.ini,%nick,Wins)
    VAR %losses $readini(scramstats.ini,%nick,Losses)
    VAR %besttime $readini(scramstats.ini,%nick,Best_Time)
    MSG $chan %nick ▌ Scramble Stats ▌ Wins: %wins ▌ Losses: %losses ▌ Fastest Time: %besttime seconds
  }
  ELSEIF ($ini(scramstats.ini,$2) == $null) MSG $chan %nick $+ , $2 is not the name of a user who has played scramble here before!
  ELSEIF ($readini(scramstats.ini,%nick,Wins_VS_ $+ $2) == $null) && ($readini(scramstats.ini,%nick,Losses_VS_ $+ $2) == $null) MSG $chan %nick $+ , you have never played scramble against $2 before!
  ELSE {
    VAR %vs.nick $twitch_name($2)
    VAR %vs.wins $readini(scramstats.ini,%nick,Wins_VS_ $+ %vs.nick)
    VAR %vs.losses $readini(scramstats.ini,%nick,Losses_VS_ $+ %vs.nick)
    IF (%vs.wins == $null) VAR %vs.wins = 0
    IF (%vs.losses == $null) VAR %vs.losses = 0
    MSG $chan %nick ▌ Scramble Win/Loss Record vs %vs.nick ▌ Wins: %vs.wins ▌ Losses: %vs.losses
  }
}

ON *:TEXT:!scramtop:#: {

  IF (%floodSCRAMtop) halt
  SET -u10 %floodSCRAMtop On
  window -h @. | var %i 1
  WHILE $ini(scramstats.ini,%i) {
    aline @. $v1 $readini(scramstats.ini,$v1,Wins)
    INC %i
  }
  filter -cetuww 2 32 @. @.
  VAR %i 1 | while %i <= 5 {
    tokenize 32 $line(@.,%i)
    VAR %name $chr(35) $+ %i $1 $chr(40) $+ $2 $+ $chr(41) -
    VAR %list $addtok(%list, %name, 32)
    INC %i
  }
  VAR %list $left(%list, -1)
  VAR %list Scramble Top Players ▌ Most Wins: %list ▌ Fastest Times:
  window -c @.
  window -h @. | var %i 1
  WHILE $ini(scramstats.ini,%i) {
    aline @. $v1 $readini(scramstats.ini,$v1,Best_Time)
    INC %i
  }
  filter -ctuww 2 32 @. @.
  VAR %i 1 | while %i <= 5 {
    tokenize 32 $line(@.,%i)
    VAR %name $chr(35) $+ %i $1 $chr(40) $+ $2 $+ $chr(41) -
    VAR %list $addtok(%list, %name, 32)
    INC %i
  }
  VAR %list $left(%list, -1)
  MSG $chan %list
  window -c @.
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.