Saturday, April 28, 2012

Tat's Trivia Bot, v. 3.65

Tat's Trivia Bot 3.7

Latest Version: Tat's Trivia 3.69

Download: Tat's Trivia Bot, 3.65

Update: 3.66
A version for every day of the year.

It mostly adds a couple hooks for awards, namely on Champ, TeamAnswer, and TeamVictory


I also added a command /trivia.team.credit

This is to allow one to give points to the entire team (the will transliterate from *) points. Apparently some people don't want to play on teams if the only points you get are individual. That seems reasonable, and I'll make it able to be fixed by you folks on an individual basis. So for pretty much everybody save Brett this version will do nothing for you.

(Fixed odd oversight with 3.61 included)

26 comments:

Brett said...

Tat you are amazing. That is all.

Brett said...
This comment has been removed by the author.
Brett said...

it seems this version is 3.61? when I use !version it tells me 3.61, and I don't see the new features in it either. I downloaded from the 365 zip and the normal tat-trivia zip, both show 3.61

Tatarize said...

You're ofcourse right. The location of the loaded version of triviascript.mrc which I modified was different than I expected and I wrongly included an older version. I included the correct version and rectified the error.

Avery said...

Updated to MIRC 7.22 and I can't get the script to start. It loads in to the commands but it won't start.

Tatarize said...

Avery does it have the question file right? There's an odd bit with the location of the $mircdir being changed to the user directory rather than actually the directory mIRC uses. So it will lock up if there's zero questions to use.

Tried a fresh copy to see if there were issues. It seemed pretty minor.

umadbor said...
This comment has been removed by the author.
umadbor said...

Hi Tat,

I found an error in the script which won't update the scores when a person says the correct answer. This is the mIRC error: * /write: error updating 'C:\Users\Tom\AppData\Roaming\mIRC\TriviaScores.fil' (line 1228, trivscript.mrc) and this is line 1228: write $iif($readn,-l $+ $readn) $scoresfil %newline
.

Can you issue a fix for this please? Awesome script by the way. Thank You Tat.

Tatarize said...

@umadbor

write $iif($readn,-l $+ $readn) $scoresfil %newline

That line is fine. There's nothing wrong with it. My guess is you are out of harddrive space. Or your OS is somehow restricting your ability to access that file.

The error given is the write update error meaning it's an IO error not something to do with the script. And I don't think MSL has any error handling built in.

While there is certainly a chance that K changed something and my script is somehow not compatible. I run the latest version of mIRC in windows 7. And it doesn't throw that error, so I'm going to figure harddrive space.

Xelloss said...

Under the Trivia Settings -> General, I was wondering if it's possible to exclude the use of scrambled (on Random setting) on answers less than a certain number of characters? I found on short answers, it literally spells them out at times.

Tatarize said...

Hm. If it is asked to scramble a 4 letter word it will only have 4! possibilities so 1/24th of the time it will spell out the answer. And might even spell out the 1/120 for five letter answers. There's no limiting factor for scrambles. If it asks a scramble it asks it. Perhaps just get rid of the questions in the question file. I suppose I could toss in a check to make sure it's not exactly the right answer. To insure that it didn't just shuffle all the letters and end up with the same thing it started with.

But, the only restriction is whether the file asks such questions in the first place, and those you have control over.

Unknown said...

Hey Tat, is there any way to get the round scores to show after a round of trivia is started using a theme? I have the Round HOF option checked but it only works for the normal trivia games.

Kita Agency said...

hai Tat
i'm having the same problem with Avery, i'm using mirc 7.22, the script is loaded but i can't get the trivia start
i tried reinstall the mirc with the older version (6.11), but it still doesn't start :(
what should i do, please help Tat
pretty thanks

Tatarize said...

If it doesn't start it is likely because it doesn't detect any questions in existence. Go to settings, hit the "Trivia Dir" button and make sure to set it to the directory the questions.txt file is in.

In recent versions mIRCs program files and the $mircdir are in different places. So if you have it set to the wrong place it won't find it and won't run. But, what was once rare can now be common because the data goes into your user directory and the questions.txt may well have been placed somewhere else.

Kita Agency said...

Hi Tat,

I'm still having the same problem, the bot won't respon anything.

I already put the trivscript.mrc and questions.txt in the folder C:\Users\user\AppData\Roaming\mIRC\ (the same as directory Trivia Dir), but still not work.

I type !trivia, the bot didn't respon, and when i enable the Join Message, it didn't respon too when another person join the channel.

I follow all instructions in the readme.txt, but still won't work :(

Please help me Tat.

Tatarize said...

Kent. There's a checkbox in themes that says "Round Scores" or something. Check that.

One of the main oversights with themes is that it overtly forces on or forces off and for checkboxes like that it doesn't have an option for fall-through and use the main settings. So that checkbox in themes has a trump card over the settings in option for theme game.

Tatarize said...

