IQ Test V2

By newklear on Jul 22, 2018

IQ Test V2

This is a working copy of the IQ Test Script originally done by Jamiie . Full credit goes to Jamiie

Have added a few tweaks as well as score keeping and alerts for players. Enjoy :-)

This is a IQ test, 10 questions based on your answers will determine your IQ.
Your IQ is determined by this formula:

(MA/CA)*100

MA=Mental age
CA=Chronological age

Mental age is scored based on the answer you input for each question.
Chronological age is your actual age from !age your age

Commands:

!iq:     To start the IQ Test (In Channel)
!age:    Syntax: !age 27 (In Private, the rest of the questions will be answered in private message)
!cancel: Can cancel the test at any time (In Channel or Private)
!topiq:  Will display the Top 10 IQ Scores in Channel, if you want top 20: !topiq 20 (Channel)

The Questions are also regional based, so change questions to suite your demographic.
NB: This is not a true indicator of your IQ, it's for fun!

And for the Script, copy below:

on *:LOAD: {
  $iif($exists($mircdir/IQ),,mkdir $mircdir/IQ)
}

on *:text:!iq:#: {
  if (%iq. [ $+ [ $address($nick,2) ] ] == 6) { halt }
  inc -u600 %iq. [ $+ [ $address($nick,2) ] ] 1
  if (%iqnick == $nick) { msg $chan $nick $+ , You are already taking the test, look in your private message. | msg $nick Here :p | return }
  if (!%iqnick) {
    msg $chan General Knowledge Squizz commencing, I have sent you a private message $nick $+ .
    timeriq1 1 1 msg $nick General Knowledge Squizz Introduction and Disclaimer:
    timeriq2 1 2 msg $nick If at any point you wish to cancel, type !cancel and !topiq (in Channel) for Top 10 General Knowledge Squizz Results.
    timeriq3 1 3 msg $nick Right, let us begin, Type: !age your age here
    set -u600 %iqnick $nick
    set -u600 %iqchan $chan
    auser age %iqnick
  }
  else { msg $chan $nick $+ , I am currently testing %iqnick $+ 's IQ (Shouldn't be more than $duration($timer(iqend3).secs) $+ , I will alert you when you can take the test!) | set %iqalert $nick }
}

on *:TEXT:!cancel*:*: {
  if (%iqnick == $nick) {
    msg %iqchan %iqnick has cancelled their General Knowledge Squizz.
    if (%iqalert) { timeriqalert 1 3 msg %iqchan %iqalert %iqalert %iqalert $+ !!! You can get your General Knowledge tested, begin with: !iq }
    .timeriq1 1 1 unset %iq*
    .timeriq2 1 2 timeriqend? off
    ruser %iqnick
  }
}

on age:TEXT:!age*:?: {
  if (!$2) { msg $nick Example Syntax: !age 33 | return }
  if ($2 isnum) {
    if ($2 > 80) { msg $nick I seriously doubt it -_-, try again :p | return }
    if ($2 < 18) { msg $nick You're too young to give an accurate IQ, sorry! | return }
    $iif($2 >= 60,set %iqchronoage $calc($2 - 20),set %iqchronoage $2)
    $iif($2 <= 30,set %iqchronoage $calc($2 + 20),set %iqchronoage $2)
    msg $nick You have 10 minutes to complete this General Knowledge Squizz.
    msg $nick In this test you will be answering 10 questions, to proceed type 4Yes or 4No.
    set -u600 %iqstart $ctime
    timeriqend1 1 600 ruser %iqnick
    timeriqend2 1 600 unset %iq*
    timeriqend3 1 600 if (%iqalert) { msg %iqchan %iqnick Did not complete the General Knowledge Squizz. %iqalert is next up! } 
    timeriqend4 1 600 if (!%iqalert) { msg %iqchan %iqnick Did not complete the General Knowledge Squizz. !iq to start ;)) }
    auser yes %iqnick
  }
  else { msg $nick Please use a valid number for age, Syntax: !age 22 }
}

