;****************************************************************************
; Word Frenzy (C)2003 by Geezer & Wolf 
; Debugged/Upgraded by CalSingle, [Ice][Angel] & Petertje in September 2004 
; Thanks to [Ice][Angel] for the Top5 alias
; Thanks to Petertje for the Color alias
;****************************************************************************
;WordFrenzy Version 4.0
;Modified by OtherwiseBrunette
;http://groups.msn.com/BrunsStuff/
;****************************************************************************
menu menubar { 
  - 
  Word Frenzy
  .=Word Frenzy= ( $+ %WFrenzy $+ )
  ..On: .enable #WordFrenzyV4 | set %WFrenzy Enabled | msg $chan (o) Word Frenzy 4.0 ~ Enabled. Type !WordFrenzy to Play (o) | echo -a * Word Frenzy Loaded
  ..Off: .disable #WordFrenzyV4 | set %WFrenzy Disabled | msg $chan (o) Word Frenzy 4.0 ~ Disabled - Game Over. | echo -a * Word Frenzy Unloaded
  .Initialise : DoInit 
  .-
  ..Steal Game ( $+ $group(#wfsteal) $+ )
  ...$iif($group(#wfsteal) == on,$style(2),$style(0)) On:.enable #wfsteal | echo -a * Steal Game - on
  ...$iif($group(#wfsteal) == off,$style(2),$style(0)) Off:.disable #wfsteal | echo -a * Steal Game - off
  .Start WordFrenzy : $startgame
  .Start Team Match: $startgame(team) 
  .Stop WordFrenzy: stopgame
  .-
  .Options: /dialog -m WFrenzy WFrenzy
  .Pause WordFrenzy: pause
  .Resume WordFrenzy: resume
  .-
  .Set Room :  %frenzy.channel = $chan | echo -a * Word Frenzy Channel set to $chan
  .Set Directory: set %frenzy.dir $mircdir
  .Reset Score files
  ..Sure : DeleteScores 
  .-
  .Show Scores
  ..Show Player's stat: { Dostatother  $$?="Enter Player's Nick"  }
  ..Show Frenzy's Hall of Fame: { wfhof }
  .. Show Best Round Scores : { bestrounds }
  .. Show Best Word Scores : { bestwords }
  .. Show Maximum Words : { maxwords }
  .Word Frenzy HTML
  ..Create Scores HTML: { WFhtmlbuild }
  ..Create Team HTML : { WFTeamhtmlbuild }
  ..Read HTML Scores: / run WordFrenzy.html
  ..Read Team HTML :/ run TEamwf.html
  ..See List of Commands: / run Commands.html
  .Frenzy Files
  ..View Word List:/run notepad.exe text\10letters.txt 
  ..Frenzy Dictionary:/run notepad.exe text\dictionary.txt 
  ..Word Submissions:/run notepad.exe text\WFaddword.txt 
  ..ReadMe File:/run notepad.exe text\WordFrenzy-readme.txt 
  .-
  .Unload Word Frenzy 
  ..Sure: unload -rs games\wordfrenzyv4.mrc
} 

#WordFrenzyV4 off

On *:TEXT:!WordFrenzy:#: { 
  if (!%msg.Frenzy. [ $+ [ $nick ] ]) { msg $chan (o) Lets play Scramble Frenzy (o) } 
  if (!%msg.Frenzy. [ $+ [ $nick ] ]) { msg $chan (o) Type !WFstart to play, !WFhelp for commands } 
  set -u5 %msg.Frenzy. [ $+ [ $nick ] ] $true 
} 

on *:text:*:*: { playgame $Strip($1-) | if (%WF.Playing == Yes) WFidletimer } 
on *:action:*:*: { playgame $Strip($1-) | if (%WF.Playing == Yes) WFidletimer } 


alias DoInit { 
  if ($exists(Commands.html) == $false ) { ListofCommands } 
  set %WF.Playing No |  set %WF.Font Verdana |  set %WF.Min 3 |  set %WF.Max 10 |  set %WF.ReSpam 3 | set %starttimer 5 
  set %Roundtimer 75 |  set %Breaktimer 30 |  set %wf.oponly 0 |  set %wf.penalty 0
  set %frenzy.channel #temp |  unset %dialog.* | set %wf.html.hof 1 |  set %wf.html.BRound 1 | set %wf.html.lengths 1 | set %wf.html.Wscores 1
  set %wf.html.Mwords 1 | set %WFversion  4.0 | set %frenzy.dir $mircdir |  set %wordlist %frenzy.dir $+ text\10letters.txt | set %dictionary %frenzy.dir $+ text\dictionary.txt
  set %champmode 1 | set %champgoal 2000 |  teamoptions
  if ($1 != WFstart) { describe $active has initialized the Word Frenzy game. Type !WordFrenzy for play (Y) | return } 
} 
alias teamoptions {
  set %timer 10 | set %frenzy.team.1 Blue |  set %frenzy.team.2 Red |  set %limitjoin 1 | set %allowjoin 1
  set %noteamwin There is no winner, you are both losers... :p
  set %team1win The *T1 crushed the *T2 |  set %team2win The *T2 crushed the *T2 
}
alias DeleteScores {
  remove FrenzyScores.ini | remove frenzyscores.txt | unset %team.* | remove wordscores.ini 
  remove BestRs.ini | remove bestteamrs.ini | remove teamwordscores.ini |  remove maxword.ini | remove wordscores.txt | remove maxword.txt | remove bestrs.txt
}
alias PlayGame { 
  if ($nick isop $chan) || ( %wf.oponly == 0 ) {
    if ($1 == !testing) { msg %frenzy.channel $hof(1) } 
    if ($1 == !WFstart) { sshowword  $2- | return } 
    if ($1 == !NFstart) { nshowword  $2- | return }
    if ($1 == !WFstop) && ( %frenzy.teammode == 0) { stopgame $2- | return } 
    if ($1 == !NFstop) && ( %frenzy.teammode == 0) { stopgame $2- | return } 
    if ($1 == !WFpause) { pause | return }
    if ($1 == !WFresume) { resume | return }
    if ($1 == !WFrepeat) { spamword | return } 
  }
  if ($1 == !WFscores) { showallscores | return } 
  if ($1 == !WFbestrounds) { bestrounds | return }
  if ($1 == !WFbestwords) { bestwords | return }
  if ($1 == !WFwinners) { wfchamps | return }
  if ($1 == !WFlongest) { Docoll darkred b Longest word : %wf.longest.text by: %wf.longest.name }
  if ( $1 == !join &&  %frenzy.teammode == 1 ) { $setteam($nick , $2) }
  if (!WFhelp isin $1) { dohelp | return } 
  if (!WFhof isin $1) { WFHof | return } 
  if (!WFcommands isin $1) { doWFcommands | return } 
  if (!WFchamp isin $1) { doChamp | return } 
  if (!WFMaxwords isin $1) { maxwords | return } 
  if (!WFstat isin $1) && ($2) { dostatother $2 | return } 
  if ($1 == !wfshowteams &&  %frenzy.teammode == 1) { Docoll darkred b Current members are : wfteamblue | wfteamred }
  if (!WFstat isin $1) { dostat $nick | return } 
  if (!WFscoreOf isin $1) { dostatof $2 | return } 
  if (!WFobject isin $1) { doWFobject | return } 
  if (!WFaddword isin $1) { doWFaddword $2- | return } 
  if (!WFversion isin $1) { msg %frenzy.channel Word Frenzy Version : %WFversion } 
  if ($chan != %frenzy.channel) { return }
  if (%WF.Playing == No) return 
  inc %WF.LinesSaid 1 
  if (%WF.Playing != Yes) return 
  if ($Len($1) >= %WF.Min)  {
    set %WF.Guess $upper($1) 
    set %WF.Check %WFDone. [ $+ [ %WF.Guess ] ]
    if (%WF.Check != $null) { 
      ; Don't show who said it  
      return 
    } 
    if %WF.Guess == %UNSWF.Word { 
      DoColl darkgreen b (ED)^^: $nick Guessed the Scramble word and scores 500 Bonus points for %WF.Guess ^^:(ED)
      set %WFDone. $+ %WF.Guess $nick 
      addpoint $nick 500 
      addround $nick  500
      return 
    }
    ; Check for letters being used more than once etc... 
    if ($checkletters(%WF.Guess, %WF.Word) == bad) return 
    ; Do not check words automatically 
    if ($validateword(%WF.Guess) == bad) return 
    DoColl darkgreen b 8-| $nick scores $len($1) points for %WF.Guess 8-| 
    set %WFDone. $+ %WF.Guess $nick 
    if ( %frenzy.teammode != 1) { Recordpoints $nick $len(%WF.Guess)  }
    if ( %frenzy.teammode == 1) { Teampoints $nick $len(%WF.Guess) | Teamwordlengths $nick $len(%WF.guess)  |  inc % [ $+ team.scores. $+ [ % [ $+ team. $+ [ $nick ] ] ] ]  $len(%WF.Guess) }
    inc %wftotal $len(%wf.guess) | inc %numberofwords
    RecordRounds $nick $len(%WF.Guess)
    if (($len(%wf.guess) > %Wf.longest.word) || (%wf.longest.word == $null)) { %wf.longest.word = $len(%wf.guess) | %wf.longest.name = $nick | %wf.longest.text = %wf.guess }
  } 
  if (%WF.LinesSaid >= %WF.ReSpam) { spamword } 
}

alias AddPoint { 
  var %Score $readini(FrenzyScores.ini, $1, score) 
  inc %Score $2 
  writeini FrenzyScores.ini $1 score %Score 
}

alias AddRound {
  var %Score $readini(RoundScores.ini, $1, score) 
  inc %Score $2 
  writeini RoundScores.ini $1 score %Score 
}

alias RecordPoints { 
  var %Score $readini(FrenzyScores.ini, $1, score) 
  var %temp $readini(Frenzyscores.ini, $1, $2)
  inc %Score $2
  writeini FrenzyScores.ini $1 score %Score
  inc %temp
  writeini FrenzyScores.ini $1 $2 %temp
}

alias RecordRounds {
  var %score $readini(RoundScores.ini, $1, score) 
  var %number $readini(RoundScores.ini, $1, number) 
  inc %Score $2
  inc %number 
  writeini RoundScores.ini $1 score %Score 
  writeini RoundScores.ini $1 number %number 
}   

alias Teampoints {
  var %score $readini(TeamScores.ini, $1, score) 
  inc %Score $2 
  writeini TeamScores.ini $1 score %Score 
}

alias Teamwordlengths {
  var %score $readini(wordlength.ini, $1, $2 ) 
  inc %score
  writeini wordlength.ini $1 $2 %score 
}

alias DedPoint { 
  if ( %frenzy.teammode == 0) {
    var %Score $readini(FrenzyScores.ini, $1, score) 
    dec %Score $2 
    writeini FrenzyScores.ini $1 score %Score 
  }
  else {
    var %score4 $readini(TeamScores.ini, $1, score) 
    dec %Score4 $2 
    dec   % [ $+ team.scores. $+ [ % [ $+ team. $+ [ $1 ] ] ] ]  $2
    writeini TeamScores.ini $1 score %Score4 
  }
  var %score2 $readini(RoundScores.ini, $1, score) 
  dec %score2 $2  
  if ( %score2 <= 0) { 
    writeini RoundScores.ini $1 score 0 
    writeini RoundScores.ini $1 number 1 
  } 
  else { writeini RoundScores.ini $1 score %Score2 }
}

alias wfteamblue { 
  var %i 1
  var %j $lines(wfteamblue.txt)
  var %listteam
  while (%i <= %j ) {
    %x = $read(wfteamblue.txt, %i)
    var %listteam %listteam  %x (*)
    inc %i
  }
  docoll darkred b Team  %frenzy.team.1 (1) are : %listteam 
}

alias DeductPoint {
  if ( %penalised.  [ $+ [ %WF.Guess ] ]  == $1 ) { Docoll red b You've already been penalised for that guess! }   
  else {
    Docoll Red b $1 incurs $2 points penalty for repetition!
    Dedpoint $1 $2
  }
  set %penalised.  [ $+ [ %WF.Guess ] ] $1
}

alias wfteamred { 
  var %i 1
  var %j $lines(wfteamred.txt)
  var %listteam
  while (%i <= %j ) {
    %x = $read(wfteamred.txt, %i)
    var %listteam %listteam  %x (*)
    inc %i
  }
  docoll darkred b  Team %frenzy.team.2 (2) are : %listteam 
}

alias DoWFcommands { 
  ctcpreply $nick TIME type !WFstart ~ to Begin Game (*) 
  ctcpreply $nick TIME type !WFstop ~ to End Game (*) 
  ctcpreply $nick TIME type !WFchamp ~ to See CHAMP Score (*) 
  ctcpreply $nick TIME type !WFhof ~ to See The Hll of Fame (*) 
  ctcpreply $nick TIME type !WFstat ~ to See Your Score (*) 
  ctcpreply $nick TIME type !WFstat <nickname> ~ to See That Player's Score (*) 
  ctcpreply $nick TIME type !WFscores ~ to See Current Players Scores (*) 

} 

alias DoHelp { 
  ctcpreply $nick TIME (*) SCRAMBLE FRENZY ~ Help (*) 
  ctcpreply $nick TIME type !WFobject to see the object of the game 
  ctcpreply $nick TIME type !WFcommands for game commands 
  ctcpreply $nick TIME type !WFaddword <word> to submit the word to Game Dictionary  
} 

alias StartGame { 
  if (%WF.Playing == Yes) return 
  if (%frenzy.channel !ischan) { echo You are not in the set trivia channel: %frenzy.channel | return $true }
  if ( $1 == $null ) { 
    set %frenzy.teammode  0 
    frenzystart
  } 
  if ( $1 == team ) { 
    unset %team.* |  unset %jointime
    set %timercontrol $calc( %timer * 60 )  |  set %frenzy.teammode  1
    %team.scores.1 = 0
    %team.scores.2 = 0
    frenzystart 
    remove teamscores.ini | remove wfteam.ini | remove bestteamrs.ini | remove teamwordscores.ini | remove teammaxword.ini | remove wordlength.ini
    Docoll navy b $msg.team.start 
    Docoll DarkRed b (o)~~~~ Duration of Match : %timer Minutes.~~~~(o)
    if ( %timercontrol != 0 ) { .timerstart 1 %timercontrol stopgame2  }
    %start.time = $ticks
  }
  if ($1 == team) && ($2 != $null ) { set %timer $2 }
  .timerWFstart 1 %starttimer SShowWord 
}

alias frenzystart {
  msg %frenzy.channel (f) **********   Starting SCRAMBLE FRENZY   ************ (f) 
  msg %frenzy.channel (f) ******** First word appears in %starttimer secs ******* (f)
  msg %frenzy.channel (f) ******** Type !WFHelp for FRENZY help at any time. ******* (f)
  if (%champmode == 1) && (%frenzy.teammode == 0 ) { Docoll gold b (*) Championship target :  %champgoal Points (*) }
}

alias msg.team.start { return ===== (*) Team Word Frenzy (*) !join 1 to join Team %frenzy.team.1 !join 2 to join Team %frenzy.team.2 $+ . }

alias scrambleWFword { 
  set %WF.Word $read(text\10letters.txt) 
  window -h @WFScramble 
  var %x = 1, %y = 1,%WF.ScrambleWord 
  while (%x <= 10) { 
    aline @WFScramble $mid(%WF.Word,%x,1) $rand(1,1000) 
    inc %x 
  } 
  filter -wwcteu 2 32 @WFScramble @WFScramble 
  while ($line(@WFScramble,%y)) { 
    var %WF.ScrambleWord %WF.ScrambleWord $+ $gettok($ifmatch,1,32) 
    inc %y 
  } 
  window -c @WFScramble 
  set %UNSWF.Word %WF.Word 
  set %WF.Word %WF.ScrambleWord 
  if ($isid) { return %WF.Word } 
}

alias SShowWord { 
  set %WF.Word $read(text\10letters.txt) 
  set %UNSWF.Word %WF.Word 
  scrambleWFword 
  DOcoll dark b  (o) Your Scrambled FRENZY Word is $upper(%WF.Word) (o) 
  msg %frenzy.channel (o) You have %Roundtimer seconds to type as many words as you can of %WF.Min letters or more, made from the letters of the Frenzy Word (o) 
  set %WF.Playing Yes | unset %WFDone.* |  unset %WFRound.* |  unset %penalised.* |  unset %numberofwords |  unset %wftotal |  unset %wf.longest.word |   unset %wf.longest.name |   unset %wf.longest.text |   unset %percent
  .remove roundscores.ini
  set %WF.LinesSaid 0 
  .timerWFTimer 1 %Roundtimer EndWord 
}

alias EndWord { 
  var %time.elapse $calc(($ticks - %start.time) / 1000 )
  %time.left = $calc( %timer * 60  - %time.elapse)
  %jointime =  $calc( %time.elapse / 60)
  DoColl black b (o) Time Is Up, Your Unscrambled Frenzy Word was %UNSWF.Word 
  DoColl red b  Updated Scramble FRENZY scores are as follows...  
  set %WF.Playing No 
  if ( %wftotal > 0 ) { .timer 1 1 RoundScores }
  .timer 1 2 { showallscores }
  .timer 1 3 DOcoll dark b  (*) Current Champion :  %frenzywinner  (*) 
  if (%frenzy.teammode == 1) { showteamscores }
  .timerNW 1 5  Docoll red b Next SCRAMBLE FRENZY word in %Breaktimer seconds.(type !WFstop to end game) 
  .timerWFTimer 1 %Breaktimer PShowWord 
  if (%frenzy.teammode == 1) { DoColl darkred b Time Remaining : $duration(%time.left) (o) }
  if ( %wftotal >= 100 && %frenzy.teammode != 1) { writeini wordscores.ini $upper(%WF.word) score %wftotal | writeini wordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(wordscores) }
  if ( %frenzy.teammode == 1) && ( %wftotal > 0 ) { writeini teamwordscores.ini $upper(%WF.word) score %wftotal | writeini teamwordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(teamwordscores) }
}
alias PShowWord { 
  set %WF.Word $read(text\10letters.txt) 
  set %UNSWF.Word %WF.Word 
  scrambleWFword 
  DOcoll dark b  (o) Your Scrambled FRENZY Word is $upper(%WF.Word) (o) 
  msg %frenzy.channel (o) You have %Roundtimer seconds to type as many words as you can of %WF.Min letters or more, made from the letters of the Frenzy Word (o)
  set %WF.Playing Yes | unset %WFDone.* |  unset %WFRound.* |  unset %penalised.* |  unset %numberofwords |  unset %wftotal |  unset %wf.longest.word |   unset %wf.longest.name |   unset %wf.longest.text |   unset %percent
  .remove roundscores.ini
  set %WF.LinesSaid 0 
  .timerWFTimer 1 %Roundtimer PEndWord 
}

alias PEndWord { 
  var %time.elapse $calc(($ticks - %start.time) / 1000 )
  %time.left = $calc( %timer * 60  - %time.elapse)
  %jointime =  $calc( %time.elapse / 60)
  DoColl black b (o) Time Is Up, Your Unscrambled Frenzy Word was %UNSWF.Word 
  DoColl red b  Updated Scramble FRENZY scores are as follows...  
  set %WF.Playing No 
  if ( %wftotal > 0 ) { .timer 1 1 RoundScores }
  .timer 1 2 { showallscores }
  .timer 1 3 DOcoll dark b  (*) Current Champion :  %frenzywinner  (*) 
  if (%frenzy.teammode == 1) { showteamscores }
  .timerNW 1 5  Docoll red b Next SCRAMBLE FRENZY word in %Breaktimer seconds.(type !WFstop to end game) 
  .timerWFTimer 1 %Breaktimer NShowWord 
  if (%frenzy.teammode == 1) { DoColl darkred b Time Remaining : $duration(%time.left) (o) }
  if ( %wftotal >= 100 && %frenzy.teammode != 1) { writeini wordscores.ini $upper(%WF.word) score %wftotal | writeini wordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(wordscores) }
  if ( %frenzy.teammode == 1) && ( %wftotal > 0 ) { writeini teamwordscores.ini $upper(%WF.word) score %wftotal | writeini teamwordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(teamwordscores) }
}

alias NShowWord { 
  set %WF.Word $read(text\frenzywords.txt) 
  DOcoll dark b  (o) Your FRENZY Word is $upper(%WF.Word) (o)
  msg %frenzy.channel (o) You have %Roundtimer seconds to type as many words as you can of %WF.Min letters or more, made from the letters of the Frenzy Word (o)
  set %WF.Playing Yes | unset %WFDone.* |  unset %WFRound.* |  unset %penalised.* |  unset %numberofwords |  unset %wftotal |  unset %wf.longest.word |   unset %wf.longest.name |   unset %wf.longest.text |   unset %percent
  .remove roundscores.ini
  set %WF.LinesSaid 0 
  .timerWFTimer 1 %Roundtimer NEndWord 
}

alias NEndWord { 
  var %time.elapse $calc(($ticks - %start.time) / 1000 )
  %time.left = $calc( %timer * 60  - %time.elapse)
  %jointime =  $calc( %time.elapse / 60) 
  DoColl red b  Updated FRENZY scores are as follows...  
  set %WF.Playing No 
  if ( %wftotal > 0 ) { .timer 1 1 NRoundScores }
  .timer 1 2 { showallscores }
  .timer 1 3 DOcoll dark b  (*) Current Champion :  %frenzywinner  (*) 
  if (%frenzy.teammode == 1) { showteamscores }
  .timerNW 1 5  Docoll red b Next SCRAMBLE FRENZY word in %Breaktimer seconds.(type !WFstop to end game) 
  .timerWFTimer 1 %Breaktimer SShowWord 
  if (%frenzy.teammode == 1) { DoColl darkred b Time Remaining : $duration(%time.left) (o) }
  if ( %wftotal >= 100 && %frenzy.teammode != 1) { writeini wordscores.ini $upper(%WF.word) score %wftotal | writeini wordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(wordscores) }
  if ( %frenzy.teammode == 1) && ( %wftotal > 0 ) { writeini teamwordscores.ini $upper(%WF.word) score %wftotal | writeini teamwordscores.ini $upper(%WF.word) number %numberofwords | $Dowfsort(teamwordscores) }
}

alias StopGame { 
  .timerWFTimer off | .timerNW Off
  .timerstart off
  msg %frenzy.channel (o) SCRAMBLE FRENZY has stopped. (*) Type !WFstart to play again :) 
  if ( %frenzy.teammode == 1) { stopgame2 }
  set %WF.Playing No 
  set %frenzy.teammode 0
  WFHOF
} 

alias stopgame2 {
  .timerwftimer off | .timerNW Off
  show (o)~~~~~~~~ (*) Times up! (*) ~~~~~~~(o)
  if (%wftotal > 0 ) { .timer 1 3  roundscores }
  .timer 1 3  showteamscores 
  .timer 1 4 teamscores
  .remove wfteamblue.txt
  .remove wfteamred.txt
  set %WF.Playing No
  .timer 1 7 set %frenzy.teammode 0
  if (%wftotal > 0 ) {
    writeini teamwordscores.ini $upper(%WF.word) score %wftotal 
    writeini teamwordscores.ini $upper(%WF.word) number %numberofwords
  }
  $Dowfsort(teamwordscores) 
}

alias pause {
  msg %frenzy.channel (o) SCRAMBLE FRENZY paused! (*) Type !WFresume to resume the game :)
  set %wf.playing no
  .timerwftimer -p
}

alias resume {
  msg %frenzy.channel (o) SCRAMBLE FRENZY resumed! (*)  :)
  .timerwftimer -r
  set %wf.playing yes
}

alias winner {
  var %temp = $calc(%team.scores.1 - %team.scores.2)
  if ( %team.scores.1 > %team.scores.2 ) { return   $replace(%team1win, *T1 , %frenzy.team.1 , *T2, %frenzy.team.2)  by [ %temp ] points......(f) }
  if ( %team.scores.1 < %team.scores.2 ) { return $replace(%team1win, *T1 , %frenzy.team.1 , *T2, %frenzy.team.2) by $abs( %temp ) points......(f) }
  if ( %team.scores.1 = %team.scores.2 ) { return  %noteamwin  }
}

alias teamscores {
  DoWFsort6 
  var %x $lines(TeamScores.txt)
  var %y = 1
  var %temp
  while (%y <= %x ) {
    %i = $gettok($read(TeamScores.txt,%y ),1,32)
    %j = $gettok($read(TeamScores.txt,%y ),2,32)
    var %temp %temp %y $+ . %i $+ ......... $+ ( $+ $getteam(%i) $+ ) $+ ............. $+ %j Points
    inc %y
  }
  Docoll darkred b $winner 
  Docoll darkred b Individual Scores are:  %temp
  Docoll black b (*)~~~~~~~~~END OF MATCH~~~~~~~~(*)
  .remove teamscores.ini
}
alias StopIdle { 
  .timerWFTimer off 
  DoColl darkred b (o) No Play for $calc( %Idletimer / 60)  Minutes ~ WORD FRENZY has stopped. (*) Type !WFstart to play again :) 
  set %WF.Playing No 
}

alias showallscores { 
  $Dowfsort(frenzyscores)
  var %x 1 
  var %WFScores 
  while (%x <= $nick($active,0)) { 
    set %Name $nick($active,%x) 
    var %WFScore = $getscore(%Name) 
    if (%WFScore != 0) var %WFScores %WFScores    %Name ........... %WFScore :D 
    inc %x 
  } 
  var %WFScores   Total Points :  %WFScores 
  Docoll red bb %WFScores 
  if ( ( $gettok($read(frenzyscores.txt,1 ),2,32) > %champgoal ) && (%champmode == 1) ) { gameend }
  return 
}

alias gameend { 
  .timerNW off
  set %frenzywinner $gettok($read(frenzyscores.txt,1 ),1,32))
  Docoll darkblue b ~~~~~ NEW SCRAMBLE FRENZY CHAMPION ~~~~~~ The game was beaten by (*) %frenzywinner (*) All hail the new  champion!
  set %wf.playing no
  .timerWFTimer off 
  .timerstart off
  .timer 1 3 wfhof
  .timer 1 5 wfhtmlbuild
  .timer 1 11 echo -a HTML GENERATED
  write -il wfchamps.txt %frenzywinner $date $time
  .timer 1 12 Deletescores
}

alias showteamscores { docoll black b $msg.team.score }

alias msg.team.score { 
  if ( %team.scores.1 >= %team.scores.2 ) { return %frenzy.team.1 has %team.scores.1 points. %frenzy.team.2 has %team.scores.2 points. (F) }
  else { return %frenzy.team.2 has %team.scores.2 points. %frenzy.team.1 has %team.scores.1 points. (F) }
}

alias roundscores {
  $DoWFSort(Roundscores) 
  var %i = 1
  var %j $lines(roundscores.txt) 
  var %l %wftotal
  var %ss 
  DOcoll darkred b (*)~~~ SCRAMBLE FRENZY CURRENT ROUND SCORES ~~~(*)  
  DOcoll darkred b The total points scored for the word * $+ $upper(%UNSWF.Word) $+ * are :
  while ( %i <= %j ) {
    %x = $gettok($read(roundscores.txt,%i ),1,32)
    %y = $gettok($read(roundscores.txt,%i ),2,32)
    %z = $gettok($read(roundscores.txt,%i ),3,32)

    %percent =  $round($calc( %y / %l * 100 ),1)
    ;var %ss %ss %i $+ . %x $+ ...... $+ %y Points $+ ..... $+ %z words $+ ..... $+ %percent $+  %  (F)
    Docoll black b %i $+ . %x $+ ...... $+ %y Points $+ ..... $+ %z words $+   (~)
    inc %i
    if (%frenzy.teammode != 1 ) {  bestRS %x %y %z | maximumwords %x %z $upper(%WF.word) }
    if ( %frenzy.teammode == 1 ) { bestTeamRS %x %y %z | teammaximumwords %x %z $upper(%WF.word) }
  }
  Docoll black b Total Points for this Round : %wftotal $+ ! (*)
  Docoll black b Total Number of words made up : %numberofwords $+ ! (*)
  Docoll black b Longest word:  * $+ %wf.longest.text $+ * ( %wf.longest.word ) by %wf.longest.name (*)
}

alias Nroundscores {
  $DoWFSort(Roundscores) 
  var %i = 1
  var %j $lines(roundscores.txt) 
  var %l %wftotal
  var %ss 
  DOcoll darkred b (*)~~~ SCRAMBLE FRENZY CURRENT ROUND SCORES ~~~(*)
  DOcoll darkred b The total points scored for the word * $+ $upper(%WF.Word) $+ * are :

  while ( %i <= %j ) {
    %x = $gettok($read(roundscores.txt,%i ),1,32)
    %y = $gettok($read(roundscores.txt,%i ),2,32)
    %z = $gettok($read(roundscores.txt,%i ),3,32)

    %percent =  $round($calc( %y / %l * 100 ),1)
    ;var %ss %ss %i $+ . %x $+ ...... $+ %y Points $+ ..... $+ %z words $+ ..... $+ %percent $+  %  (F)
    Docoll black b %i $+ . %x $+ ...... $+ %y Points $+ ..... $+ %z words $+   (~)
    inc %i
    if ( %frenzy.teammode != 1 ) { bestRS %x %y %z | maximumwords %x %z $upper(%WF.word) }
    if ( %frenzy.teammode == 1 ) { bestTeamRS %x %y %z | teammaximumwords %x %z $upper(%WF.word) }
  }
  Docoll black b Total Points for this Round : %wftotal $+ ! (*)
  Docoll black b Total Number of words made up : %numberofwords $+ ! (*)
  Docoll black b Longest word:  * $+ %wf.longest.text $+ * ( %wf.longest.word ) by %wf.longest.name (*)
}

alias bestRS {
  var %temp $readini(BestRS.ini, $1 , score)
  if (( $2 > %temp)  || (%temp == $null )) {
    writeini BestRS.ini $1 score $2 | writeini BestRS.ini $1 number  $3
    $DoWFsort(BestRs)
    if ( $gettok($read(bestrs.txt,1),1,32) == $1 )  {  set %roundaward   Record Round Score : $2 now held by $1 $+ !! 
      .timer 1 2 sayaward
    }
  }
}

alias maximumwords {
  var %temp $readini(MaxWord.ini, $1 , score)
  if (( $2 > %temp) || (%temp == $null )) { 
    writeini MaxWord.ini $1 score $2 | writeini MaxWord.ini $1 number  $3 
    $DoWFsort(MaxWord)
    if ( $gettok($read(maxword.txt,1),1,32) == $1 )  {  set %wordaward   Record Maximum Words : $2  now held by $1 $+ ^^ 
      .timer 1 2 sayaward
    } 
  }
}

alias sayaward { 
  if (%roundaward = $null) && (%wordaward == $null) { return }
  else {
    Docoll darkred b %roundaward
    Docoll darkred b %wordaward
    unset %roundaward
    unset %wordaward
  }
}

alias teammaximumwords {
  var %temp $readini(TeamMaxWord.ini, $1 , score)
  if (( $2 > %temp) || (%temp == $null)) { writeini TeamMaxWord.ini $1 score $2 | writeini TeamMaxWord.ini $1 number  $3 }
  $DoWFsort(TeamMaxWord)
}

alias bestTeamRS {
  var %temp $readini(BestTeamRS.ini, $1 , score)
  if (( $2 > %temp) || (%temp == $null)) {
    writeini BestTeamRS.ini $1 score $2
    writeini bestteamrs.ini $1 number $3
  }
  $DoWFsort(BestTeamRs)
}

alias bestrounds {
  $DoWFSort(FrenzyScores) 
  var %i = 1
  var %j $lines(BestRs.txt) 
  var %Best.Round
  DOcoll darkred b (f)(*)~~~~~ WORD FRENZY BEST ROUND SCORES ~~~~~(*)(f)  
  while ( %i <= %j && %i <= 5 ) {
    %x = $gettok($read(BestRS.txt,%i ),1,32)
    %y = $gettok($read(BestRS.txt,%i ),2,32)  
    %z = $gettok($read(BestRS.txt,%i ),3,32)  

    ;var %Best.Round %Best.Round %i $+ : %x scored  %y Points with %z words (f)
    msg %frenzy.channel %i $+ : %x scored  %y Points with %z words
    inc %i 
  }

  ; Docoll navy b %best.round
}

alias bestwords {
  var %i = 1
  var %j $lines(wordscores.txt) 
  var %Best.Word
  DOcoll darkred b (f)(*)~~~~~ WORD FRENZY BEST WORD SCORES ~~~~~(*)(f)  
  while ( %i <= %j && %i <= 5 ) {
    %x = $gettok($read(wordscores.txt,%i ),1,32)
    %y = $gettok($read(wordscores.txt,%i ),2,32)  
    %z = $gettok($read(wordscores.txt,%i ),3,32)  

    ;var %Best.Word %Best.Word %i $+ : %x ---  %y Points with %z words (f)
    msg %frenzy.channel %i $+ : %x ---  %y Points with %z words (f)

    inc %i 
  }

  ; Docoll navy b %best.word
}

alias maxwords {
  $DoWFSort(MaxWord) 
  var %i = 1
  var %j $lines(MaxWord.txt) 
  var %Max.Word
  DOcoll darkred b (f)(*)~~~~~ WORD FRENZY MAXIMUM WORDS ~~~~~(*)(f)  
  while ( %i <= %j && %i <= 5 ) {
    %x = $gettok($read(maxword.txt,%i ),1,32)
    %y = $gettok($read(maxword.txt,%i ),2,32)  
    %z = $gettok($read(maxword.txt,%i ),3,32)  
    msg %frenzy.channel %i $+ : %x -----  %y Words for %z  (f)
    ;var %Max.Word %Max.Word %i $+ : %x -----  %y Words for %z  (f)
    inc %i 
  }
  ;Docoll navy b %Max.Word
}

alias GetTeam {
  var %temp $readini(WFteam.ini, $1, team)
  return %temp
}

alias GetScore { 
  var %Score $readini(FrenzyScores.ini, $1, score) 
  inc %Score 0 
  return %Score 
} 

alias docoll { 
  if ($1-2 == darkgreen b) { show S Tahoma;0 $3-  } 
  elseif ($1-2 == teal b) { show S Tahoma;0 $3-  } 
  elseif ($1-2 == darkblue b) { show S \rTahoma;0 $3-  } 
  elseif ($1-2 == red b) { show S eTahoma;0 $3-  } 
  elseif ($1-2 == red b) { show S eTahoma;0 $3-  } 
  elseif ($1-2 == red bb) { show S eTahoma;0 $3-   }
  elseif ($1-2 == gold b) { show S Tahoma;0 $3-   } 
  elseif ($1-2 == green b) { show S Tahoma;0 $3-  }
  elseif ($1-2 == blue b) { show S \rTahoma;0 $3-  } 
  elseif ($1-2 == darkred b) { show S eTahoma;0 $3-  } 
  elseif ($1-2 == black b) { show S  Tahoma;0    $3-  } 
  elseif ($1-2 == black r) { show S Tahoma;0     $3-  } 
  elseif ($1-2 == navy b) { show S Tahoma;0 $3-  } 
  elseif ($1-2 == dark b) { show S Tahoma;0 $3-  } 
}

alias DoWFobject { 
  ctcpreply $nick TIME (o) We're Playing WORD FRENZY - The object is to make as many 3 or more letter words in one minute as you can, out of the letters in the Frenzy Word given. (o)
  ctcpreply $nick TIME Type quickly; Only the first person to say them in each round will gain points. Type !WfHelp for full details. Original game by alphawolf & geezer, enhanced by CalSingle & [Ice][Angel] & Petertje. (*)
} 

alias DoChamp { 
  $DoWFsort(FRenzyscores) 
  msg %frenzy.channel (o)(*) Current WORD FRENZY Champ is ({) $gettok($read(frenzyscores.txt,1),1,32) $+ ~ with :o $gettok($read(frenzyscores.txt,1),2,32) $+ (*)(o)  
} 

alias WFHof {
  $DoWFSort(frenzyscores) 
  var %i = 1
  var %j $lines(frenzyscores.txt) 
  var %WFhof
  DOcoll darkred b (f)(*)~~~~~ WORD FRENZY HALL OF FAME ~~~~~(*)(f)  
  if (%frenzywinner != $null) { DOcoll darkblue b  (*) Current Champion :  %frenzywinner  (*) }
  while ( %i <= %j && %i <= 5 ) {
    %x = $gettok($read(frenzyscores.txt,%i ),1,32)
    %y = $gettok($read(frenzyscores.txt,%i ),2,32)  
    ;var %WFhof %WFhof %i $+ : %x ----  %y Points (f)
    Docoll navy b $ord(%i)  %x ----  %y Points (f)
    inc %i 
  }
  ;Docoll navy b %WFhof 
  var %bestround Best Round Score : $gettok($read(bestrs.txt, 1),2,32) ( $+ $gettok($read(bestrs.txt, 1),3,32) Words) by: $gettok($read(bestrs.txt, 1),1,32) (f)
  var %bestword  Maximum Points Scored : $gettok($read(wordscores.txt, 1),2,32)  for the word : $gettok($read(wordscores.txt, 1),1,32)  (f)
  var %maxsword Maximum Words : $gettok($read(maxword.txt, 1),2,32) by  $gettok($read(maxword.txt, 1),1,32) for the word : $gettok($read(maxword.txt, 1),3,32) (f)
  Docoll red bb %bestround %bestword %maxsword 
  Docoll blue b Type !WFwinners to see Previous Word Frenzy Champs.
}

alias wfchamps {
  var %i = 1
  var %j $lines(wfchamps.txt)
  DOcoll darkred b  (f)(*)~~~~~ WORD FRENZY CHAMPIONS ~~~~~(*)(f)  
  Docoll darkblue b (f)(*)~~ Championship Target : %champgoal Points ~~(*)(f)  
  while ( %i <= %j && %i <= 5 ) {
    %x = $gettok($read(wfchamps.txt,%i ),1,32)
    %y = $gettok($read(wfchamps.txt,%i ),2,32)  
    %z = $gettok($read(wfchamps.txt,%i ),3,32)  
    Docoll navy b  %x won on %y at %z (f)
    inc %i
  }
}

alias DoWFsort {
  var %a = 1, %b = $ini( [ $1 $+ .ini ] ,0)
  .remove [ $1 $+ .txt ]
  while (%a <= %b) {
    write [ $1 $+ .txt ] $ini( [ $1 $+ .ini ] ,%a) $readini( [ $1 $+ .ini ] ,$ini( [ $1 $+ .ini ] ,%a),score) $readini( [ $1 $+ .ini ] ,$ini( [ $1 $+ .ini ] ,%a),number) 
    inc %a 
  } 
  if ($exists( [ $1 $+ .txt ] )) { filter -ffcteu 2 32 [ $1 $+ .txt ] [ $1 $+ .txt ] }

} 

alias DoWFsort6 { 
  var %a = 1, %b = $ini(TeamScores.ini,0) 
  .remove TeamScores.txt | remove teamredscore.txt |  .remove teambluescore.txt
  while (%a <= %b) { 
    var %c = $getteam($ini(TEamscores.ini,%a)) 
    write TeamScores.txt $ini(TEamscores.ini,%a) $readini(TeamScores.ini,$ini(TeamScores.ini,%a),score) 
    if (%c == %frenzy.team.1) { write teambluescore.txt $ini(TEamscores.ini,%a) $readini(TeamScores.ini,$ini(TeamScores.ini,%a),score) }
    else { write teamredscore.txt $ini(TEamscores.ini,%a) $readini(TeamScores.ini,$ini(TeamScores.ini,%a),score) }
    inc %a 
  } 
  if ($exists(TeamScores.txt)) { filter -ffcteu 2 32 TeamScores.txt TeamScores.txt }
  if ($exists(TeamredScore.txt)) { filter -ffcteu 2 32 TeamredScore.txt TeamredScore.txt }
  if ($exists(Teambluescore.txt)) {  filter -ffcteu 2 32 TeamblueScore.txt TeamblueScore.txt  }
}

alias Dowfsort1 {
  var %a = 1, %b = $ini(wordlength.ini, 0)
  .remove wordlength2.ini
  while ( %a <= %b ) {
    var %c 3
    var %sum 0
    %d = $ini(wordlength.ini, %a) 
    while ( %c >= 3 && %c <= 10) {
      %e = $readini(wordlength.ini, %d, %c)
      if ( %e != $null ) {  
        inc %sum %e
        writeini wordlength2.ini %d %c %e 
      }
      else { writeini wordlength2.ini %d %c 0 }
      inc %c
    }
    writeini wordlength2.ini %d sum %sum
    unset %sum
    inc %a
  }
  unset %sum
  Dowfsort2
}

alias Dowfsort2 {
  var %a = 1 , %b = $ini(wordlength2.ini, 0)
  .remove wordlength.txt
  while ( %a <= %b ) {
    write wordlength.txt $ini(wordlength2.ini, %a) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), sum) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 3) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 4)) $readini(wordlength2.ini, $ini(wordlength.ini, %a), 5)) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 6)) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 7)) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 8) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 9)) $readini(wordlength2.ini, $ini(wordlength2.ini, %a), 10))
    inc %a
  }
  if ($exists(wordlength.txt)) { filter -ffcteu 2 32 wordlength.txt wordlength.txt }
}

