mIRC Homepage
Posted By: Forgotten00 How do you make a Trivia Script? - 23/04/05 06:42 PM
Before you complain, jsut remember, you were a noob once. So don't get all pissy

Please tell me how to make one? explain it, dont post a source or a link.
Posted By: SladeKraven Re: How do you make a Trivia Script? - 23/04/05 06:50 PM
How can I say this so I don't come across pissy, you say your a newbie so why not try coding something not so hard to do? There's loads of ways to write a trivia script, can't you just download one?
Posted By: tidy_trax Re: How do you make a Trivia Script? - 23/04/05 08:54 PM
It's not exactly the simplest thing to explain, but i'll tell you how I would do it...

  • Save questions and answers in files formatted like: question<tab>answer
  • Load the file to a hashtable for quick access.
  • Ask a question in the channel, wait for about a minute and then end the question and ask a new question.
    If the question is answered within the time limit then turn the timer off and ask the next question.
Posted By: Riamus2 Re: How do you make a Trivia Script? - 23/04/05 10:34 PM
Trust me... download one and edit it however you want it. It'll save you a LOT of time ... especially if you're new to scripting. A full trivia script isn't a simple task if you don't know what you are doing.
Posted By: Mike2005 Re: How do you make a Trivia Script? - 23/04/05 10:37 PM
Yeah, it really isn't....
Posted By: Sleepyfreak Re: How do you make a Trivia Script? - 16/05/05 08:44 AM
the very easy way of making a trivia script is like this
on *:TEXT:!trivia*:#:{
/msg $chan Question 1 what is homer simpsons job
/msg $chan A)Nulear Power B)Ice-cream worker C)TV Host
}
on *:TEXT:TV Host:#:{
/msg $chan Correct well done $nick
/msg $chan Question 2 just keep going on like this
/msg $chan A) if you need more help private messege me
}
Posted By: Riamus2 Re: How do you make a Trivia Script? - 16/05/05 01:27 PM
LOL! Yeah, that's easy.... but very bloated. No offense. smile

Think of how many lines you're looking at for a 10,000 question database!!! Your script would go into the MB's very quickly. smile
Posted By: Sleepyfreak Re: How do you make a Trivia Script? - 21/05/05 03:49 PM
yeah but thats very easy if u want i can get an easier one
here it is but tell me if it ain't working it should
Code:
 on *:text:!trivia:#: {
  if (%trivia == $null) { 
    msg $chan 4Trivia12 Has Started. You Have4 30 12seconds to Answer
    set %thing $read(trivia.txt)   
    set %question $gettok(%thing,1,124)
    set %trivia on
    set %answer $gettok(%thing,4,124)
    msg $chan 4Question:12 %question
    notice $me set %answer
    set %chan #
    .timer1 1 15 msg $chan 12HINT:4 $gettok(%thing,2,124)
    .timer2 1 25 msg $chan 12HINT:4 $gettok(%thing,3,124)
    .timer3 1 35 wrong
    haltdef
  }
  else { msg $nick 4Trivia12 is Already On }
}
alias wrong {
  if (%trivia == on) {
    msg %chan 12You Failed To Answer The Question! next Question in4 5 12seconds!
    unset %answer
    unset %question
    unset %thing  
    .timer 1 5 new
    haltdef
  }
}
alias new {
  if (%trivia == on) {
    set %thing $read(trivia.txt)
    set %question $gettok(%thing,1,124)
    set %trivia on
    set %answer $gettok(%thing,4,124)
    msg %chan 12New Question:4 %question
    .timer1 1 15 msg %chan 12HINT:4 $gettok(%thing,2,124)
    .timer2 1 25 msg %chan 12HINT:4 $gettok(%thing,3,124)
    .timer3 1 35 wrong
    haltdef
  }
}
on *:text:*:#: {
  if ($1 == %answer) {
    .timer3 off
    .timer1 off
    .timer2 off
    msg %chan 12You Got It Right The Answer Was:4 $+(%answer,!)$+ $+(12,$nick)$+ Has %score [ $+ [ $nick ] ] Point(s)!
    inc %score [ $+ [ $nick ] ]
    unset %answer
    unset %question
    unset %thing
    .timer 1 5 new
    haltdef
  }
  if ($1 == !strivia) {
    msg %chan 4Trivia12 Has Been Halted!
    .timer1 off
    .timer2  off
    .timer3 off
    .timer4 off
    unset %trivia
    unset %answer
    unset %question
    unset %thing
    haltdef
  }
  if ($1 == !won) {
    if (%score [ $+ [ $nick ] ] == $null) {
      notice $nick You Have 0 Points
    }
    elseif (%score [ $+ [ $nick ] ] != $null) {
      notice $nick You Have %score [ $+ [ $nick ] ] Points!
    }
  }
}
off *:join:#: {
  if ($me isop #) {
    if (%score [ $+ [ $nick ] ] &gt; 49) &amp;&amp; (%score [ $+ [ $nick ] ] &lt; 99) {
      mode # +h $nick
    }
    elseif (%score [ $+ [ $nick ] ] &gt; 99) {
      mode # +o $nick
    }
    elseif (%score [ $+ [ $nick ] ] == $null) {
      msg $chan 4Welcome12 to4 $chan 12Type4 !trivia12 to play the Trivia Game, Type 4!strivia12 to stop 
    }
  }
}
alias chans { 
  if (!$1) {
    set %chans $$?="#Test" 
  }
  else { 
    set %chans $1
  }
}
on *:input:#: {
  if ($1 == !trivia) {
    if (%trivia == $null) { 
      msg $active $1-
      msg $active 4Trivia12 Has Started. You Have4 30 12seconds to Answer
      set %thing $read(trivia.txt)   
      set %question $gettok(%thing,1,124)
      set %trivia on
      set %answer $gettok(%thing,4,124)
      msg $chan 4Question:12 %question
      set %chan #
      .timer1 1 15 msg $chan 12HINT:4 $gettok(%thing,2,124)
      .timer2 1 25 msg $chan 12HINT:4 $gettok(%thing,3,124)
      .timer3 1 35 wrong
      haltdef
    }
  }
  if ($1 == !strivia) {
    msg $active $1-
    msg $active 4Trivia12 Has Been Halted!
    .timer1 off
    .timer2  off
    .timer3 off
    .timer4 off
    unset %trivia
    unset %answer
    unset %question
    unset %thing
    haltdef
  }
  if ($1 == !won) {
    if (%score [ $+ [ $me ] ] == $null) {
      echo -a 12You Have4 0 12Points
    }
    elseif (%score [ $+ [ $nick ] ] != $null) {
      echo -a 12You Have4 %score [ $+ [ $nick ] ] 12Points!
    }
  }
  if ($1 == %answer) {
    msg $active $1-
    .timer3 off
    .timer1 off
    .timer2 off
    inc %score [ $+ [ $nick ] ]
    msg %chan 12You Got It Right The Answer Was:4 $+(%answer,!)$+ $+(12,$nick)$+ Has %score [ $+ [ $nick ] ] point(s)!
    unset %answer
    unset %question
    unset %thing
    .timer 1 5 new
    haltdef
  }
}

 