on yes:TEXT:no:?: {
  msg %iqchan %iqnick has cancelled their General Knowledge Squizz.
  if (%iqalert) { timeriqalert 1 3 msg %iqchan %iqalert %iqalert %iqalert $+ !!! You can get your General Knowledge Tested, begin with: !iq }
  .timeriq1 1 1 unset %iq*
  .timeriq2 1 2 timeriqend? off
  ruser %iqnick
}
on yes:TEXT:yes:?: {
  auser q1 %iqnick
  msg $nick Question one..
  .timeriq 1 2 msg $nick Which one of the five is least like the other four?
  .timeriq1 1 3 msg $nick Dog, Mouse, Lion, Snake, Elephant.
}
on q1:TEXT:*:?: {
  if ($1 == snake) { set %iqq1 6 | inc %iqscore 1 }
  elseif ($1 == dog) { set %iqq1 3 }
  elseif ($1 == mouse) { set %iqq1 2 }
  elseif ($1 == lion) { set %iqq1 1 }
  elseif ($1 == elephant) { set %iqq1 0 }
  else { set %iqq1 0 }
  msg $nick Question two..
  .timeriq 1 2 msg $nick What is the product of 4 and 3?
  .timeriq1 1 2 msg $nick Choices: 5, 1, 12, 7, 43.
  auser q1.5 %iqnick
}
on q1.5:TEXT:*:?: {
  if ($1 == 12) { set %iqq2 6 | inc %iqscore 1 }
  elseif ($1 == 7) { set %iqq2 3 }
  elseif ($1 == 5) { set %iqq2 2 }
  elseif ($1 == 1) { set %iqq2 1 }
  elseif ($1 == 43) { set %iqq2 0 }
  else { set %iqq2 0 }
  auser q2 %iqnick
  msg $nick Question three..
  .timeriq 1 2 msg $nick If I have 3 apples, 2 Lemons, 4 Radishes, 12 mangoes and a black label beer, how many fruits do I have?
  .timeriq1 1 2 msg $nick Choices: 10, 7, 9, 17, 12
}
on q2:TEXT:*:?: {
  if ($1 == 17) { set %iqq3 6 | inc %iqscore 1 }
  elseif ($1 == 12) { set %iqq3 3 }
  elseif ($1 == 9) { set %iqq3 2 }
  elseif ($1 == 10) { set %iqq3 1 }
  elseif ($1 == 7) { set %iqq3 0 }
  else { set %iqq3 0 }
  auser q2.5 %iqnick
  msg $nick Question four..
  .timeriq 1 2 msg $nick -5 + (+9)-(-8) is how much?
  .timeriq1 1 2 msg $nick Choices: 26, 12, -4, -8, 0
}
on q2.5:TEXT:*:?: {
  if ($1 == -4) { set %iqq4 6 | inc %iqscore 1 }
  elseif ($1 == 26) { set %iqq4 3 }
  elseif ($1 == 12) { set %iqq4 2 }
  elseif ($1 == -8) { set %iqq4 1 }
  elseif ($1 == 0) { set %iqq4 0 }
  else { set %iqq4 0 }
  auser q3 %iqnick
  msg $nick Question five..
  .timeriq 1 2 msg $nick Which one of the five choices makes the best comparison?
  .timeriq1 1 2 msg $nick Finger is to Hand as Leaf is to:
  .timeriq2 1 3 msg $nick Twig, Tree, Branch, Blossom, Bark
}
on q3:TEXT:*:?: {
  if ($1 == branch) { set %iqq5 6 | inc %iqscore 1 }
  elseif ($1 == twig) { set %iqq5 3 }
  elseif ($1 == tree) { set %iqq5 2 }
  elseif ($1 == blossom) { set %iqq5 1 }
  elseif ($1 == bark) { set %iqq5 0 }
  else { set %iqq5 0 }
  auser q4 %iqnick
  msg $nick Question six..
  .timeriq 1 2 msg $nick Johnny needs 13 bottles of water from the Seven 11 in Cape Town. Johnny can only carry 3 at a time.
  .timeriq1 1 2 msg $nick What's the minimum number of trips Johnny needs to make to the store?
  .timeriq2 1 3 msg $nick Choices: 3, 4, 4.5, 5, 6
}
on q4:TEXT:*:?: {
  if ($1 == 5) { set %iqq6 6 | inc %iqscore 1 }
  elseif ($1 == 4) { set %iqq6 3 }
  elseif ($1 == 3) { set %iqq6 2 }
  elseif ($1 == 4.5) { set %iqq6 1 }
  elseif ($1 == 6) { set %iqq6 0 }
  else { set %iqq6 0 }
  auser q4.5 %iqnick
  msg $nick Question seven..
  .timeriq 1 2 msg $nick If you rearrange the letters "LNGEDNA" you have the name of a(n):
  .timeriq1 1 3 msg $nick Choices: Animal, Country, State, City, Ocean.
}
on q4.5:TEXT:*:?: {
  if ($1 == country) { set %iqq7 6 | inc %iqscore 1 }
  elseif ($1 == animal) { set %iqq7 3 }
  elseif ($1 == state) { set %iqq7 2 }
  elseif ($1 == city) { set %iqq7 1 }
  elseif ($1 == ocean) { set %iqq7 0 }
  else { set %iqq7 0 }
  auser q5 %iqnick
  msg $nick Question eight..
  .timeriq 1 2 msg $nick Choose the word most similar to "Trustworthy":
  .timeriq1 1 3 msg $nick Choices: Resolute, Tenacity, Relevant, Insolent, Reliable.
}
on q5:TEXT:*:?: {
  if ($1 == reliable) { set %iqq8 6 | inc %iqscore 1 }
  elseif ($1 == tenacity) { set %iqq8 3 }
  elseif ($1 == relevant) { set %iqq8 2 }
  elseif ($1 == insolent) { set %iqq8 1 }
  elseif ($1 == resolute) { set %iqq8 0 }
  else { set %iqq8 0 }
  auser q5.5 %iqnick
  msg $nick Question nine..
  .timer 1 2 msg $nick If you are using Excel, which function offers the most convenient and most popular approach for extracting data from other spreadsheets or workbooks without using the manual copy and paste method? This is a one word answer.
  .timeriq1 1 3 msg $nick Choices: Filter, =, Vlookup, Import, Macro.
}
on q5.5:TEXT:*:?: {
  if ($1 == vlookup) { set %iqq9 6 | inc %iqscore 1 }
  elseif ($1 == filter) { set %iqq9 3 }
  elseif ($1 == =) { set %iqq9 2 }
  elseif ($1 == import) { set %iqq9 1 }
  elseif ($1 == macro) { set %iqq9 0 }
  else { set %iqq9 0 }
  auser q6 %iqnick
  msg $nick Question ten..
  .timeriq 1 2 msg $nick If a 60 year old couple retires in South Africa today, how much do they need too cover their future health care cost?
  .timeriq1 1 2 msg $nick Choices: 100000, 2800000, 1000000, 5000000, 56000
}
on q6:TEXT:*:?: {
  if ($1 == 2800000) { set %iqq10 6 | inc %iqscore 1 }
  elseif ($1 == 100000) { set %iqq10 3 }
  elseif ($1 == 1000000) { set %iqq10 2 }
  elseif ($1 == 5000000) { set %iqq10 1 }
  elseif ($1 == 56000) { set %iqq10 0 }
  else { set %iqq10 0 }
  .timeriqend? off
  set %iqtimecomp $calc($ctime - %iqstart)
  set %iqtimebonus $round($calc((600 - %iqtimecomp) / 100),0)
  set %iqmentalage $calc(%iqq1 + %iqq2 + %iqq3 + %iqq4 + %iqq5 + %iqq6 + %iqq7 + %iqq8 + %iqq9 + %iqq10 + %iqtimebonus)
  .timeriq1 1 1 msg $nick Your IQ is: $round($calc((%iqmentalage / %iqchronoage)*100),0) with %iqscore / 10 correct answers. Well done!
  .timeriq2 1 2 msg %iqchan %iqnick Completed the General Knowledge Squizz in $duration(%iqtimecomp) $+ , with an IQ of $round($calc((%iqmentalage / %iqchronoage)*100),0)
  .timeriq3 1 3 write $mircdir\IQ\Results.txt $round($calc((%iqmentalage / %iqchronoage)*100),0) %iqnick $duration(%iqtimecomp) %iqchronoage %iqscore $ctime
  .timeriq4 1 4 unset %iq*
  ruser %iqnick
  if (%iqalert) { timeriqalert 1 6 msg %iqchan %iqalert %iqalert %iqalert You can get your General Knowledge Tested, begin with: !iq }
}

