GAME: Check How Fast You Can Type!!!

By QuickStep on Jan 04, 2005

This script will create a few sentences with words that contain certain vowel/consonant combinations. It is a speed test, where you have to type 6 sentences. In the end your score will be compared with the world record. Remember: mistakes are counted very heavily. start it by typing: /speedtest ..... Current Record: 294

alias speedtest {
  clear $ww | window $ww
  %speedtest.g = 0 | %speedtest.w = 0 | %speedtest.t = 0 | %speedtest.s = 6
  echo $ww Total Strokes: 0 , Mistakes: 0 , Avg Strokes/Min: 0
  speedteststart
}
alias -l speedteststart {
  %speedtest.n = 0

  ;Sentence with 12 words
  echo $ww $sentence(12)
}
alias -l speedtestend {
  .timerspeedtest off
  var %a = $round($iif(%speedtest.t = 0,0,$calc((%speedtest.g) / %speedtest.t * 60 - (%speedtest.w * 5))),2)
  echo $ww $chr(160)
  echo $ww Listing results:
  echo $ww Correct Strokes: %speedtest.g
  echo $ww Incorrect Strokes: %speedtest.w
  echo $ww Time: $duration(%speedtest.t)
  echo $ww Total Strokes: $calc(%speedtest.g + %speedtest.w)
  echo $ww Average Strokes/Min: $iif(%a < 0,0,%a) (mistake = -5)
  echo $ww World record: 750 (Set by Barbara Blackburn in 1985)
  echo $ww Amount of time you have to type faster to beat the world record: $duration($ceil($calc(%speedtest.t - (%speedtest.t * $iif(%a < 0,0,%a) / 750))))
  unset %speedtest.* | halt
}
alias -l updatespeedtest {
  var %strokesmin = $round($iif(%speedtest.t = 0,0,$calc((%speedtest.g) / %speedtest.t * 60 - (%speedtest.w * 5))),2)
  var %a = Total Strokes: $calc(%speedtest.g + %speedtest.w) , Mistakes: %speedtest.w , Avg Strokes/Min: $iif(%strokesmin < 0,0,%strokesmin)
  inc %speedtest.t
  rline $ww 1 $+($chr(2),%a)
}

on *:keydown:$($ww):*:{
  if (!%speedtest.s) return
  if !$timer(speedtest) { updatespeedtest | .timerspeedtest 0 1 updatespeedtest }
  if (!$isonly($keychar,abcdefghijklmnopqrstuvwxyz . $+ $chr(44))) return
  inc %speedtest.n
  var %l = $iif($calc($line($ww,0) / 2) = $int($calc($line($ww,0) / 2)),$line($ww,0),$calc($line($ww,0) - 1)))
  addchar $chr(3)
  if ($mid($line($ww,%l),%speedtest.n,1) === $iif($keyval = 32,$chr(160),$keychar)) { inc %speedtest.g | addchar 3 }
  else { inc %speedtest.w | addchar 4 }
  addchar $iif($keyval = 32,$chr(95),$keychar)
  if (%speedtest.n = $len($line($ww,%l))) { 
    dec %speedtest.s | if (!%speedtest.s) speedtestend
    speedteststart
  }
}
on *:close:$($ww):{
  .timerspeedtest off
}

alias randomword {
  var %wrd1 = bcdfghjklmnpqrstvwxz, %wrd2 = aeiouy

  ;Some Word Combinations, 1=Consonant 2=Vowel
  var %wrdcmb = 101:1001:1011:10110:110110:010:0110:1010:0101: $&
    101010:10101:1101:11011:10011:011:100:01010

  var %wrd = $gettok(%wrdcmb,$rand(1,$numtok(%wrdcmb,58)),58), %a = 1, %r
  while %a <= $len(%wrd) {
    %r = $+(%r,$iif($mid(%wrd,%a,1),$mid(%wrd1,$rand(1,$len(%wrd1)),1),$mid(%wrd2,$rand(1,$len(%wrd2)),1)))
    inc %a
  }

  return %r
}
alias sentence {
  var %a = 1, %cma = $rand(2,$calc($$1 -1)), %r
  while %a <= $$1 {
    %r = $+(%r,$iif(%r,$chr(160)),$randomword,$iif(%cma = %a,$chr(44)))
    inc %a
  }
  return $snc(%r)
}
alias isonly {
  var %a = 1
  while %a <= $len($$1) {
    if $mid($$1,%a,1) $+(!isin,$prop) $$2 return $false
    inc %a
  }
  return $true
}
alias -l snc return $+($upper($left($1,1)),$lower($right($1-,-1)),$chr(46))
alias -l ww return @SpeedTest
alias -l addchar {
  if ($calc($line($ww,0) / 2) = $int($calc($line($ww,0) / 2))) { echo $ww $$1- }
  else { rline $ww $line($ww,0) $+($line($ww,$line($ww,0)),$$1-) }
}

Comments

Sign in to comment.
Lord Kiam   -  Jul 16, 2005

something is wrong i just completed it in 3 mins 196 secs and im much further than u lot im very quick at typing can type 70 words per min

 Respond  
Corne   -  Jul 05, 2005

This is tough :)

 Respond  
mquick   -  Mar 08, 2005

I made the new record 295.71 =) !

 Respond  
Ace99   -  Feb 28, 2005

Nice script. :D

 Respond  
UnknownQuantity   -  Jan 04, 2005

Very nice :)

 Respond  
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.