mIRC Homepage
Posted By: admeister Help with trivia script. - 26/08/07 12:01 PM
I'm using a trivia script almost identical to the one posted here by Sleepyfreak: https://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=124936&site_id=1#import

I have two major problems however. Tye first is that it chooses a random question every time from my trivia.txt, which means a lot of repition. I'd appreciate if someone could show/tell me how to set it to go through the questions in order.

The second is that sometimes a blank question will come up, which looks like this in the channel:

New Question:
HINT:
HINT:

Anyone know how to stop this from happening? Any help would be appreciated! smile

admeister.
Posted By: Riamus2 Re: Help with trivia script. - 26/08/07 03:58 PM
Without seeing the exact script, it's hard to be much help. However, a way to not repeat questions is to "load" your questions into a separate file or else a custom (hidden) window in a random order, then do the questions in order from that new location. Once you get to the end, just remove the questions from the new location and "reload" them randomly again. This will keep them random and you'll never repeat a question until all questions have been asked.

As for the blank questions, you'll have to debug your script to find the cause. Maybe you have questions that are formatted badly or blank lines in your questions file.
Posted By: admeister Re: Help with trivia script. - 26/08/07 11:55 PM
OK, thanks for that. I'll post the actual script in here then, since it sounds like that will help. I'm not totally sure how to do the things you said.

I haven't got any blank lines in my trivia.txt, all of the questions are on the next line after the previous one, like this:

Blue and Green make?|**l*o*|y*l*o|Yellow
1 + 1 = ?|*|*|2

There's no gap at the top of the .txt file, the questions start from the first line.
Posted By: Bekar Re: Help with trivia script. - 27/08/07 01:04 AM
the | (pipe) character is possibly not the best character to use as a delimter in mIRC.

Try two things:
* ensure that any $read()/$readini() you are using doesn't try to evaluate the line
* use a different character as a delimeter (@ or ^ for instance)
Posted By: Riamus2 Re: Help with trivia script. - 27/08/07 02:32 AM
Just by seeing the question/answer format, I have a feeling that it's not a great trivia script. You may want to try another one instead. Just a thought.
Posted By: admeister Re: Help with trivia script. - 27/08/07 04:27 AM
Yeah, it's a little unusual. I've had some success with it so far, but as I said, the randomness of the questions really messes it up, as does the blank lines. Can you recommend a good script, Riamus?

I'll try changing the deliner and see what happens, as well as the other bit.
Posted By: OrionsBelt Re: Help with trivia script. - 27/08/07 10:11 AM
I believe the one available on this site, is one of the best.
Haven't used it myself, but if I ever wanted a triv-bot I would try this one out.

TrivBot2001v2
Posted By: CtrlAltDel Re: Help with trivia script. - 27/08/07 02:11 PM
Originally Posted By: OrionsBelt
I believe the one available on this site, is one of the best.
Haven't used it myself, but if I ever wanted a triv-bot I would try this one out.

TrivBot2001v2


Speaking from personal experience, I have used this one (even though it uses mirc 5.91), and I've seen it in use on countless channels on undernet, efnet, dalnet, and rizon. Highly recommended (even for learning how to make your own). There is (was) an updated copy edited by Watchdog (here on the forums) that used mirc 6.03+ (but the link I had to that no longer works (maybe he'll give us another link someday, or let someone else host it).
Posted By: admeister Re: Help with trivia script. - 27/08/07 02:21 PM
Hmm, maybe that one you linked to is outdated, I can't get it to run properly. I'm using the latest version of Mirc, and when I go to mix questions it crashes. There is also a message saying that there is no haveused.ini. Hmm.

Oh, and here is the original script I was using:

on *:text:!trivia:%chans: {
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
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 wronf
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! 12ANSWER:4 $gettok(%thing,4,124)
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:*:%chans: {
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!
}
}
}
on *:join:%chans: {
if ($me isop #) {
if (%score [ $+ [ $nick ] ] > 49) && (%score [ $+ [ $nick ] ] < 99) {
mode # +h $nick
}
elseif (%score [ $+ [ $nick ] ] > 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 $$?="Enter Channel For Trivia!"
}
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
}
}
Posted By: CtrlAltDel Re: Help with trivia script. - 27/08/07 02:40 PM
Quote:
Speaking from personal experience, I have used this one (even though it uses mirc 5.91)


It comes packaged with the older version (my bad .. it's actually 5.61 and not 5.91) in the trivbot2001v2 folder created when you unzip it. AFAIK it will NOT work with any version of mirc that's newer.

[edit] And yes, I just downloaded and tried it [/edit]

hmmm look here but scan before opening.
Posted By: Horstl Re: Help with trivia script. - 27/08/07 03:51 PM
Please wrap the text it code tags when you're pasting (extensive) code smile
It's the [#] button above the input box when writing/editing a post.
Posted By: Riamus2 Re: Help with trivia script. - 28/08/07 01:15 AM
As mentioned, TrivBot is a great trivia bot. It's outdated, but many people have updated it since then, even if they haven't released it. It's kind of the basis of my own trivia bot, though mine is really updated and is designed specifically for our channel, so I can't just release it for others to use.
© mIRC Discussion Forums