thats the code but you need a file in your mirc folder called trivia.txt and add the questions like this

here are the questions i have
Code:
 
 what is The Scientific name for a Spider?|A-------|Ar-----d|Arachnid
What nation has had a monarchy the longest?|J----|J---n|Japan
What childhood disease did 312 Americans have in 11993, a record low?|m------|me----s|measles
What Italian city had the Roman name Mediolanum?|M----|Mi--n|milan
What distant planet circles the sun every 84 years?|U-----|Ur---s|Uranus
What European country is threatened by over 100 active volcanoes?|I------|Ic----d|Iceland
Who is the helmsman of the boat when you are sailing into Hades?|C-----|C---on|Charon
What dog shares his owner with Garfield the Cat?|O---|O--e|Odie
What was JFK's nickname for his daughter Caroline?|B------|B----ns|Buttons
What type of number describes the ratio of the speed of a plane to the speed of sound?|m---|ma--|mach
What color are a zebra's stripes during the first six months of life?|b----|br--n|brown
Who is the Barber of Seville?|F-----|F-g-a-o|Figaro
What city in Nepal translates as "wooden temples?"|---h---du|K-th--ndu|Kathmandu
Earth's outer layer of surface soil or crust is called the _____________.|lit--------|lit------re|lithosphere
This county has the lowest point in South America.|A--------|A----t-na|Argentina
What US City is known as The River capital of the world?|A----|Ak---|Akron
What's the worlds widest river?|A-----|Am---n|Amazon
What weapon is tattooed on Glen Campell's arm?|d-----|d-gg--|dagger
What subject did Mr. Chips teach?|L----|La--n|Latin
What did Wilhelm Roentgen discover in 1895?|X-----|X-R---|X-rays
What's the better-known name of the card game Twenty-One?|B--------|Bl---j---|Blackjack
What coutnry did 300,000 Chinese troops invade in February, 17979?|V------|Vi----m|Vietnam
From what "black metal" did blacksmith's take their name?|i---|i--n|iron
What Italian city is considered the fashion capital?|M---|Mi--|Mila
What 1970 movie hit was banned on military bases?|M---|MA--|MASH
Jimmy Carter once thought he saw a UFO; what was it?|V----|Ve---|Venus
What country used the deadly nerve gas SARIN against Kurdish minority factions in the 1990s?|I---|I--q|Iraq
What is the computer acronym for "picture element?"|p----|P-x--|Pixel
What segment of television receieves the ACE awards?|c----|C--le|Cable
What is the three headed dogs name that Hagrid (harry potter book 1) owns?|F-----|F--ff-|Fluffy
 
Posted By: Riamus2 Re: How do you make a Trivia Script? - 13/06/05 04:47 PM
I seem to have missed the reply when I went on vacation. I'd just like to suggest that the script should do the hints automatically rather than including the hints in the questions file. Much easier that way and depending how you do the hints, the hints can end up being different each time the question is displayed rather than a static hint.
© mIRC Discussion Forums