on *:TEXT:!topiq*:#:{ 
  if (%topiq. [ $+ [ $address($nick,2) ] ] == 6) { halt }
  inc -u3600 %topiq. [ $+ [ $address($nick,2) ] ] 1
  if ($2 > 30) { msg $chan Keep it 30 and below @ $nick | return }
  $iif($2,set -u30 %topwhat $2,set -u30 %topwhat 10)
  topiq #
}

alias -l topiq {
  var %file = $mircdir\IQ\Results.txt, %l = %topwhat $+ , %d = $lines(%file), %w = @top10
  window -hn %w
  clear %w
  while %d {
    tokenize 32 $read(%file,nt,%d)
    aline %w 4 $+ $2 $+ :3 $1 $+ 10 
    dec %d
  }
  filter -cuteww 2 32 %w %w
  var %k = 1, %k1
  while %k <= %l  {
    %k1 = $addtok(%k1,$+($chr(32),12,$chr(35),%k,) $iif($line(%w,%k),$v1,),44)
    inc %k
  }
  msg $chan  12Top4 %topwhat 12IQ High Score's:
  msg $chan %k1 $+ .
}

Comments

Sign in to comment.
Paradigm   -  Apr 19, 2020

Hi, Im new to scripting and even to simple things as to loading scripts. Can anyone explain in detail how to load this script? Thanks in advance!

 Respond  