alias Dowfsort3 {
  var %a = 1, %b = $ini(FrenzyScores.ini, 0) 
  .remove length.ini
  while ( %a <= %b ) {
    var %c 3
    var %sum 0
    %d = $ini(frenzyscores.ini, %a) 
    while ( %c >= 3 && %c <= 10) {
      %e = $readini(frenzyscores.ini, %d, %c)

      if (%e != $null ) { 
        inc %sum %e 
        writeini length.ini %d %c %e 
      }
      else { 
      writeini length.ini %d %c 0 }
      inc %c
    }
    writeini length.ini %d sum %sum
    unset %sum
    inc %a
  }
  unset %sum
  Dowfsort4
}

alias Dowfsort4 {
  var %a = 1 , %b = $ini(length.ini, 0)
  .remove length.txt
  while ( %a <= %b ) {
    write length.txt $ini(length.ini, %a) $readini(length.ini, $ini(length.ini, %a), sum) $readini(length.ini, $ini(length.ini, %a), 3) $readini(length.ini, $ini(length.ini, %a), 4)) $readini(length.ini, $ini(length.ini, %a), 5)) $readini(length.ini, $ini(length.ini, %a), 6)) $readini(length.ini, $ini(length.ini, %a), 7)) $readini(length.ini, $ini(length.ini, %a), 8) $readini(length.ini, $ini(length.ini, %a), 9)) $readini(length.ini, $ini(length.ini, %a), 10))
    inc %a
  }
  if ($exists(length.txt)) { filter -ffcteu 2 32 length.txt length.txt }
}