safwat, I'm pretty sure it's still a mistake with the mIRC dir. It needs to be set inside the trivia script. I updated the version so that it will actually respond correctly with an error and updated the readme instructions to be more up to date.

Anonymous said...

safwat, I encountered the same issue as you. Step 4 of the readme.txt;

4) On the channel you wish to use right click, go to Trivia, Add Channel.

wasn't particularly clear to me. I've got a lot of options when right clicking and after noticing a new Trivia option at the bottom, I was able to add the Channel, configure the bot and get it all working.

Thank you very much Tat!

Semicharmless

Chromatic said...

Tat,

For the life of me I cannot get the !next command to work with your Trivia Script 3.69 version.

First your Trivia code is beyond epic. I've been using it for almost a year now.

I've scanned the code and I don't see the !next command actually in the code -- I see it listed as a Menu option, but cannot find the code for it to actually work.

Could you double check your code to see if it is in there?

I've checked at least 30-40 times if any other scripts I've coded or am using have the same command that would interfere, and they do not.

This is a command that would be immensely useful, or even just a workaround for a !nextquestion !skipquestion or whatever that I could just paste in the code would be fantastic!

I would modify it myself, but the code is so complex and clean I just don't want to take the chance of screwing with it with my intermediate mSL coding skill.

Thanks.. you can reach respond here.. or directly email me at ikoslog@gmail.com if you feel up to it.

You rock!

Tatarize said...

Chromatic, you don't see it there because in the twisted stuff that is my code it's broken down a few different ways. The commands are tokenized and compared so that you can change the command character from ! to $ or whatever. Then they are checked against a tokenized string, assigned a number and the number is what is compared.

next is command 38. The relevant line is:

if (%ctok == 38) { if (($calc($question.time * 2) >= $lag(timedout)) && (!$isdis(15))) { trivx $chan } }

Which is to say: if the command token is exactly 38 ("next") and if the twice time in the question so far is greater than the lag for the timeout of the question, and next isn't disabled in commands then end the trivia round in the relevant channel.

The problem here is that it's completely undocumented that you can't use !next unless the question is at least half over. And tells you nothing of why it didn't do a damned thing.

if (%ctok == 38) { if (!$isdis(15)) { trivx $chan } }

However would make it so next would always work (unless it's disabled).

Tatarize said...

It is one of my biggest regrets that though I tried to make it as readable and alterable as possible it's really not. It's actually a terrible thing that somebody with some coding experience couldn't find that bit of spaghetti code that doesn't remotely say what it does and find out why it was weird.

Or why didn't I just make the $isdis() is_disabled bit of code, allow for a timing requirement there. Why did I ever hardcode that and tell nobody anywhere. When I could have had it disabled the first half of the question and enabled the second half with a quick tweak to my command functions.

I was more worried at the time about keeping the code tight than about keeping it readable, that even I'm scared at points to touch it lest, I might break a feature that I forgot I tossed in there consisting of about a single line and a registered option. I got pretty much every feature anybody ever asked for in the code. Then bug fixed it for a few years when those came up. So I can't really completely scrap the code. But I would write it much more coherently if I did.

Tatarize said...

menu menubar {
-
Acro: if (!$dialog(acrobot)) { dialog -m acrobot acrobot }
-
}
alias a1 { return 04 $+ $1- $+ }
alias a2 { return 13 $+ $1- $+ }
alias acrotheme { return $iif(%acro.topic, %acro.topic, General) }

on *:TEXT:!*:%acro.chan:{ acom $1- }
on *:Input:%acro.chan:{ acom $1- }
alias acom {
if ($istok(!aon.!aoff.!submit.!vote,$1,46)) {
$+(acro.,$1) $2-
}
}

alias acro.!aon {
asay $msg.acro.start
.timeracro 1 10 acro.start $chan
}
alias acro.!aoff {
acro.off
}

alias acro.!submit {
if (!$timer(vote)) return;
var %pattern = /^ $+ $replace($lower(%acro), $chr(32), \S*\s) $+ \S* $+ $ $+ /
if (!$regex($lower($1-), %pattern)) { asay $a1(Bad Acro) | return }
asay $msg.acro.add($1-)
hadd Acro Acro. $+ $nick $1-
hadd Acro Time. $+ $nick $ticks
}
alias acro.!vote {
if (!$timer(toff)) return;
if ($aget(Voted. $+ $nick)) { asay $msg.acro.error.voted | return }
if ($1 !ison $chan) { asay $msg.acro.error.nothere | return }
if ($1 == $nick) { asay $msg.acro.error.noself | return }
if (!$aget(Acro. $+ $1)) { asay $msg.acro.error.noacro | return }
aset Voted. $+ $nick 1
aset Score. $+ $1 $calc($aget(Score. $+ $1) + 1)
asay $a1($nick) $a2(voted for) $a1($1)
}




alias acro.start {
set %acro.chan $1
if (!$hget(Acro)) { hmake Acro 10 }
var %i = $rand(2,7)
set %acro
while (%i >= 1) {
%acro = %acro $getletter
dec %i
}
asay $msg.acro.acro
.timervote 1 60 acro.vote $1
}

alias acro.vote {
set %achan $1
if ($afind(Acro.*,0) <= 1) { asay $msg.acro.error.notppl | acro.stop }
asay $msg.acro.vote
.timertoff 1 20 acro.off $1
}

alias acro.off {
var %i = $afind(Score.*,0), %bestscore = -1, %bestname, %besttime
while (%i >= 1) {
var %cn = $afind(Score.*,%i)
var %cv = $remove(%cn,Score.)
if (!$aget(Voted. $+ %cv)) { aset %cn -1 }
var %cs = $aget(%cn)
if ((%cs > %bestscore) || ((%cs == %bestscore) && ($aget(Time. $+ %bestname) >= $aget(Time. $+ %cv)))) {
%bestscore = %cs
%bestname = %cv
%besttime = $aget(Time. $+ %cv))
}
dec %i
}
if ($aget(Voted. $+ %bestname)) { asay $msg.acro.winner(%bestname, %bestscore, $aget(Acro. $+ %bestname)) }
asay $msg.acro.stop
acro.stop
}