Gorth   -  Oct 14, 2018

I'm trying to figure out why its not keeping a top10 or top20 list... !topiq is an empty list. this is my first attempt at scripting mIRC

newklear  -  Nov 06, 2018

Make sure that a folder with the name IQ has been created and that there is a text file named Results.txt. If you loaded the script as is and allowed initialisation commands it should be there.

CrazyDriver  -  Nov 06, 2018

Script keeps breaking when you try to edit a line and the command won't work.

(Line 206): aline %w 01 $+ $2 4(7 $+ $1 $+ 4)00
(Line 212): %k1 = $addtok(%k1,$+($chr(32),05,$chr(35),%k,) $iif($line(%w,%k),$v1,),44)

Or can we not edit it and have it to how we like it as the darkblue hurts some of the users eyes in my room.

newklear  -  Nov 14, 2018

Have you made sure all the opening and closing brackets are correct ?, else just re-copy the script and paste over your existing. Just one missing "{ or }" can cause havoc.

CrazyDriver  -  Nov 15, 2018

I have done that and copied/pasted the bits of code from one I did to one you did and it worked once and when I went to update it a bit more, it wouldn't work, only the !iq part, !topiq wouldn't work at all.

Want me to copy & paste what I tried to do to see if you can see why it won't work on the !topiq part?

newklear  -  Jan 17, 2019

I see this is from some time back, did you come right ?

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.