alias Dostat {
  $DoWFsort(frenzyscores)
  if (!$read(frenzyscores.txt,w,* $+ $1 $+ *)) { 
    Docoll red b (o) I'm sorry, :S but you have yet to score! (o) 
  }
  var %frenzyscore  Your Frenzy Score : $gettok($read(frenzyscores.txt, $readn),2,32) (f)
  VAR %rank   (f) Your Frenzy Rank : $ord($bytes($readn,b)) (f)
  var %bestround Your Best Round : $gettok($read(BestRs.txt, $readn),2,32) (f)
  var %maxword  Your Maximum Words : $gettok($read(maxword.txt, $readn),2,32) (f)
  if ($read(frenzyscores.txt,w,* $+ $1 $+ *)) { 
    Docoll red bb  %rank %frenzyscore  %bestround %maxword
  }
}

alias Dostatother {
  $DoWFsort(FrenzyScores)
  if (!$read(frenzyscores.txt,w,* $+ $1 $+ *)) { 
    Docoll red b (o) I'm sorry, :S but $1 has yet to score! (o) 
  }
  var %frenzyscore  Frenzy Score : $gettok($read(frenzyscores.txt, $readn),2,32) (f)
  VAR %rank  (f) $1 $+ 's Frenzy Rank : $ord($bytes($readn,b)) (f)
  var %bestround   Best Round : $gettok($read(BestRs.txt, $readn),2,32) (f)
  var %maxword   Maximum Words : $gettok($read(maxword.txt, $readn),2,32) (f)

  if ($read(frenzyscores.txt,w,* $+ $1 $+ *)) { 
    Docoll red bb  %rank  %frenzyscore   %bestround  %maxword
  }
}