alias acro.stop {
if ($hget(acro)) { hfree Acro }
.timertoff off
.timeracro off
.timervote off
halt
}

alias aget { return $hget(Acro,$1-) }
alias aset { hadd Acro $1- }
alias afind { return $hmatch(Acro, $1, $2) }
alias asay { $iif($nick == $me, .timer 1 0) msg $iif($chan,$chan,%achan) $$1- }
alias getletter { return $mid($afl, $rand(1, $len($afl)), 1) }
alias afl { return AAAAAAAABBCCCCDDDDDEEEEEEEEEEEEEEFFFFGGGHHHHHIIIIIIIIJKLLLLLMMMMNNNNNNNNNOOOOOOOOPPPPQRRRRRRRRRSSSSSSSTTTTTTTTTTUUUUVVWWWXYYYZ }

alias acro.version { return 1.0 }
alias acro.name { return Tat's Acrobot v. $+ $acro.version }
alias msg.acro.start { return $a1(Starting $acro.name) }
alias msg.acro.stop { return $a1(Stopping $acro.name) $a2(!aon) $a1(to play again) }
alias msg.acro.add { return $a2($nick) $+ $a1('s Acro Added:) $a2($1-) }
alias msg.acro.vote { return $a1(Voting Mode! Submit your) $a2(!vote) $+ $a1(s!) }
alias msg.acro.acro { return $a1(The Acro is:) $a2(%acro) $a1(! You have 60 seconds to) $a2(!submit) $a1(your acros.) }
alias msg.acro.winner { return $a1(Winner is:) $a2($1) $a1(with) $a2($2) $a1(for) $a2($3) }
alias msg.acro.error.voted { return $a1(You have already voted!) }
alias msg.acro.error.nothere { return $a1(That user isn't even in the room!) }
alias msg.acro.error.noself { return $a1(You cannot vote for yourself!) }
alias msg.acro.error.noacro { return $a1(That user has no acro to vote for!) }
alias msg.acro.error.notppl { return $a1(Not enough Acro's added. No points. Game Over) }
dialog acrobot {
title "Tat's Acrobot"
size -1 -1 106 23
option dbu
edit %acro.chan, 1, 30 1 72 10, multi autohs
text "Acro Chan:", 2, 2 2 28 8, center
}
on *:dialog:acrobot:edit:1:{ set %acro.chan $did(1) }

Tatarize said...

Like that, straight forward easy to grasp but still quite powerful.

Unknown said...

Jesus Tat.. You are a Genius..

I am scared to touch the code.. it's so complex,.. but your little fix there.. worked. Just spits out the answer immediately (times up).. and goes on .. Perfect. Thank you!

Tat.. I have a project in mSL (this language) for IRC that I could use your skills. If you would code something for money, email me.. It's beyond my expertise.. Send a message to ikoslog@gmail.com

If you don't code for money,.. That's cool too. (This would be super easy for you as it's nothing as difficult or long as the trivia code I promise).

Unknown said...

Hi,

Probably something really obvious I am missing but, no matter what I do, I cannot get the bot to load in mirc. I have checked to make sure I am adding all riles to the correct directory, copying and pasting the /load command into status window and all I get is -RS unknown command. Any ideas?
Thanks!

Tatarize said...

It shouldn't say that. The command is /load not the -rs, -rs is the flag for remote script.

/load -rs

There's some chance that you could have an alias for /load which causes it to fail. But, in any event you could do it directly through the GUI.

Tools, Script Editor.
File, Load.

Also, in script editor, you could check the aliases and make sure there isn't one for /load specifically /load $1 which would do what you describe.