alias DoSpam { 
  doColl darkblue b (o) We're Playing WORD FRENZY - The object is to make as many 3 or more letter words in one minute, as you can out of the letters given. (o)
  doColl blue b (o) Type quickly, Only the first person to say them in each round will gain points. Type !WfHelp for full details. 
} 

alias SpamWord { 
  if (%WF.Playing == No) return 
  DoColl darkblue b (o) Your  Scrambled FRENZY word is $upper(%WF.Word) ... Type !WFhelp for instructions at any time.
  set %WF.LinesSaid 0 
}

; The WFidleTimers alias prevents the game running nonstop when nobody is playing.
; It turns off the game after 5 minutes of no playing.
; To disable it, so it WILL keep going, just put a semi-colon ; in front of the line below

;  alias WFidleTimers { 
; .timerWFidle off 
; .timerWFidle 1 %IdleTimer StopIdle 
;}  

; Dictionary routine (C) 2003 Geezer & Wolf 
; checks if word is in dictionary.txt - wordlist provided by Justin White 

; $validateword(word) - returns good or bad 

alias ValidateWord { 
  set %D.Word *. $+ $1 $+ .* 
  if ($read(%dictionary, w, %D.Word ) == $null) { return bad } 
  else { return good } 
} 

; $checkletters(word, letters) - returns good or bad

alias CheckLetters { 
  set %D.FLetters $2 
  set %D.WLet 0 
  set %D.Letters $len($1) 
  while (%D.WLet < %D.Letters) { 
    inc %D.WLet 
    set %D.CLet $mid($1,%D.WLet,1) 
    set %D.FLet $pos(%D.FLetters, %D.CLet, 1) 
    if (%D.FLet == $null) return bad 
    if (%D.FLet == 1) { set %D.FLetters $mid(%D.FLetters, 2, $calc($Len(%D.FLetters) - 1)) } 
    if (%D.FLet == $len(%D.FLetters)) { set %D.FLetters $mid(%D.FLetters, 1, $calc($Len(%D.FLetters) - 1)) } 
    if (%D.FLet > 1) && (%D.FLet < $len(%D.FLetters)) { 
      set %D.FLetters $mid(%D.FLetters, 1, $Calc(%D.FLet -1) ) $+ $mid(%D.FLetters, $calc(%D.FLet +1 ), $Len(%D.Fletters) - %D.FLet) 
    } 
  } 
  return good 
}

alias setteam {
  if (%jointime == $null) {  %jointime = 0 }
  if ( %jointime >= %limitjoin ) && (%allowjoin == 1) { notice $nick Sorry no more player can join/change at this time. | return }
  if (($2 == 1) || ($2 == 2)) {
    %add.team = %frenzy.team. [ $+ [ $2 ] ]
    %add.name = $nick
    %team. [ $+ [ $1 ] ] = $2
    Docoll gold b  $msg.team.add 
    var %checkname $readini(WFteam.ini, $nick , Team) 
    if (%checkname =! %add.team) { writeini WFteam.ini $nick Team %add.team }
    else { writeini WFteam.ini $nick Team %add.team }  
    sort3
    unset %add.*
  }
}

alias sort3 { 
  var %a = 1, %b = $ini(WFteam.ini,0) 
  .remove wfTeamBlue.txt
  .remove wfTeamRed.txt
  while (%a <= %b) { 
    if  ( $readini(WFTeam.ini,$ini(WFTeam.ini,%a), team) == %frenzy.team.1 ) { write WFTeamblue.txt $ini(WFTeam.ini,%a) }
    else { write WFTeamRed.txt $ini(WFTeam.ini,%a) }
    inc %a 
  } 
} 

alias teamname { return %team. [ $+ [ $1 ] ] }
alias msg.team.add { return Team: %add.team has a new member: %add.name (f) }
alias showaction { describe $RName $1- } 

alias show { msg %frenzy.channel $1- } 

alias RName { return $active } 

alias doWFaddword { 
  notice $nick (o)Thanks for your WordFrenzy word addition (e) It has been recorded, and will be read later (Y) 
  write text\WFaddword.txt  $date  $time  $bdc($nick)  << Add Word = >> $1- 
  echo $active * WF Add Word from $nick Recorded 
}

on owner:TEXT: !addpoints * : # :  { addpoint $2 $3 } 
on *:TEXT:!pot:#:{ 
  mstat *s1 $iif(%pot.punten = 0,There are no points in the pot ! %pot.winner has removed them all :p,The jackpot is at present %pot.punten and the last winner was %pot.winner)  
}

on *:TEXT:*!steal:#: { 
  set %speel.num. $rand(1,$nick($chan,0))
  set %speel.speler $nick($chan,%speel.num.)
  %stealr = $rand(a,u) 
  %pot.bedrag = $rand(1500,3000) 
  %sponsor = $rand(1,3) 
  if (%msg.steal. [ $+ [ $nick ] ] = played) {
    StealWait 
    Return 
  } 
  if ($hof(p,$nick) < 0) { 
    DoColl gold b You need to add frenzy points to your score $nick :d :d your already on $hof(p,$nick) :|  
    Return 
  } 
  if ($nick = %speel.speler) { 
    inc %pot.punten 50 
    addpoint $nick -50 
    DoColl gold b $nick throws 50 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner  
  } 
  elseif (%stealr = p) { 
    inc %pot.punten 100 
    addpoint $nick -100 
    DoColl gold b $nick throws 100 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner  
  } 
  elseif (%stealr = q) { 
    inc %pot.punten 75 
    addpoint $nick -75 
    DoColl gold b $nick Throws 75 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner  
  } 
  elseif (%stealr = r) { 
    inc %pot.punten 40 
    addpoint $nick -40 
    DoColl gold b $nick Throws 40 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner   
  } 
  elseif (%stealr = s) { 
    inc %pot.punten 35 
    addpoint $nick -35 
    DoColl gold b $nick Throws 130 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner  
  } 
  elseif (%stealr = t) { 
    inc %pot.punten 80 
    addpoint $nick -80 
    DoColl gold b $nick Throws 80 points in the pot :d Pot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner   
  } 
  elseif (%stealr = u) { 
    inc %pot.punten 100
    addpoint $nick -100
    DoColl gold b $nick Throws 100 points in the pot :d Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner  
  } 
  elseif (%stealr = p) { 
    inc %pot.punten 55 
    addpoint $nick -55 
    DoColl gold b $nick Throws 55 points in the pot :o Jackpot now stands at %pot.punten points :o ? 
    (Y)(Y)(Y) Last winner of the pot was: %pot.winner   
  } 
  elseif (%stealr = n) { 
    addpoint $nick %pot.punten 
    Docoll DarkRed b (*) $nick (*) has won the Jackpot :o it stood at %pot.punten points !!! 
    (*)(f)Well done(f)(*) !!!  
    set %pot.punten %pot.bedrag 
    DoColl gold b Sponsor found, some rich guy : $read(sponsor.txt) ! has given %pot.bedrag points into the Jackpot :o  
    set %pot.winner  $nick 
  } 
  elseif (%stealr = o) { 
    addpoint $nick %pot.punten 
    Docoll DarkRed b (*) $nick (*) Has won the Jackpot :o it stood at %pot.punten points !!! 
    (*)(f)Well Done(f)(*) !!!  
    set %pot.punten %pot.bedrag  
    DoColl gold b Sponsor found, Twist of Fate : $read(sponsor.txt) ! has given %pot.bedrag points into the Jackpot :o  
    set %pot.winner $nick 
  } 
  elseif (%stealr = a) { 
    addpoint $nick 50 
    addpoint %speel.speler -50 
    DoColl gold b $nick steals 50 points from %speel.speler :o  
  } 
  elseif (%stealr = b) { 
    addpoint $nick 100 
    addpoint %speel.speler -100 
    DoColl gold b $nick steals 100 points %speel.speler :o  
  } 
  elseif (%stealr = c) { 
    addpoint $nick 55 
    addpoint %speel.speler -55
    DoColl gold b $nick steals 55 points from %speel.speler :o   
  } 
  elseif (%stealr = d) { 
    addpoint $nick 75 
    addpoint %speel.speler -75
    DoColl gold b $nick steals 75 points from %speel.speler :o  
  } 
  elseif (%stealr = e) { 
    addpoint $nick 80 
    addpoint %speel.speler -80 
    DoColl gold b $nick steals 80 points from %speel.speler :o   
  } 
  elseif (%stealr = f) { 
    addpoint $nick 50 
    addpoint %speel.speler -50 
    DoColl gold b $nick steals 50 points from %speel.speler :o    
  }
  elseif (%stealr = g) { 
    addpoint $nick -45 
    addpoint %speel.speler 45
    DoColl gold b $nick gives away 45 of their hard earned points to %speel.speler (a)  
  } 
  elseif (%stealr = h) { 
    addpoint $nick -100 
    addpoint %speel.speler 100 
    DoColl gold b $nick gives away 100 of their points to %speel.speler (a)   
  } 
  elseif (%stealr = i) { 
    addpoint $nick -50 
    addpoint %speel.speler 50 
    DoColl gold b $nick gives away 50 of their hard earned points to %speel.speler (a)   
  } 
  elseif (%stealr = j) { 
    addpoint $nick -75 
    addpoint %speel.speler 75 
    DoColl gold b $nick gives away 75 of their hard earned points to %speel.speler (a)   
  } 
  elseif (%stealr = k) { 
    addpoint $nick -85 
    addpoint %speel.speler 85 
    DoColl gold b $nick gives away 85 of their hard earned points to %speel.speler (a)    
  } 
  elseif (%stealr = l) { 
    addpoint $nick -90 
    addpoint %speel.speler 90 
    DoColl gold b $nick gives away 90 of their hard earned points to %speel.speler (a)    
  } 
  elseif (%stealr = m) { 
    addpoint $nick -95 
    addpoint %speel.speler 95 
    DoColl gold b $nick gives away 95 of their hard earned points to %speel.speler (a)   
  } 

  set -u90 %msg.steal. [ $+ [ $nick ] ] played 
}

alias addpoint {
  var %Score $readini(frenzyscores.ini, $1, score) 
  inc %Score $2 
  writeini frenzyscores.ini $1 score %Score 
}
 
alias tell {
  .ctcpreply $1 TIME $2- 
}

alias StealWait {
  tell $nick Thou Shalt Not Steal but once every 90 seconds 
  return 
}
 
dialog WFrenzy {
  title "Word Frenzy V4.0" 
  size -1 -1 183 128
  option dbu
  icon icons\zyrus.ico, 0
  tab "General", 2, 1 2 178 120
  box "", 10, 7 20 79 36, tab 2
  ;box "", 1030, 11 23 72 30, tab 2
  text "Channel", 260, 92 30 34 8, tab 2
  edit [ %frenzy.channel ], 250, 126 29 50 10, tab 2 autohs
  text "Directory", 660, 92 49 25 8, tab 2
  edit [ %frenzy.dir ], 280, 126 48 50 10, tab 2 return autohs
  text "Words List", 290, 92 70 25 8, tab 2
  edit [ %wordlist ], 320, 126 68 50 10, tab 2 return autohs
  text "Dictionary", 330, 92 89 33 8, tab 2
  edit [ %dictionary ], 1040, 126 87 50 10, tab 2 return autohs
  list 300, 34 69 50 37, tab 2 size
  box "Add Word to Dictionary", 340, 7 59 79 49, tab 2
  button "Add", 350, 9 73 24 10, tab 2
  box "General Settings", 1000, 89 20 89 87, tab 2
  button "Clear", 1010, 9 89 24 10, tab 2
  tab "Settings", 6
  box "Time Settings in Secs :", 50, 8 21 78 45, tab 6
  box "", 520, 8 69 167 38, tab 6
  text "Before Start", 560, 11 29 49 8, tab 6
  text "Round Duration", 570, 11 37 48 8, tab 6
  text "Between Rounds", 580, 11 47 48 8, tab 6
  text "Idle Time", 590, 11 56 49 8, tab 6
  edit [ %starttimer ] , 600, 62 28 16 9, tab 6 return
  edit [ %roundtimer ] , 610, 62 36 16 9, tab 6 return
  edit [ %breaktimer ] , 620, 62 46 16 9, tab 6 return
  edit [ %idletimer ] , 630, 62 55 16 9, tab 6 return
  text "Team Match Duration", 640, 93 30 59 8, tab 6
  edit [ %timer ], 650, 149 28 16 10, tab 6 return
  icon 1020, 10 25 100 30, imgs\image4.bmp,  tab 2 left
  box "Team Time Settings in Mins :", 670, 88 21 87 46, tab 6
  text "Limit Join Period After", 680, 93 41 57 8, tab 6
  edit [ %limitjoin ], 690, 149 40 16 10, tab 6 return
  check "On/Off Op only", 530, 13 75 50 10, tab 6
  check "Enable Idle Timer", 540, 13 84 50 10, tab 6
  check "Allow Penalty", 550, 13 94 93 10, tab 6
  text "Repeat Frequency", 30, 106 76 49 8, tab 6
  combo 240, 155 75 17 29, tab 6 drop
  text "Champ mode", 1, 106 86 41 8, tab 6
  check "", 3, 155 85 14 10, tab 6
  text "Champ Goal", 4, 106 95 41 8, tab 6
  edit [ %chamgoal ], 5, 154 95 19 9, tab 6 return autohs
  text "Allow Limit Join", 11, 94 52 50 8, tab 6
  check "", 12, 149 50 18 10, tab 6
  tab "Scores", 7
  box "Players", 100, 7 21 44 86, tab 7
  list 830, 9 37 39 67, tab 7 size
  box "Best", 840, 53 21 29 86, tab 7
  box "Best", 850, 84 21 29 86, tab 7
  box "Maximum", 860, 115 21 29 86, tab 7
  button "Generate", 870, 148 86 25 9, tab 7
  list 880, 55 37 25 67, tab 7 size
  text "Scores", 890, 58 28 21 10, tab 7
  text "Rounds", 900, 89 28 25 8, tab 7
  text "Words", 910, 120 28 25 8, tab 7
  text "Rankings", 920, 12 28 25 8, tab 7
  list 930, 86 37 25 67, tab 7 size
  list 940, 117 37 25 67, tab 7 size
  button "Delete", 780, 148 96 25 9, tab 7
  box "Generate", 370, 145 21 33 86, tab 7
  text "HTML", 380, 150 28 25 8, tab 7
  check "Hof", 390, 146 46 29 10, tab 7
  check "Round", 400, 146 54 29 10, tab 7
  check "Lengths", 410, 146 61 29 10, tab 7
  check "Wscores", 420, 146 69 29 10, tab 7
  check "MWords", 430, 146 76 29 10, tab 7
  text "Show", 440, 146 39 25 8, tab 7
  tab "Teams", 8
  edit [ %frenzy.team.1 ] , 130, 40 28 74 10, tab 8
  text "Team 1", 150, 14 29 25 8, tab 8 nowrap
  text "Team 2", 140, 14 40 18 8, tab 8 nowrap
  box "Team Names", 110, 8 21 167 31, tab 8
  edit [ %frenzy.team.2 ] , 160, 40 38 74 10, tab 8
  box "Messages", 170, 8 55 167 52, tab 8
  edit [ %noteamwin ] , 180, 48 64 114 10, tab 8
  edit [ %team1win ] , 190, 48 75 114 10, tab 8
  edit [ %team2win ] , 200, 48 86 114 10, tab 8
  text "Tied Match", 210, 13 66 33 8, tab 8
  text "Team 1 Wins", 220, 13 76 33 8, tab 8
  text "Team 2 Wins", 230, 13 87 34 8, tab 8
  link "http://groups.msn.com/BrunsStuff", 700, 48 97 86 8, tab 8
  tab "Commands", 9
  box "General Information", 120, 5 21 99 85, tab 9
  text "!WFStart: Start WF", 710, 107 28 67 7, tab 9
  text "!WFStop: Stop WF", 720, 107 35 67 8, tab 9
  text "!WFPause: Pause WF", 730, 107 42 68 8, tab 9
  text "!WFResume: Resume WF", 740, 107 49 68 8, tab 9
  text "!WFRepeat: Repeat Word", 750, 107 56 67 8, tab 9
  text "!WFHof : Hall of Fame", 760, 107 63 67 8, tab 9
  text "!WFShowteams:Show teams", 770, 107 70 68 8, tab 9
  text "!WFScores : See Scores", 790, 107 77 65 8, tab 9
  text "!WFstats: See your stats", 800, 107 84 67 8, tab 9
  text "!WFchamp: Champ Score", 810, 107 91 67 8, tab 9
  text "!WFlongest: Longest Word", 820, 107 98 65 8, tab 9
  box "Commands", 360, 106 21 72 87, tab 9
  text "Current mIRC version is:", 450, 8 32 57 8, tab 9
  text "Word Frenzy Enabled :", 460, 8 55 57 8, tab 9
  text "Currently in channel :", 470, 8 67 57 8, tab 9
  text "Words List exists :", 480, 9 79 57 8, tab 9
  text "Dictionary exists :", 490, 9 90 57 8, tab 9
  text "Word Frenzy Version :", 500, 8 44 57 8, tab 9
  text [ $version ], 510, 76 32 25 8, tab 9
  text [ %WFversion ], 950, 76 44 25 8, tab 9
  text [ %WFrenzy ] , 960, 76 55 25 8, tab 9
  text "Yes", 970, 76 67 25 8, tab 9
  text "Yes", 980, 76 79 25 8, tab 9
  text "Yes", 990, 76 90 25 8, tab 9
  button "OK", 2000, 73 109 37 12, flat ok
  text "by OtherwiseBrunette ", 40, 120 112 57 8, disable
  text "Word Frenzy V4.0", 310, 8 112 57 8, disable
}

on *:dialog:WFrenzy:init:*: {
  if (%wf.oponly == 1) { did -c WFrenzy 530 }
  if (%wf.idletimer == 1) { did -c WFrenzy 540 }
  if (%wf.penalty == 1) { did -c WFrenzy 550 }
  if (%wf.html.hof == 1) { did -c WFrenzy 390 }
  if (%wf.html.BRound == 1) { did -c WFrenzy 400 }
  if (%wf.html.lengths == 1) { did -c WFrenzy  410 }
  if (%wf.html.wscores == 1) { did -c WFrenzy 420 }
  if (%wf.html.mwords == 1) { did -c WFrenzy 430 }
  if (%allowjoin == 1 ) { did -c WFrenzy 12 }
  if (%champmode == 1) { did -c WFrenzy 3 }
  did -a WFrenzy 240 1
  did -a WFrenzy 240 2
  did -a WFrenzy 240 3
  did -a WFrenzy 240 4
  did -a WFrenzy 240 5
  did -a WFrenzy 240 6
  did -a WFrenzy 5 %champgoal
  loaddata 
  didtok $dname 300 32 %dialog.listtext
  if (%wf.respam != $null ) { did -c WFrenzy 240 %wf.respam }  
  unset %dialog.*
  dll ImgDlg.dll ImgDlg 1 1 $dialog(WFrenzy).hwnd heart.bmp
}

on *:dialog:WFrenzy:sclick:2000 : {
  %wf.oponly = $did(530).state
  %wf.idletimer = $did(540).state
  %wf.penalty = $did(550).state
  %wf.html.hof = $did(390).state
  %wf.html.bround = $did(400).state
  %wf.html.lengths = $did(410).state
  %wf.html.wscores = $did(420).state
  %wf.html.mwords = $did(430).state
  %allowjoin = $did(12).state
  %champmode = $did(3).state
  %starttimer = $did(600)
  %Roundtimer = $did(610)
  %breaktimer = $did(620)
  %idletimer = $did(630)
  %timer = $did(650)
  %limitjoin = $did(690)
  %frenzy.team.1 = $did(130)
  %frenzy.team.2 = $did(160)
  %noteamwin = $did(180)
  %team1win = $did(190)
  %team2win = $did(200)
  %wf.respam = $did(240)
  %frenzy.dir = $did(280)
  %wordlist = $did(320)
  %dictionary = $did(1040)
  %frenzy.channel = $did(250)
  %champgoal = $did(5)
  var %max = $did(300).lines,%c = 1
  while (%c <= %max) { %dialog.listtext = %dialog.listtext $did(300,%c) | inc %c }
}

on *:dialog:WFrenzy:sclick:700: { run http://www.evolutionscriptz.com/ }
on *:dialog:WFrenzy:sclick:350: { 
  var %add.word = $$?="Insert The Word You want to add to the dictionary..."
  if (!$read(%dictionary , w , *. $+ %add.word $+ .* )) {
    write %dictionary  . $+ %add.word $+ .
    echo -a Thank You! Your word has been added to the dictionary!
    did -a $dname 300 %add.word
  }
  else echo -a Sorry this word already exists in the dictionary!
}

on *:dialog:WFrenzy:sclick:1010: { did -r WFrenzy 300 } 
on *:dialog:WFrenzy:sclick:780: { did -r WFrenzy 830,880,930,940 | deletescores } 
on *:dialog:WFrenzy:sclick:870: { dialog -k WFrenzy WFrenzy | wfhtmlbuild | run  WordFrenzy.html } 
alias loaddata {
  var %i = 1 , %j = 10
  while ( %i <= %j ) && ($lines(frenzyscores.txt) != 0 ) {

    %x = $gettok($read(frenzyscores.txt, %i ),1,32) 
    %y = $gettok($read(frenzyscores.txt, %i ),2,32) 
    %z = $readini(bestrs.ini, %x , score)
    %w = $readini(bestrs.ini, %x , number)
    did -a WFrenzy 830 %i $bdc(%x)
    did -a WFrenzy 880 %y
    did -a WFrenzy 930  %z
    did -a WFrenzy 940  %w
    inc %i
  }
  return
}

alias WFhtmlbuild { 
  var %start.ticks = $ticks 
  if ($exists(WordFrenzy.html)) { .remove WordFrenzy.html } 
  $doWFsort(FrenzyScores) 
  if ($exists(WordFrenzy.htm)) { .remove WordFrenzy.htm } 
  DoWFsort3
  write WordFrenzy.html <TABLE cellSpacing=3 borderColor=#99ff33 borderColorDark=#99cc00 cellPadding=3 width="100%" bgColor=#ff33ff borderColorLight=#ccff33 background=/_Secure/0RwD9AocVKwsNESeUOSGBmGWhDhYLf^zG*ghNa0sBShe25g0MOj*FIFJq^m1Jj7GjVNQJJ52WXvLz6A3bvS3^ORx*tPTZ7c*bV2utiUVemwU/md-glass25.jpg?dc=4675510660194131312 border=12> 
  write WordFrenzy.html <TBODY><TR>
  write WordFrenzy.html <TD align=middle ><FONT face="comic sans ms" color=#ffff66 size=4><B><BR>WordFrenzy Version 4.0 <Br><FONT face="comic sans ms" color=#33FF33 size=4><B> by OtherwiseBrunette <br><font size=2> http://groups.msn.com/BrunsStuff/<br></a><FONT face="comic sans ms" color=#ccff33  size=2>The Scores files were created on <br> $date at $time <BR><BR></B></FONT></TD></TR>
  write WordFrenzy.html <tr><td align=middle bgcolor=000000> <FONT face="comic sans ms" color=#99ff33 size=4><b>WORD FRENZY SCORES</B></td></tr>
  if (%wf.html.hof == 1) {
    write WordFrenzy.html <tr><td align=middle>
    write WordFrenzy.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

    write WordFrenzy.html <TBODY><BR><TR bgColor=#00ff00>
    write WordFrenzy.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#cc0099 size=4><STRONG><B>Word Frenzy Hall of Fame </B></FONT></STRONG></TD></TR>
    write WordFrenzy.html <TR bgColor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Score</FONT></TH></TR>
    write WordFrenzy.html <TR> 
    var %i = 1, %x = $lines(frenzyscores.txt) 
    while (%i <= %x) { 
      write WordFrenzy.html <tr><TH><font color=#cc3333><b> $+ %i $+ </TH> <td><font color=#ff3300><b> $+ $bdc($gettok($read(frenzyscores.txt, %i),1,32)) $+ </td> <td align=center><font color=#ff3300><b> $+ $gettok($read(frenzyscores.txt, %i),2,32) $+ </td> </tr> 
      inc %i 
    } 
    write WordFrenzy.html </table><br><br>
  }
  if (%wf.html.BRound == 1) {
    write WordFrenzy.html <tr><td align=middle>

    write WordFrenzy.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>
    write WordFrenzy.html <TBODY><BR><TR bgColor=#00ff00>
    write WordFrenzy.html <TD align=middle colSpan=4><FONT face="Lucida Handwriting, Cursive" color=#cc0099 size=4><STRONG><B>Best Round Scores </B></FONT></STRONG></TD></TR>
    write WordFrenzy.html <TR bgColor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>No. Of Words</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Score</FONT></TH></TR>
    write WordFrenzy.html <TR> 
    var %i = 1, %x = $lines(BestRS.txt) 
    while (%i <= %x) && (%i <= 10 ) { 
      write WordFrenzy.html <tr><TH><font color=#cc3333><b>  $+ %i $+ </TH> <td><font color=#ff3300><b>  $+ $bdc($gettok($read(BestRS.txt, %i),1,32)) $+ </td><td align=center><font color=#ff3300><b>  $+ $gettok($read(BestRS.txt, %i),3,32) $+ </td> <td align=center><font color=#ff3300><b>  $+ $gettok($read(BestRS.txt, %i),2,32) $+ </td> </tr> 
      inc %i 
    } 
    write WordFrenzy.html </table><br><br>
  }
  if (%wf.html.lengths == 1) { 
    write WordFrenzy.html <tr><td align=middle>
    write WordFrenzy.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

    write WordFrenzy.html <TBODY><BR><TR bgColor=#00ff00>
    write WordFrenzy.html <TD align=middle colSpan=10><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=3><STRONG><B>Words Lengths</B></FONT></STRONG></TD></TR>
    write WordFrenzy.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Total</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Three</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Four</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Five</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Six</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Seven</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Eight</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Nine</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ten</FONT></th></tr>
    write WordFrenzy.html <TR> 
    var %i = 1, %x = $lines(length.txt) 
    while (%i <= %x) { 

      write WordFrenzy.html <tr><TH><font color=#ff3300><b> $bdc($gettok($read(length.txt, %i),1,32)) </b></font></TH><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),2,32))</b> </font></td><td align=center><font color=#ff3300><b>  $gettok($read(length.txt, %i),3,32)) </b></font></td><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),4,32)) </b> </font></td><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),5,32)) </b></font></td> <td align=center><font color=#ff3300><b>  $gettok($read(length.txt, %i),6,32)) </font></td><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),7,32))  </font></td><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),8,32))  </font></td><td align=center><font color=#ff3300><b> $gettok($read(length.txt, %i),9,32)) </b> </font></td><td align=center><font color=#ff3300><b> 0 </font></td></tr> 
      inc %i 
    } 
    write WordFrenzy.html  </table><br><br>
  }
  if (%wf.html.wscores == 1) {
    write WordFrenzy.html <tr><td align=middle>
    write WordFrenzy.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

    write WordFrenzy.html <TBODY><BR><TR bgColor=#00ff00>
    write WordFrenzy.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#cc0099 size=4><STRONG><B>Word Scores </B></FONT></STRONG></TD></TR>
    write WordFrenzy.html <TR bgColor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Word</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>No. Of Words</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Total Points</FONT></TH></tr>
    write WordFrenzy.html <TR> 
    var %i = 1, %x = 10
    while (%i <= %x) { 
      write WordFrenzy.html <tr> <td><font color=#ff3300><b> $+ $gettok($read(wordscores.txt, %i) ,1,32) $+ </td>  <td align=center><font color=#ff3300><b> $+ $gettok($read(wordscores.txt, %i) ,3,32) $+ </td><td align=center><font color=#ff3300><b> $+ $gettok($read(wordscores.txt, %i) ,2,32) $+ </td> </tr> 
      inc %i 
    } 
    write WordFrenzy.html </table><br><br>
  }
  if (%wf.html.mwords == 1) {
    write WordFrenzy.html <tr><td align=middle>
    write WordFrenzy.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

    write WordFrenzy.html <TBODY><BR><TR bgColor=#00ff00>
    write WordFrenzy.html <TD align=middle colSpan=4><FONT face="Lucida Handwriting, Cursive" color=#cc0099 size=4><STRONG><B>Maximum Words Made Up </B></FONT></STRONG></TD></TR>
    write WordFrenzy.html <TR bgColor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Word</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Total </FONT></TH></tr>
    write WordFrenzy.html <TR> 
    var %i = 1, %x = $lines(maxword.txt)
    while (%i <= %x) { 
      write WordFrenzy.html <tr><TH><font color=#ff3300> $+ %i $+ </TH> <td><font color=#ff3300><b> $+ $bdc($gettok($read(maxword.txt, %i) ,1,32)) $+ </td>  <td align=center><font color=#ff3300><b> $+ $gettok($read(maxword.txt, %i) ,3,32) $+ </td><td align=center><font color=#ff3300><b> $+ $gettok($read(maxword.txt, %i) ,2,32) $+ </td> </tr> 
      inc %i 
    } 
    write WordFrenzy.html </table><br><br>
  }

  echo * Word FrenzyV4.0 ~ by OtherwiseBrunette ~ HTML Created = in $calc(($ticks - %start.ticks) / 1000) $+ secs. 
} 
alias WFTeamhtmlbuild { 
  var %start.ticks = $ticks 
  DoWFsort1
  if ($exists(TeamWF.html)) { .remove TeamWF.html } 
  if ($exists(TeamWF.htm)) { .remove TeamWF.htm } 
  write TeamWF.html <TABLE cellSpacing=3 borderColor=#99ff33 borderColorDark=#99cc00 cellPadding=3 width="100%" bgColor=#ff33ff borderColorLight=#ccff33 background=/_Secure/0RwD9AocVKwsNESeUOSGBmGWhDhYLf^zG*ghNa0sBShe25g0MOj*FIFJq^m1Jj7GjVNQJJ52WXvLz6A3bvS3^ORx*tPTZ7c*bV2utiUVemwU/md-glass25.jpg?dc=4675510660194131312 border=12>
  write TeamWF.html <TBODY><TR>
  write TeamWF.html <TD align=middle ><FONT face="comic sans ms" color=#ffff66 size=4><B><BR>WordFrenzy Version 4.0 <Br><FONT face="comic sans ms" color=#33FF33 size=4><B> by OtherwiseBrunette <br><font size=2> http://groups.msn.com/BrunsStuff/<br></a><FONT face="comic sans ms" color=#ccff33  size=2>The Scores files were created on <br> $date at $time <BR><BR></B></FONT></TD></TR>
  write TeamWF.html <tr><td align=middle bgcolor=000000> <FONT face="comic sans ms" color=#99ff33 size=4><b>WORD FRENZY SCORES</B></td></tr>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#6633ff size=4><STRONG><B>TEAM $upper( %frenzy.team.1 ) </B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Score</FONT></TH></TR>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(teambluescore.txt) 
  while (%i <= %x) { 
    write TeamWF.html <tr><TH><font color=#cc3333><b> $+ %i $+ </font></TH> <td><font color=#ff3300><b> $+ $bdc($gettok($read(teambluescore.txt, %i),1,32)) $+ </font></td> <td align=center><font color=#ff3300><b> $+ $gettok($read(teambluescore.txt, %i),2,32) $+ </font></td> </tr> 
    inc %i 
  } 
  write TeamWF.html <tr><td colspan=2 align=right><font color=#ff3300><b> Total </font></td> <td align=center bgcolor=#ff3366><font color=#ffff66><b> %team.scores.1 </font></td> </table><br><br><br><br>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=4><STRONG><B>TEAM $upper(%frenzy.team.2) </B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Score</FONT></TH></TR>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(teamredscore.txt) 
  while (%i <= %x) { 
    write TeamWF.html <tr><TH><font color=#cc3333><b> $+ %i $+ </font></TH> <td><font color=#ff3300><b> $+ $bdc($gettok($read(teamredscore.txt, %i),1,32)) $+ </font></td> <td align=center><font color=#ff3300><b> $+ $gettok($read(teamredscore.txt, %i),2,32) $+ </font></td> </tr> 
    inc %i 
  } 
  write TeamWF.html <tr><td colspan=2 align=right><font color=#ff3300><b> Total </font></td> <td align=center bgcolor=#ff3366><font color=#ffff66><b> %team.scores.2 </font></td> </table><br><br>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=5><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=3><STRONG><B>Best Round Scores </B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Team</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Words</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Score</FONT></TH></TR>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(bestteamRs.txt) 
  while (%i <= %x) { 
    write TeamWF.html <tr><TH><font color=#cc3333><b> $+ %i $+ </font></TH> <td><font color=#ff3300><b> $+ $bdc($gettok($read(bestteamRs.txt, %i),1,32)) $+ </font></td><td align=center><font color=#ff3300><b> $+ $getteam($gettok($read(bestteamRs.txt, %i),1,32)) $+ </font></td> <td align=center><font color=#ff3300><b> $+ $gettok($read(bestteamRS.txt, %i),3,32) $+ </font></td> <td align=center><font color=#ff3300><b> $+ $gettok($read(bestteamRS.txt, %i),2,32) $+ </font></td> </tr> 
    inc %i 
  } 
  write TeamWF.html  </table><br><br>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=3><STRONG><B>Word Scores </B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Word</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>No. of Words</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Total Points</FONT></TH></tr>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(teamwordscores.txt) 
  while (%i <= %x) && (%i <= 10 ) { 
    write TeamWF.html <tr><td align=center><font color=#ff3300><b> $+ $gettok($read(teamwordscores.txt, %i),1,32)) $+ </font></td><td align=center><font color=#ff3300><b> $+ $gettok($read(teamwordscores.txt, %i),3,32)) $+ </font></td>  <td align=center><font color=#ff3300><b> $+ $gettok($read(teamwordscores.txt, %i),2,32) $+ </font></td> </tr> 
    inc %i 
  } 


  write TeamWF.html  </table><br><br>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=5><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=3><STRONG><B>Maximum Words Made Up </B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ranking</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Team</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Word</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Total</FONT></TH></tr>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(teammaxword.txt) 
  while (%i <= %x) { 
    write TeamWF.html <tr><TH><font color=#cc3333><b> $+ %i $+ </font></TH><td><font color=#ff3300><b> $+ $bdc($gettok($read(TeamMaxWord.txt, %i),1,32)) $+ </font></td><td align=center><font color=#ff3300><b>  $+ $getteam($gettok($read(teammaxword.txt, %i),1,32)) $+ </font></td><td align=center><font color=#ff3300><b> $+ $gettok($read(teammaxword.txt, %i),3,32)) $+ </font></td>  <td align=center><font color=#ff3300><b> $+ $gettok($read(teammaxword.txt, %i),2,32) $+ </font></td> </tr> 
    inc %i 
  } 

  write TeamWF.html  </table><br><br>
  write TeamWF.html <tr><td align=middle>
  write TeamWF.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write TeamWF.html <TBODY><BR><TR bgColor=#00ff00>
  write TeamWf.html <TD align=middle colSpan=10><FONT face="Lucida Handwriting, Cursive" color=#ff6600 size=3><STRONG><B>Words Lengths</B></FONT></STRONG></TD></TR>
  write TeamWF.html <TR bgcolor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Player</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Total</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Three</FONT></TH><TH><FONT face="comic sans ms"  color=#ff6600 size=3>Four</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Five</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Six</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Seven</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Eight</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Nine</FONT></th><TH><FONT face="comic sans ms" color=#ff6600 size=3>Ten</FONT></th></tr>
  write TeamWF.html <TR> 
  var %i = 1, %x = $lines(wordlength.txt) 
  while (%i <= %x) { 

    write TeamWF.html <tr><TH><font color=#ff3300><b> $bdc($gettok($read(wordlength.txt, %i),1,32))  </font></TH><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),2,32)) </font></td><td align=center><font color=#ff3300><b>  $gettok($read(wordlength.txt, %i),3,32)) </font></td><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),4,32))  </font></td><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),5,32))</font></td> <td align=center><font color=#ff3300><b>  $gettok($read(wordlength.txt, %i),6,32)) </font></td><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),7,32))  </font></td><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),8,32))  </font></td><td align=center><font color=#ff3300><b> $gettok($read(wordlength.txt, %i),9,32)) </b> </font></td><td align=center><font color=#ff3300><b> 0 </font></td></tr> 
    inc %i 
  } 
  write TeamWF.html  </table><br><br>
  remove wfteam.ini | remove bestteamrs.ini | remove teamwordscores.ini  | remove teammaxword.ini  | remove wordlength.ini |  teamoptions
  echo * Word FrenzyV4.0 ~ by OtherwiseBrunette ~ HTML Created = in $calc(($ticks - %start.ticks) / 1000) $+ secs. 
} 

alias ListofCommands { 
  var %start.ticks = $ticks 
  write Commands.html <TABLE cellSpacing=3 borderColor=#99ff33 borderColorDark=#99cc00 cellPadding=3 width="100%" bgColor=#ff33ff borderColorLight=#ccff33 background=/_Secure/0RwD9AocVKwsNESeUOSGBmGWhDhYLf^zG*ghNa0sBShe25g0MOj*FIFJq^m1Jj7GjVNQJJ52WXvLz6A3bvS3^ORx*tPTZ7c*bV2utiUVemwU/md-glass25.jpg?dc=4675510660194131312 border=12> 
  write Commands.html <TBODY><TR>
  write Commands.html <TD align=middle ><FONT face="comic sans ms" color=#ffff66 size=4><B><BR>WordFrenzy Version 4.0 <Br><FONT face="comic sans ms" color=#33FF33 size=4><B> by OtherwiseBrunette <br><font size=2> http://groups.msn.com/BrunsStuff/<br></a></TD></TR>
  write Commands.html <tr><td align=middle>
  write Commands.html <TABLE cellSpacing=2 borderColorDark=#9933ff cellPadding=2 width="75%" bgColor=#314f70 borderColorLight=#99ff00 border=7><TBODY><BR>

  write Commands.html <TBODY><BR><TR bgColor=#00ff00>
  write Commands.html <TD align=middle colSpan=3><FONT face="Lucida Handwriting, Cursive" color=#cc0099 size=4><STRONG><B>Word Frenzy List of Commands </B></FONT></STRONG></TD></TR>
  write Commands.html <TR bgColor=#ffff66><TH><FONT face="comic sans ms" color=#ff6600 size=3>Commands</FONT></TH><TH><FONT face="comic sans ms" color=#ff6600 size=3>Application</FONT></TH>
  write Commands.html <TR><td><b><font color=#ff3300>!WFstart</font></td><td><b><font color=#ff66ff> To Begin Word Frenzy </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFstart Team (time in Mins) </font></td><td><b><font color=#ff66ff> To Start Team Word Frenzy </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFstop</font></td><td><b><font color=#ff66ff> To Stop Word Frenzy </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFPause</font></td><td><b><font color=#ff66ff> To Pause Word Frenzy </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFResume</font></td><td><b><font color=#ff66ff> To Resume Word Frenzy </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFrepeat</font></td><td><b><font color=#ff66ff> To Repeat Initial Word </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFLongest</font></td><td><b><font color=#ff66ff> To Show the Longest Word </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFhof</font></td><td><b><font color=#ff66ff> To See The Word Frenzy Hall of Fame</font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFBestRounds</font></td><td><b><font color=#ff66ff> To See The Best Rounds Scores</font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFBestWords</font></td><td><b><font color=#ff66ff> To See The Best Word Scores</font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFMaxWords</font></td><td><b><font color=#ff66ff> To See The Maximum Words Made Up</font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFchamp</font></td><td><b><font color=#ff66ff> To See Champ Score </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFstat</font></td><td><b><font color=#ff66ff> To See your Stats </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFstat (nickname) </font></td><td><b><font color=#ff66ff> To See That Player's Stats  </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFscores </font></td><td><b><font color=#ff66ff> To See Current Players' Scores  </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!join 1 or !join 2 </font></td><td><b><font color=#ff66ff> To Join Team 1 or Team 2  </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFshowteams</font></td><td><b><font color=#ff66ff> To Show Members of Teams </font></td></tr> 
  write Commands.html <TR><td><b><font color=#ff3300>!WFversion</font></td><td><b><font color=#ff66ff> To Get Current Version of Word FRenzy </font></td></tr> 

  write Commands.html  </table><br><br>

  echo 0,12Word FrenzyV4.0 ~ by Otherwisebrunette ~ HTML 0,94 Created = 0,4 in $calc(($ticks - %start.ticks) / 1000) $+ secs. 
}

#WordFrenzyV4 end
