Advertisement
Logikos

qi trivia chromatic

Mar 3rd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 140.57 KB | None | 0 0
  1. alias trivia.version { return 3.69 }
  2. alias trivia.name { return Tat's Trivia Bot }
  3. alias trivia.web { return http://tatarize.nfshost.com/ }
  4. ;########################################################
  5. ;# Direct IRC interactions. #
  6. ;########################################################
  7. on *:START: { trivia.init }
  8. on *:LOAD: {
  9. init.load
  10. }
  11. on *:INVITE:*: {
  12. if ($trivia.turnedoff) { return }
  13. if ($trivchan) { join $chan }
  14. }
  15. on *:JOIN:*: {
  16. if ($trivia.turnedoff) { return }
  17. inc -u5 %trivia.netsplit
  18. set -u3 %ident $chan
  19. if ((%trivia.netsplit >= 3) || (!$trivchan) || (!$getset(status,bot))) { return }
  20. if (($nick != $me) && (!$isdis(31))) { if ($getset(status,onjoin)) { inform $msg.trivia.onjoin } }
  21. elseif ($getset(status,autostart) == 1) { trivia }
  22. award join $nick
  23. }
  24. on *:INPUT:#: {
  25. if ($trivia.turnedoff) { return }
  26. if ((!$trivchan) || (/* iswm $1-)) { return }
  27. set -u3 %ident $chan
  28. if ($pre $+ * iswm $strip($1-)) { processcommand $strip($1-) }
  29. elseif ($question.on) { processguess $1- }
  30. }
  31. on *:ctcpreply:ping*:{
  32. if ($trivia.turnedoff) { return }
  33. if ($isdis(17)) return
  34. if (($eval(% $+ ping. $+ $nick,2)) && ($2 isnum)) {
  35. set -u3 %ident $eval(% $+ pingchan. $+ $nick,2)
  36. scid $eval(% $+ pingcid. $+ $nick) inform $msg.ping.reply
  37. unset % $+ ping. $+ $nick
  38. unset % $+ pingchan. $+ $nick
  39. unset % $+ pingcid. $+ $nick
  40. $eval(set -u $+ $slag(ping) % $+ pingantispam. $+ $nick 1,2)
  41. }
  42. }
  43. on *:TEXT:*:#:{
  44. if ($trivia.turnedoff) { return }
  45. set -u3 %ident $chan
  46. if (!$trivchan) return
  47. if ($pre $+ * iswm $strip($1-)) { processcommand $strip($1-) }
  48. else if (($question.on) && ($left($1,1) != /)) { processguess $1- }
  49. }
  50. on *:TEXT:*:?: {
  51. if ($trivia.turnedoff) { return }
  52. set -u3 %ident $chan
  53. if (($pre $+ $gtok(29) $+ * iswm $strip($1-)) || ($pre $+ $gtok(30) $+ * iswm $strip($1-))) { processcommand $strip($1-) }
  54. }
  55. ;########################################################
  56. ;# Channel setup and related checks. #
  57. ;########################################################
  58. alias trivchan {
  59. var %i = 1
  60. while ($tchan(%i)) {
  61. if (($tchan(%i,3) iswm $me) && ($tchan(%i,2) iswm $ifd($network,irc))) {
  62. if (($tchan(%i) iswm $chan) || ((!$chan) && ($me ison $tchan(%i)))) {
  63. if ($1) return $tchan(%i)
  64. return %i
  65. }
  66. }
  67. inc %i
  68. }
  69. }
  70. alias tchan { return $ifd($gettok($getset(chan,$1), $ifd($2,1), 59),$iif($2 isnum 2-3, *)) }
  71. ;########################################################
  72. ;# Menubar and submenu functions. #
  73. ;########################################################
  74. menu channel,menubar {
  75. Trivia
  76. .$showon(Trivia Options):{ if (!$dialog(trivset)) { dialog -m trivset trivset } }
  77. .$showon(Start Trivia)
  78. ..$showon(Standard):{ $trivia }
  79. ..$showon(Unlimited Game):{ $trivia(unlimited) }
  80. ..$showon(Team Game):{ $trivia(team) }
  81. ..$showon(Theme Game)
  82. ...$submenu($theme.submenu($1))
  83. ..$showon(Specify round):{ $trivia($$?="How many question in the trivia round?") }
  84. .$showon(Stop Trivia):{ strivia }
  85. .$showon(Set Channel):{ chan.add $$chan }
  86. .$showon(-)
  87. .$showon(Features)
  88. ..$showon(Build Scores HTML):{ htmlbuild }
  89. ..$showon(Process HTML Commands):{ htmltrigger }
  90. ..$showon(HTML Options):{ if (!$dialog(trivbuild)) { dialog -m trivbuild trivbuild } }
  91. ..$showon(Themes Setup): { if (!$dialog(triviatheme)) { dialog -m triviatheme triviatheme } }
  92. ..$showon(Ranks Setup): { if (!$dialog(trivrank)) { dialog -m trivrank trivrank } }
  93. }
  94. alias theme.submenu {
  95. if (($1 == begin) || ($1 == end)) return -
  96. if ($getset(triviamode $+ $1, name)) return $getset(triviamode $+ $1, name) $+ : /trivia $getset(triviamode $+ $1, name)
  97. }
  98. menu menubar {
  99. Trivia
  100. .$showon(Force Question):{ ask }
  101. .$showon(Scores)
  102. ..$showon(Scores):{ if (!$dialog(triviascores)) { dialog -m triviascores triviascores } }
  103. ..$showon(Give Points): { trivia.credit $$?="Credit whom?" $$?="How many points do you wish to give, -# to remove score" }
  104. .$showon(Echo)
  105. ..$showon(Records):{ tsay $msg.trivia.records }
  106. ..$showon(HoF):{ tsay $msg.trivia.hof }
  107. ..$showon(Repeat):{ tsay $msg.question.current }
  108. ..$showon(Hint):{ tsay $msg.hint.hint }
  109. .$showon(Open)
  110. ..$showon(Questions):{ if $isfile($qfile(1)) { run $qfile(1) } }
  111. ..$showon(Additions):{ if $isfile(" $+ $triv(dir) $+ / $+ $triv(additions) $+ ") { run " $+ $triv(dir) $+ / $+ $triv(additions) $+ " } }
  112. ..$showon(Report):{ if $isfile(" $+ $triv(dir) $+ / $+ $triv(report) $+ ") { run " $+ $triv(dir) $+ / $+ $triv(report) $+ " } }
  113. .$showon(-)
  114. .Trivia Bot is [ $trivon ]
  115. ..$showon([ $trivdisflip ]) $+ :{ setset status bot $iif($getset(status,bot) == 1,0,1) }
  116. ..[ $trivoffflip ] $+ :{ setset status botstate $iif($getset(status,botstate) == 1,0,1) }
  117. .-
  118. .Trivia Unload:{ if ($?!="Really Unload?") { unload -rs $script } }
  119. }
  120. menu nicklist {
  121. $showon(Trivia)
  122. .$showon(Control)
  123. ..$showon(Ban):{ tban $$1 }
  124. ..$showon(Unban):{ tunban $$1 }
  125. .$showon(Add as Friend): { triviafriend.add $address($$1,7) }
  126. .$showon(Credit)
  127. ..$showon(Award)
  128. ...$showon(1): { trivia.credit $$1 1 }
  129. ...$showon(5): { trivia.credit $$1 5 }
  130. ...$showon(10): { trivia.credit $$1 10 }
  131. ..$showon(Deduct)
  132. ...$showon(1): { trivia.credit $$1 -1 }
  133. ...$showon(5): { trivia.credit $$1 -5 }
  134. ...$showon(10): { trivia.credit $$1 -10 }
  135. ..$showon(Input Amount): { trivia.credit $$1 $$?="How many points do you wish to give, -# to remove score" }
  136. }
  137. alias showon { if ($getset(status,botstate) != 1) return $1- }
  138. alias trivia.turnedoff { if ($getset(status,botstate) == 1) return $true }
  139. ;########################################################
  140. ;# Menubar related, aliases. #
  141. ;########################################################
  142. alias trivia.team.credit {
  143. if (($team) && ($2 isnum)) {
  144. var %list $get.showteams($1)
  145. var %amount $2
  146. var %j $numtok(%list,32)
  147. while (%j >= 1) {
  148. var %name.teammate $gettok(%list,%j,32)
  149. setvar %name.teammate score $calc($getvar(%name.teammate,score) + %amount)
  150. process.scores.time %name.teammate %amount
  151. dec %j
  152. }
  153. }
  154. }
  155. alias trivia.credit {
  156. if ($2 isnum) {
  157. setvar $1 score $calc($getvar($1,score) + $2)
  158. process.scores.time $1 $2
  159. tsay $iif($2 >= 0,$msg.trivia.awarded($1,$2),$msg.trivia.deducted($1,$2))
  160. }
  161. }
  162. alias -l trivon { return $iif($getset(status,botstate),Off,$iif($getset(status,bot),$iif($trivia.paused,Paused,Enabled), Disabled)) }
  163. alias -l trivdisflip { return $iif($getset(status,bot),Disable,Enable) }
  164. alias -l trivoffflip { return $iif($getset(status,botstate),On,Off) }
  165. alias -l trivia.chan { return $iif($trivchan, Yes, No) }
  166. alias -l trivia.dir { return $iif($isdir(" $+ $triv(dir) $+ "), Yes, No) }
  167. alias -l trivia.file { return $iif($isfile($qfile(1)), Yes, No) }
  168. alias -l trivia.onoff { return $iif($trivia.on, On, Off) }
  169. alias -l team.onoff { return $iif($team, On, Off) }
  170. ;########################################################
  171. ;# Init aliases. #
  172. ;########################################################
  173. alias -l nset { if ($getset($1, $2) == $null) { setset $1- } }
  174. alias init.load {
  175. nset award 1 1 1 1 50 0 gives * a high five for getting ^ wins! Way to go * !
  176. nset award 2 1 1 1 100 0 gives * a large pizza for getting ^ wins! Way to go * !
  177. nset award 3 1 1 1 150 0 ^ wins... I am not worthy...
  178. nset award 4 2 1 1 3 0 hands * a cold beer for getting the last ^ questions!
  179. nset award 5 2 1 1 5 0 hands * 6-pack of icy beers for getting the last ^ questions!
  180. nset award 6 2 1 1 10 0 gives * keg of beer for kicking everybodies asses! ^ questions!
  181. nset award 7 2 1 1 15 0 bows before * a trivia god...
  182. nset award 8 2 2 2 3 5 You're on fire!
  183. nset award 9 3 4 5 1.5 0 Autoban based on speed.
  184. nset award 10 4 3 5 120 0 Autoban based on Words per minute.
  185. nset award 11 7 0 2 0 0 * has moved up in rank: ^
  186. nset award 12 8 0 2 0 0 *, congratulations on your promotion to: ^
  187. }
  188. alias trivia.init {
  189. nset status bot 1 | nset status echo 0 | nset status autohint 1 | nset status showanswer 1 | nset status cross 1
  190. nset status number 30 | nset status hintpause 1 | nset trivia additions additions.txt
  191. nset color 1 $fixer($rand(1,15)) | nset color 2 $fixer($rand(1,15)) | nset trivia default 10 | nset trivia dteam 5 | nset color on 1
  192. nset trivia delimiter * | nset trivia tnaoff 5 | nset trivia hintpause 5 | nset trivia perchint 30 | nset trivia numhint 1
  193. nset trivia ppq 1 | nset trivia dph 0 | nset lag answered 10 | nset lag hint 10 | nset lag start 15 | nset lag timed 15 | nset lag ping 10
  194. nset lag betweenhint 10 | nset lag timedout 60 | nset lag hintallow 10 | nset trivia dir $ifd($nofile($findfile($mircdir,$triv(questions), 1)),$mircdir)
  195. nset trivia report report.txt | nset trivia reset 1000 | nset team 0victory The *t1 and the *t2 tied | nset team 1 'Team 1's
  196. nset team 1victory The *t1 beat the *t2 | nset team 2 'Team 2's | nset team 2victory The *t2 beat the *t1 | nset team JoinBefore 2
  197. nset team JoinBeforeOn 1 | nset status nodecheater 1
  198. varcolors
  199. }
  200. alias -l trivia.fail {
  201. var %failedtriviafail = 0
  202. if ($version < 5.91) {
  203. echo Please use mIRC 5.91 or later.
  204. var %failedtriviafai = 1
  205. }
  206. if (!$server) {
  207. echo Please connect to a server before attempting to use $msg.trivia.version
  208. var %failedtriviafai = 1
  209. }
  210. if ($getset(status,bot) == 0) {
  211. echo The trivia bot is off. Commands, Trivia, Disabled to reenable.
  212. var %failedtriviafai = 1
  213. }
  214. if ($isdir(" $+ $triv(dir) $+ ") == $false) {
  215. echo The trivia directory, $triv(dir) $+ , is invalid.
  216. var %failedtriviafai = 1
  217. }
  218. if ($triv(dir) == $null) {
  219. echo The trivia directory setting is blank, please set it to the desired directory.
  220. var %failedtriviafai = 1
  221. }
  222. if ($numl <= 0) {
  223. echo There appears to be no questions within the question file(s).
  224. var %failedtriviafai = 1
  225. }
  226. return %failedtriviafai
  227. }
  228. alias get.find { if ($qfind($1-)) return $qfind($1-) }
  229.  
  230. alias -l ifd { return $iif($1, $1, $2) }
  231.  
  232. alias pre { return $ifd(%command-prefix, !) }
  233. alias commandtokens { return state;disable;enable;op;trivia;strivia;pause;resume;theme;themes;stats;stat;won;hof;top10;hofstreak;row;streak;hoftime;hoffast;hofwpm;wpm;server;record;records;champ;version;web;add;report;ping;triviaping;help;join;showteams;roundscores;answer;next;hint;!hint;words;last;vowels;repeat;hofscoreday;hoftimeday;hofstreakday;hofwpmday;hofscoreweek;hoftimeweek;hofstreakweek;hofwpmweek;hofscoremonth;hoftimemonth;hofstreakmonth;hofwpmmonth;hofscoreyear;hoftimeyear;hofstreakyear;hofwpmyear;rank;promotion }
  234. alias optokens { return enable;disable;ban;unban;banned;ask;add;find;team }
  235. alias stattokens { return score;time;streak;wpm }
  236. alias timetokens { return day;week;month;year;total }
  237. alias starttokens { return Unlimited;team }
  238. alias ctok { return $findtok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$untrans($1),1,59) }
  239. alias gtok { return $trivtran($gettok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$1,59)) }
  240. alias rtok { return $gettok($eval($ $+ $gettok(commandtokens;optokens;stattokens;timetokens;starttokens,$ifd($2,1),59),2),$1,59) }
  241. alias -l processcommand {
  242. var %command = $right($1,$calc(-1 * $len($pre)))
  243. var %ctok = $ctok(%command)
  244. award command %command $2-
  245.  
  246. if (!%ctok) { return }
  247. if (%ctok == 1) { inform $msg.trivia.state }
  248. if (%ctok == 2) { opcommand disable $2- }
  249. if (%ctok == 3) { opcommand enable $2- }
  250. if (%ctok == 4) { opcommand $2- }
  251. if (($getset(status,bot) == 0) || ($trivia.banned)) { return }
  252. if (%ctok == 5) { if (!$isdis(28)) { trivia $2- } }
  253. if (%ctok == 6) { if ((!$isdis(29)) && ($trivia.on) && ((!$team) || ($nick isop $iden))) { strivia $iden $nick } }
  254. if (%ctok == 8) { if (!$isdis(5)) { trivia.pause 1 } }
  255. if (%ctok == 7) { if ((!$trivia.paused) && (!$isdis(5))) { trivia.pause } }
  256. if (%ctok isnum 9-10) { if (!$isdis(18)) { inform $msg.trivia.themes } }
  257. if (%ctok isnum 11-13) { processcommand.stats $ifd($2,$nick) $ifd($3,$unit.default) }
  258. if (%ctok isnum 14-15) { if (!$isdis(8)) { processcommand.hof $ifd($2,score) $ifd($3,$unit.default) } }
  259. if (%ctok isnum 16-18) { if (!$isdis(10)) { processcommand.hof streak $unit.default } }
  260. if (%ctok isnum 19-20) { if (!$isdis(9)) { processcommand.hof time $unit.default } }
  261. if (%ctok isnum 21-22) { if (!$isdis(11)) { processcommand.hof wpm $unit.default } }
  262. if (%ctok isnum 45-60) {
  263. var %regmatch = / $+ (?: $+ $gtok(14) $+ $chr(124) $+ $rtok(14) $+ ) $+ \s?( $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ $chr(124) $+ $rtok(1,3) $+ $chr(124) $+ $rtok(2,3) $+ $chr(124) $+ $rtok(3,3) $+ $chr(124) $+ $rtok(4,3) $+ )\s?( $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $rtok(1,4) $+ $chr(124) $+ $rtok(2,4) $+ $chr(124) $+ $rtok(3,4) $+ $chr(124) $+ $rtok(4,4) $+ )/
  264. if ($regex(%command, %regmatch)) processcommand.hof $iif($regml(1),score) $ifd($regml(2),$unit.default)
  265. }
  266. if (%ctok isnum 61-62) { if (!$isdis(30)) inform $msg.trivia.rank($ifd($2,$nick)) }
  267. if (%ctok == 23) { inform $server }
  268. if (%ctok isnum 24-25) { if (!$isdis(12)) { inform $msg.trivia.records } }
  269. if (%ctok == 26) { inform $msg.trivia.champ }
  270. if (%ctok == 27) { inform $msg.trivia.version }
  271. if (%ctok == 28) { inform $msg.trivia.web }
  272. if (%ctok isnum 29-30) { if (!$isdis(19)) { trivia.report %ctok $2- } }
  273. if (%ctok isnum 31-32) { if (!$isdis(17)) { do.ping } }
  274. if (%ctok == 33) { if (!$isdis(32)) givehelp $2- }
  275. if (%ctok == 34) { if (($team) && (!$isdis(33))) { $setteam($nick, $2) } }
  276. if (%ctok == 35) { if ($team) { inform $msg.trivia.showteams } }
  277. if (%ctok == 36) { inform $msg.trivia.roundscores }
  278. if (%ctok == 37) { if (($thget(answer)) && (!$isdis(16))) { inform $msg.question.answer } }
  279. if ((!$question.on) || ($trivia.paused)) { return }
  280. if (%ctok == 38) { if (!$isdis(15)) { trivx $chan } }
  281. ;if (%ctok == 38) { if (($calc($question.time * 2) >= $lag(timedout)) && (!$isdis(15))) { trivx $chan } }
  282. if (%ctok isnum 39-43) {
  283. if (($question.time >= $lag(hintallow))) {
  284. if (($getset(trivia, hintpause)) && ($getset(status, hintpause))) { hadd -u $+ $triv(hintpause) Trivia $+ $idenn Temp. $+ hinted. $+ $nick 1 }
  285. if (%ctok isnum 39-40) { if (!$isdis(22)) { give.hint $iden } }
  286. if (%ctok == 41) { if (!$isdis(25)) { inform $msg.hint.words } }
  287. if (%ctok == 42) { if (!$isdis(24)) { inform $msg.hint.last } }
  288. if (%ctok == 43) { if (!$isdis(23)) { inform $msg.hint.vowels } }
  289. }
  290. }
  291. if (%ctok == 44) { if (!$isdis(26)) { inform $$thget(trivq.say) } }
  292. }
  293. alias processcommand.hof {
  294. if (!$2) { var %unit = 5 }
  295. else { var %unit = $ctok($2,4) }
  296. var %by = $ctok($1,3)
  297. if ($getset(hide,$rtok(%by,3))) { return }
  298. if ((!%by) || (!%unit)) { inform $msg.trivia.hof.error | return }
  299. inform $msg.trivia.topstats($rtok(%by,3),$rtok(%unit,4))
  300. }
  301. alias -l processcommand.stats {
  302. if (!$2) { var %unit = 5 }
  303. else { var %unit = $ctok($2,4) }
  304. if (!%unit) { inform $msg.trivia.stats.error | return }
  305. if ($1 isnum) { sort score $unit.set(%unit) }
  306. if ($1 isnum 1 - $hof.size) { inform $msg.trivia.stats($hof($1,1),$unit.set(%unit)) }
  307. else { inform $msg.trivia.stats($iif($1,$1,$nick),$unit.set(%unit)) }
  308. }
  309. alias unit.default { return $rtok($ifd($getset(status,scoreby),5),4) }
  310. alias unit.set { return $iif($rtok($1,4) != total,$rtok($1,4)) }
  311. alias unit.prefix { return $iif($ifd($1,$unit.default) != total, $ifd($1,$unit.default)) }
  312. ;########################################################
  313. ;# !Op command structure. #
  314. ;########################################################
  315. alias -l opcommand {
  316. var %otok = $ctok($1,2)
  317. if ($isdis(6)) { return }
  318. if ((%otok == 1) && (!$isdis(21)) && ($getset(status,bot) == 0) && ((!$2) || ($2 == $me))) {
  319. setset status bot 1
  320. tsay $msg.trivia.enabled
  321. }
  322. if ((%otok == 2) && (!$isdis(21)) && ($getset(status,bot) == 1) && ((!$2) || ($2 == $me))) {
  323. setset status bot 0
  324. tsay $msg.trivia.disabled
  325. strivia $iden $nick
  326. }
  327. if ((%otok == 3) && (!$isdis(20))) {
  328. if (!$2) { inform $msg.trivia.error.ban }
  329. else {
  330. tban $2
  331. inform $msg.trivia.op.ban
  332. }
  333. }
  334. if ((%otok == 4) && (!$isdis(7))) {
  335. if (!$2) { inform $msg.trivia.error.unban }
  336. else {
  337. tunban $2
  338. inform $msg.trivia.op.unban
  339. }
  340. }
  341. if (%otok == 5) { inform $msg.trivia.banlist }
  342. if ((%otok == 6) && (!$isdis(14))) {
  343. if ($2 !isnum) { inform $msg.trivia.error.badnum }
  344. else {
  345. ask $2
  346. inform $msg.trivia.op.ask
  347. }
  348. }
  349. if ((%otok == 7) && (!$isdis(27))) {
  350. if (!$2) { inform $msg.trivia.error.noquestion }
  351. elseif ($triv(delimiter) !isin $2-) { inform $msg.trivia.error.nodelim }
  352. else {
  353. add $2-
  354. inform $msg.trivia.op.added
  355. }
  356. }
  357. if ((%otok == 8) && (!$isdis(13))) {
  358. if (!$2) { inform $msg.trivia.error.nosearch }
  359. else inform $msg.trivia.op.find($2-)
  360. }
  361. if ((%otok == 9) && (!$isdis(34))) {
  362. if ($2 ison $chan) {
  363. if ($validteam($3)) { $setteam($2, $3) }
  364. else { inform $msg.trivia.error.numberrequired($2) }
  365. }
  366. else { inform $msg.trivia.error.playerrequired }
  367. }
  368. }
  369.  
  370. alias trivia {
  371. if (($trivia.banned) || ($trivia.on) || (!$trivchan)) { return }
  372. if ($trivia.paused) {
  373. tsay $msg.trivia.pause
  374. return
  375. }
  376. trivia.flush
  377. if ($trivia.fail) return
  378. if ($hget(Trivia $+ $idenn)) { hfree Trivia $+ $idenn }
  379. hmake Trivia $+ $idenn 20
  380. if (($hget(Asked $+ $idenn)) && ($getset(status,keepask))) { hfree Asked $+ $idenn }
  381. if (!$hget(Asked $+ $idenn)) hmake Asked $+ $idenn 50
  382. trivia.defaultgame
  383. thset STime $time $date
  384. thset SUser $iif($nick,$nick,$me)
  385. if (($getset(Trivia,odefault) == unlimited) || (($ctok($1,5) == 1) && (!$isdis(2))) ) { thset Max Unlimited }
  386. if (($getset(Trivia,odefault) == team) || (($ctok($1,5) == 2) && (!$isdis(3)))) { thset team 1 }
  387. if (($1 isnum 1 - $numl) && (!$isdis(1))) { thset Max $int($1) }
  388. if ($1 == pi) { thset Max 3.14159265358979323846 }
  389. if ($1 == e) { thset Max 2.718281828459045 }
  390. if (!$isdis(18)) { trivia.themecheck $1- }
  391. if ($thget(team)) { trivia.teammode $2 }
  392. tsay $msg.trivia.started
  393. .timerq $+ $idenn 1 $ifd($lag(start),0) trivq $chan
  394. award roundstart $thget(Max)
  395. }
  396.  
  397. alias strivia {
  398. set -u3 %ident $1
  399. if ($team) { strivia.teammode }
  400. else if ($getset(status,bot)) {
  401. if ($getset(Var $+ $idenn, Lastwinner) == $2) { setset Var $+ $idenn Row 0 }
  402. tsay $msg.trivia.stopped
  403. if ($thget(Current) >= 10) { tsay $strivia.end($triv(Record)) }
  404. award RoundStop $thget(Current)
  405. }
  406. trivia.flush
  407. }
  408. alias strivia.end {
  409. if ($1 == 1) { return $msg.trivia.hof }
  410. elseif ($1 == 2) { return $msg.trivia.topstats(streak) }
  411. elseif ($1 == 3) { return $msg.trivia.topstats(time) }
  412. elseif ($1 == 4) { return $msg.trivia.topstats(wpm) }
  413. elseif ($1 == 5) { return $msg.trivia.champ }
  414. elseif ($1 == 6) { return $msg.trivia.web }
  415. elseif ($1 == 7) { return $msg.trivia.roundscores }
  416. return $msg.trivia.records
  417. }
  418.  
  419. alias -l trivia.flush {
  420. if (!$getset(status,keepask)) if ($hget(Asked $+ $idenn)) { hfree Asked $+ $idenn }
  421. if ($hget(Trivia $+ $idenn)) { hfree Trivia $+ $idenn }
  422. trivia.timersoff
  423. unset %cache.nick
  424. unset %cache.line
  425. }
  426. alias -l trivia.timersoff {
  427. .timer* $+ $idenn off
  428. }
  429.  
  430. alias trivia.defaultgame {
  431. thset File questions.txt
  432. thset Scores $scoresfil
  433. if ($tchan($trivchan, 4)) { thset Scores $tchan($trivchan, 4) }
  434. if ($tchan($trivchan, 5)) {
  435. thset File
  436. var %i = 5
  437. while ($tchan($trivchan, %i)) {
  438. thset File $thget(file) $+ ; $+ $tchan($trivchan, %i)
  439. inc %i
  440. }
  441. }
  442. thset Max $triv(default)
  443. thset PPQ $iif($getset(Trivia,PPQ) != $null,$getset(Trivia,PPQ),1)
  444. thset DPH $iif($getset(Trivia,DPH) != $null,$getset(Trivia,DPH),0)
  445. thset RRS $iif($getset(Status,RRS) != $null,$getset(Status,RRS),0)
  446. thset guess $iif($getset(trivia,limitguess) != $null,$getset(trivia,limitguess),0)
  447. thset lagstart $iif($getset(lag, start) != $null, $getset(lag, start), 0)
  448. thset laganswered $iif($getset(lag, answered) != $null, $getset(lag, answered), 0)
  449. thset lagtimedout $iif($getset(lag, timedout) != $null, $getset(lag, timedout), 0)
  450. thset laghint $iif($getset(lag, hint) != $null, $getset(lag, hint), 0)
  451. thset lagtimed $iif($getset(lag, timed) != $null, $getset(lag, timed), 0)
  452. thset laghintallow $iif($getset(lag, hintallow) != $null, $getset(lag, hintallow), 0)
  453. thset lagbetweenhint $iif($getset(lag, betweenhint) != $null, $getset(lag, betweenhint), 0)
  454. }
  455. ;########################################################
  456. ;# THEMED start. #
  457. ;########################################################
  458. alias trivia.themecheck {
  459. var %i = 1
  460. while ($getset(triviamode $+ %i, Name)) {
  461. if ($1 == $getset(triviamode $+ %i, Name)) {
  462. trivia.themestart %i
  463. if (($2 isnum) && ($2 <= $numq) && ($2 > 0) && (!$isdis(4))) { thset Max $int($2) }
  464. return
  465. }
  466. inc %i
  467. }
  468. }
  469. alias trivia.themestart {
  470. var %j = $setini(triviamode $+ $1,0)
  471. while (%j >= 1) {
  472. var %mode = $setini(triviamode $+ $1, %j)
  473. thset %mode $getset(triviamode $+ $1, %mode)
  474. dec %j
  475. }
  476. }
  477.  
  478. alias -l trivia.teammode {
  479. thset Score1 0
  480. thset Score2 0
  481. thset Score3 0
  482. thset Score4 0
  483. if ($1 isnum 1 - $numq) { thset Max $int($1) }
  484. else { thset Max $triv(dteam) }
  485. tsay $msg.team.start
  486. }
  487. alias -l strivia.teammode {
  488. var %s1 = $thget(Score1)
  489. var %s2 = $thget(Score2)
  490. var %s3 = $thget(Score3)
  491. var %s4 = $thget(Score4)
  492. if ($getset(team,4-team)) {
  493. if ((%s1 > %s2) && (%s1 > %s3) && (%s1 > %s3)) {
  494. tsay $msg.team.over($te(1).victory)
  495. award TeamVictory 1
  496. }
  497. elseif ((%s2 > %s1) && (%s2 > %s3) && (%s2 > %s4)) {
  498. tsay $msg.team.over($te(2).victory)
  499. award TeamVictory 2 $get.showteams(2)
  500. }
  501. elseif ((%s3 > %s1) && (%s3 > %s2) && (%s3 > %s4)) {
  502. tsay $msg.team.over($te(3).victory)
  503. award TeamVictory 3
  504. }
  505. elseif ((%s4 > %s1) && (%s4 > %s2) && (%s4 > %s3)) {
  506. tsay $msg.team.over($te(4).victory)
  507. award TeamVictory 4
  508. }
  509. else {
  510. tsay $msg.team.over($te(0).victory)
  511. award TeamVictory 0
  512. }
  513. }
  514. else {
  515. if (%s1 > %s2) { tsay $msg.team.over($te(1).victory) }
  516. elseif (%s1 < %s2) { tsay $msg.team.over($te(2).victory) }
  517. else { tsay $msg.team.over($te(0).victory) }
  518. }
  519. if ($getset(status, noshowt)) { tsay $msg.trivia.showteams }
  520. }
  521. alias -l setteam {
  522. if (($thget(Current) >= $getset(Team, JoinBefore)) && ($getset(Team, JoinBeforeOn) == 1)) {
  523. inform $msg.team.joinover
  524. return
  525. }
  526. if ($validteam($2)) {
  527. if ($thget(Team. $+ $1) == $2) { inform $msg.team.alreadyon }
  528. else { tsay $msg.team.add($getset(team,$2), $1) }
  529. thset $eval(Team. $+ $1,1) $2
  530. setvar $1 team $2
  531. }
  532. }
  533. alias -l validteam {
  534. if ($1 isnum 1-2) return 1
  535. if (($1 isnum 3-4) && ($getset(team,4-team))) return 1
  536. return 0
  537. }
  538. alias -l setteam.hash {
  539. if ($validteam($2)) {
  540. thset $eval(Team. $+ $1,1) $2
  541. }
  542. }
  543.  
  544. alias trivq {
  545. set -u3 %ident $1
  546. if (!$hget(Trivia $+ $idenn)) { return }
  547. if ($trivia.fail) return
  548. thset Current $calc($thget(Current) + 1)
  549. if (($team) && ($thget(Current) == $getset(Team, JoinBefore)) && ($getset(Team, JoinBeforeOn) == 1)) { tsay $msg.team.joinbefore }
  550. create.question
  551. .timerend $+ $idenn 1 $lag(timedout) trivx $iden
  552. trivia.startautohint
  553. setset Var $+ $idenn Asked $calc($getset(Var $+ $idenn,Asked) + 1)
  554. thset Start $ticks
  555. trivia.sayquestion $right($thget(catq),-1)
  556. if ($getset(status,echo) == 1) { echo $iden $msg.trivia.echoanswer }
  557. if ($getset(status,answers)) { tsay $msg.hint.space }
  558. award Question $lag(timedout)
  559. }
  560. alias -l create.question {
  561. while ($thget(Ask1)) {
  562. var %qread = $qread($thget(Ask1))
  563. ask.deleteitem 1
  564. thset Catq
  565. if (%qread) return
  566. }
  567. var %temp.ask = $trivia.getq
  568. thset Catq $qcat(%temp.ask)
  569. hadd Asked $+ $idenn %temp.ask %temp.ask
  570. }
  571. alias -l trivia.getq {
  572. unset %ask
  573. while ((!%ask) || ($hget(Asked $+ $idenn, %ask))) {
  574. var %tempnumqvalue = $numq
  575. if (%tempnumqvalue == 0) {
  576. echo Attempted start without any questions to process. Bailing.
  577. halt
  578. }
  579. if ($hget(Asked $+ $idenn,0).item >= %tempnumqvalue) { hdel -w Asked $+ $idenn * }
  580. var %ask = $rand(1, %tempnumqvalue)
  581. if (!$qread(%ask)) { hadd Asked $+ $idenn %ask NA }
  582. }
  583. thset Asking %ask
  584. return %ask
  585. }
  586.  
  587. alias qfile {
  588. if (($1 !isnum) || ($1 < 1)) return
  589. if (($thget(File)) && ($gettok($thget(File),$1,$asc(;)))) return $shortfn(" $+ $triv(dir) $+ \ $+ $gettok($thget(File),$1,$asc(;)) $+ ")
  590. if ($tchan($ifd($trivchan,1),$calc(4 + $1))) return $shortfn(" $+ $triv(dir) $+ \ $+ $tchan($ifd($trivchan,1),$calc(4 + $1)) $+ ")
  591. }
  592.  
  593. alias numl { return $calc($numq - $numnonq) }
  594. alias numq {
  595. if ($1 isnum) { return $lines($qfile($1)) }
  596. var %i = 0, %j = 1
  597. while ($qfile(%j)) {
  598. if (!$eval(% $+ numq $+ $qfile(%j),2)) { set -u600 % $+ numq $+ $qfile(%j) $lines($qfile(%j)) }
  599. %i = $calc(%i + $eval(% $+ numq $+ $qfile(%j),2))
  600. inc %j
  601. }
  602. return %i
  603. }
  604. alias qcat {
  605. if ($getset(status,nocat) == 1) return
  606. var %nf = $numfile($1)
  607. if ($exists($gettok(%nf,1,$asc(;)))) {
  608. return $read($gettok(%nf,1,$asc(;)), wnt, #*, $gettok(%nf,2,$asc(;)))
  609. }
  610. }
  611. alias numnonq {
  612. window -h @numnonq
  613. var %j = 1, %nonqcount = 0
  614. while ($qfile(%j)) {
  615. if ($eval(% $+ nonq $+ $qfile(%j),2)) { var %nonqcount = $calc(%numqcount + $eval(% $+ nonq $+ $qfile(%j),2)) }
  616. else {
  617. if ($exists($qfile(%j))) {
  618. filter -fwgx $qfile(%j) @numnonq /\ $+ $triv(delimiter) $+ /
  619. var %nonqcount = $calc(%nonqcount + $filtered)
  620. set -u600 % $+ nonq $+ $qfile(%j) $filtered
  621. }
  622. }
  623. inc %j
  624. }
  625. window -c @numnonq
  626. return %nonqcount
  627. }
  628. alias numcat {
  629. if ($window(@categories)) { window -c @categories }
  630. window -eh @categories
  631. var %j = 1
  632. while ($qfile(%j)) {
  633. if ($exists($qfile(%j))) filter -fw $qfile(%j) @categories #*
  634. inc %j
  635. }
  636. .timer 1 0 window -c @categories
  637. return $line(@categories,0)
  638. }
  639. alias numfile {
  640. var %i = 0, %j = 1, %l
  641. while ($qfile(%j)) {
  642. %l = %i
  643. inc %i $numq(%j)
  644. if ($1 isnum %l - %i) { return $qfile(%j) $+ ; $+ $calc($1 - %l) }
  645. if (($1 !isnum) && ($exists($qfile(%j))) && ($read($qfile(%j), nwt, $+(*,$1-,*), 1))) return $qfile(%j) $+ ; $+ $readn
  646. inc %j
  647. }
  648. }
  649. alias -l qfind {
  650. var %i = 0, %j = 1, %l
  651. if ($1 == $null) { return }
  652. while ($qfile(%j)) {
  653. if (($exists($qfile(%j))) && ($read($qfile(%j), nwt, $+(*,$1-,*), 1))) return $read($qfile(%j),$readn) - $qfile(%j) - $readn
  654. inc %j
  655. }
  656. }
  657. alias qread {
  658. var %nf = $numfile($1)
  659. var %delim = \ $+ $triv(delimiter)
  660. if (($exists($gettok(%nf,1,$asc(;)))) && ($regex($iif($1 isnum,$read($gettok(%nf,1,$asc(;)), nt, $gettok(%nf,2,$asc(;))),$1-),/^([^ $+ %delim $+ ]+)([ $+ %delim $+ ].*)$/))) {
  661. thset tok1 $regml(1)
  662. if ($regex($regml(2), /[ $+ %delim $+ ]([^ $+ %delim $+ ]+)/g)) {
  663. thset numfile %nf
  664. thset tokq $calc($regml(0) + 1)
  665. var %i = 1
  666. while (%i <= $regml(0)) {
  667. thset tok $+ $calc(%i + 1) $regml(%i)
  668. inc %i
  669. }
  670. }
  671. }
  672. else {
  673. if ($1 == scramble) { thset temp.bonus S }
  674. if ($1 == reverse) { thset temp.bonus R }
  675. if ($1 == shotgun) { thset temp.bonus G }
  676. return $false
  677. }
  678. return $true
  679. }
  680. alias -l ask.deleteitem {
  681. hdel Trivia $+ $idenn Ask $+ $$1
  682. var %i = $1
  683. while ($thget(Ask $+ $calc(%i + 1))) {
  684. thset Ask $+ %i $thget(Ask $+ $calc(%i + 1))
  685. inc %i
  686. }
  687. if ($thget(Ask $+ %i)) { hdel Trivia $+ $idenn Ask $+ %i }
  688. }
  689. alias -l trivia.startautohint { if ($getset(status,autohint) == 1) { .timerhint $+ $idenn 1 $lag(hint) trivia.autohint $iden } }
  690. alias -l trivia.autohint {
  691. give.hint $1
  692. if ($triv(numhint) > 1) { .timerhint $+ $idenn $calc($triv(numhint) - 1) $lag(betweenhint) give.hint $1 }
  693. }
  694. alias decheater {
  695. if ($getset(status,nodecheater) == 1) return $1-
  696. var %t.rt = $1-, %i = $count($1-,$chr(32)), %t.ps
  697. while (%i > 0) {
  698. if ($rand(1,2) == 1) {
  699. %t.ps = $pos($1-,$chr(32),%i)
  700. %t.rt = $+($left(%t.rt, $calc(%t.ps - 1)), $chr(160),$right(%t.rt,$calc((%t.ps) * -1)))
  701. }
  702. dec %i
  703. }
  704. return %t.rt
  705. }
  706.  
  707. alias trivx {
  708. set -u3 %ident $1
  709. if (!$hget(Trivia $+ $idenn)) { return }
  710. if (!$2) {
  711.  
  712. if (($getset(status,showanswer)) && (!$getset(status,shownone))) {
  713. if ($thget(temp.type) == K) {
  714. tsay $msg.answer.timeout.kaos
  715. }
  716. else if ($thget(temp.type) == T) {
  717. tsay $msg.answer.timeout.total
  718. }
  719. else if ($thget(temp.type) == P) {
  720. tsay $msg.answer.timeout.pick
  721. }
  722. else {
  723. tsay $msg.answer.timeout
  724. }
  725. }
  726. else { tsay $msg.answer.timeout2 }
  727.  
  728. setset Var $+ $idenn Row 0
  729. thset Unanswered $calc($thget(Unanswered) + 1)
  730. award NoAnswer $trivq.answer
  731. }
  732. trivia.timersoff
  733. if ($window($total.win)) { window -c $total.win }
  734. thset Answer $trivq.answer
  735. if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn Temp.*
  736. if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn tok*
  737. if (($nick) && ($getvar($nick,score) >= $triv(reset)) && ($getset(status,champ) == 1)) { trivia.newchamp }
  738. if ((($team) && ($thget(Score $+ $isteam($nick)) > $calc($thget(Max)/2))) || (($getset(status,emptyoff)) && ($nick($iden,0) <= 1)) || (($getset(status, naoff) == 1) && ($thget(unanswered) >= $triv(naoff))) || (($thget(Max) != unlimited) && ($thget(Current) >= $thget(Max)))) {
  739. strivia $1
  740. if (($getset(status, emptyoff) == 1) && ($nick($iden,0) <= 1)) tsay $msg.trivia.emptyoff
  741. if (($getset(status, naoff) == 1) && ($thget(Unanswered) >= $triv(naoff))) tsay $msg.trivia.unactive
  742. return
  743. }
  744. .timerq $+ $idenn 1 $iif($1, $lag(answered), $lag(timed)) trivq $iden
  745. }
  746. alias -l trivia.processscore {
  747. if ($getset(Var $+ $idenn, Lastwinner) == $nick) { setset Var $+ $idenn Row $calc($getset(Var $+ $idenn, Row) + $ifd($2,1)) }
  748. else { setset Var $+ $idenn Row $ifd($2,1) }
  749. setset Var $+ $idenn Wins $calc($getset(Var $+ $idenn,Wins) + $ifd($2,1))
  750. setset Var $+ $idenn Lastwinner $nick
  751. setvar $nick Lastwin $date
  752. thset WPM $calc(($len($1) * 60) / ($thget(Time) * 5))
  753. if (($thget(WPM) > $getvar($nick,wpm)) || (!$getvar($nick,wpm))) { setvar $nick wpm $thget(WPM) }
  754. if (($getset(Var $+ $idenn, Row) > $getvar($nick,streak)) || (!$getvar($nick,streak))) { setvar $nick Streak $getset(Var $+ $idenn, Row) }
  755. if (($thget(Time) < $getvar($nick,time)) || (!$getvar($nick,time))) { setvar $nick Time $thget(Time) }
  756. thset temp.cng $calc(($thget(PPQ) * $ifd($2,1)) - ($thget(DPH) * $max.hinted))
  757. if ($thget(temp.points) != $null) { thset temp.cng $calc(($thget(temp.points) - ($max.hinted * $thget(temp.hintreduction))) * $ifd($2,1)) }
  758. thset temp.mrank $getmrank($nick)
  759. thset temp.rank $getrank($nick,$unit.default,$thget(temp.cng))
  760. thset temp.newrank $calc($thget(temp.rank) - %uprank)
  761. setvar $nick Score $calc($getvar($nick, Score) + $thget(temp.cng))
  762. setvar $nick Answered $calc($getvar($nick, Answered) + $iif($2 > 0,$2,1))
  763. thset $eval(Score. $+ $nick,1) $calc($thget($eval(Score. $+ $nick,1)) + $thget(temp.cng))
  764. process.scores.time $nick $thget(temp.cng) $getset(Var $+ $idenn, Row) $thget(Time) $thget(WPM)
  765. }
  766. alias trivia.processawards {
  767. if (%uprank) award uprank $tranord($thget(temp.newrank))
  768. if ($getmrank($nick) != $thget(temp.mrank)) award promotion $getmrank($nick)
  769. award score $user.score($nick)
  770. award row $getset(Var $+ $idenn, Row)
  771. award time $thget(Time)
  772. award wpm $thget(WPM)
  773. award answered $thget(Time)
  774. }
  775. alias -l answered {
  776. thset Time $question.time
  777. if (($1 == $null) || ($trivia.banned) || ($trivia.negationcheck) || (($team) && (!$isteam($nick)))) { return }
  778. $trivia.processscore($1,$2)
  779. if (($getset(build,instabuild)) && ($getset(build,instabuild) // $getset(Var $+ $idenn,Wins))) { htmltrigger $iden }
  780. tsay $msg.answer.correct($getset(status,tradwin),$thget(WPM),$thget(temp.newrank),$iif(%uprank,$thget(temp.rank)))
  781. if ($team) {
  782. thset Score $+ $isteam($nick) $calc($thget( Score $+ $isteam($nick)) + 1)
  783. tsay $msg.team.score
  784. award TeamAnswered $isteam($nick)
  785. }
  786. trivia.processawards
  787. if ($thget(RRS)) { tsay $msg.trivia.roundscores }
  788. hdel Trivia $+ $idenn Unanswered
  789. if (($isTotal) && ($total.over)) { tsay $msg.trivia.totalover }
  790. if ((($thget(temp.type) != T) && ($thget(temp.type) != K)) || ($total.over)) { trivx $chan $true }
  791. }
  792. alias -l trivq.answer { return $iif(((($thget(temp.type) == T) || ($thget(temp.type) == K) || ($getset(status,showmatched))) && ($thget(temp.matched))), $thget(temp.matched),$tok(2)) }
  793.  
  794. alias -l trivia.sayquestion {
  795. if ($regex($tok(1), /^([^:]+):\s?(.+)|((?i)Scramble|Uword)$/)) {
  796. thset temp.mode $lower($regml(1))
  797. thset temp.rest $regml(2)
  798. if (($gettok($thget(temp.mode),1,44) isnum) && ($getset(status,nobonus) != 1)) {
  799. thset temp.points $gettok($thget(temp.mode),1,44)
  800. if ($gettok($thget(temp.mode),2,44) isnum) { thset temp.hintreduction $gettok($thget(temp.mode),2,44) }
  801. var %tq $msg.question.points($1-,$thget(temp.rest))
  802. }
  803. elseif ($regex($thget(temp.mode), /pick\s(\d+)/)) {
  804. var %tq $msg.question.standard($1-,$thget(temp.rest))
  805. thset temp.type P
  806. thset temp.pick $regml(1)
  807. }
  808. elseif (kaos == $thget(temp.mode)) {
  809. var %tq $msg.question.kaos($1-)
  810. thset temp.type K
  811. total.init
  812. }
  813. elseif (multi == $thget(temp.mode)) {
  814. var %tq $msg.question.multi($1-)
  815. thset temp.type M
  816. }
  817. elseif (total == $thget(temp.mode)) {
  818. var %tq $msg.question.total($1-)
  819. thset temp.type T
  820. total.init
  821. }
  822. elseif (scramble == $thget(temp.mode)) || (uword == $thget(temp.mode)) {
  823. var %tq $msg.question.scramble($1-,$thget(temp.rest))
  824. thset temp.type S
  825. }
  826. }
  827. if (!%tq) { var %tq $msg.question.standard($1-) }
  828. thset trivq.say $iif($getset(status,nosaycurrent) != 1, $e1($thget(Current)) $+ $e2(.)) $decheater(%tq)
  829. tsay $thget(trivq.say)
  830. }
  831.  
  832. alias unfix {
  833. var %i = 2
  834. while (%i <= $tokq) {
  835. if ($1- == $fix($tok(%i))) { return $tok(%i) }
  836. inc %i
  837. }
  838. }
  839. alias total.win { return @total $+ $idenn }
  840. alias total.init {
  841. var %i = 2
  842. if ($window($total.win)) { window -c $total.win }
  843. window -h $total.win
  844. while (%i <= $tokq) {
  845. aline -n $total.win $tok(%i)
  846. inc %i
  847. }
  848. thset temp.totalanswers $total.left
  849. }
  850. alias total.left { return $line($total.win,0) }
  851. alias total.answers { return $thget(temp.totalanswers) }
  852. alias total.answered { return $calc($total.answers - $total.left) }
  853. alias total.is { return $fline($total.win,$1-,1) }
  854. alias total.rem { dline $total.win $total.is($1-) }
  855. alias total.over { return $iif(!$line($total.win,0), 1) }
  856. alias isTotal { return $iif((($thget(temp.type) == T) || ($thget(temp.type) == K)),$true) }
  857. alias gettotalhints {
  858. var %i = 1, %totalhint
  859. while (%i <= $line($total.win,0)) {
  860. %totalhint = $left(%totalhint,850) $+ $iif(%totalhint,$chr(44)) $plot($1,$line($total.win,%i))
  861. inc %i
  862. }
  863. return %totalhint
  864. }
  865. alias gettotalremain {
  866. var %i = 1, %totalremain
  867. while (%i <= $line($total.win,0)) {
  868. %totalremain = $left(%totalremain,850) $+ $iif(%totalremain != $null,$chr(44)) $line($total.win,%i)
  869. inc %i
  870. }
  871. return %totalremain
  872. }
  873.  
  874. alias -l trivia.negationcheck {
  875. if ($thuser(Hinted)) {
  876. inform $msg.trivia.hintpaused
  877. return $true
  878. }
  879. if (($getset(status,limitguess)) && (!$isTotal) && ($ifd($thuser(Guess),0) >= $thget(guess))) {
  880. inform $msg.trivia.guessed($thuser(guess))
  881. return $true
  882. }
  883. }
  884.  
  885. alias -l processguess {
  886. if ($trivia.paused) { return }
  887. if (($team) && (!$isteam($nick))) {
  888. if ($validteam($getvar($nick,team))) {
  889. $setteam.hash($nick,$getvar($nick,team))
  890. }
  891. }
  892. var %pick = $regex($lower($fix($1-)), $trivia.pattern)
  893. thuset Guess $calc($thuser(guess) + 1)
  894. if (%pick == 0) { return }
  895. var %answered, %matched = $regml(1), %i = 1
  896. thset temp.match $regml(0)
  897. while ($thget(temp.match) >= %i) {
  898. thset temp.match. $+ %i $regml(%i)
  899. inc %i
  900. }
  901. if (($thget(temp.type) == P) || ($thget(temp.type) == T) || ($thget(temp.type) == K)) {
  902. var %j = 1, %k, %f, %numb.correct = 0
  903. while (%j <= $thget(temp.match)) {
  904. var %k = %j, %f = $true
  905. while (%k >= 1) {
  906. if ((%j != %k) && ($thget(temp.match. $+ %j) == $thget(temp.match. $+ %k))) { %f = $false }
  907. dec %k
  908. }
  909. if ($isTotal) {
  910. if ($total.is($unfix($thget(temp.match. $+ %j)))) {
  911. total.rem $unfix($thget(temp.match. $+ %j))
  912. inc %numb.correct
  913. }
  914. else { %f = $false }
  915. }
  916. if (%f) %answered = %answered $unfix($thget(temp.match. $+ %j))
  917. else { dec %pick }
  918. inc %j
  919. }
  920. if (($thget(temp.type) == P) && (%pick < $thget(temp.pick))) return
  921. if (($isTotal) && (%numb.correct == 0)) return
  922. }
  923. else { var %answered = $unfix($thget(temp.match. $+ 1)) }
  924. thset temp.matched %answered
  925. $answered(%answered,%numb.correct)
  926. }
  927. alias fix {
  928. if ($getset(status,nospellfix)) { return $lower($strip($1-)) }
  929. var %temp.fix = $lower($strip($1-))
  930. .echo -q $regsub(%temp.fix,/([^\s]+)s(?=(\s|$))/g, \1, %temp.fix)
  931. .echo -q $regsub(%temp.fix,/(?<=^|\s)(?:the|an|a)\s([^\s]+)/g, \1, %temp.fix)
  932. %temp.fix = $remove(%temp.fix,',-,!,`,.,’,´,?,%,$chr(36),$chr(44))
  933. %temp.fix = $replace(%temp.fix,À,A,Á,A,Â,A,Ã,A,Ä,A,Å,A,Æ,AE,Ç,C,È,E,É,E,Ê,E,Ë,E,Ì,I,Í,I,Î,I,Ï,I,Ð,D,Ñ,N,Ò,O,Ó,O,Ô,O,Õ,O,Ö,O,Ø,O,Ù,U,Ú,U,Û,U,Ü,U,Ý,Y)
  934. %temp.fix = $replace(%temp.fix,ß,B,à,a,á,a,â,a,ã,a,ä,a,å,a,æ,ae,ç,c,è,e,é,e,ê,e,ë,e,ì,i,í,i,î,i,ï,i,ð,o,ñ,n,ò,o,ó,o,ô,o,õ,o,ö,o,ù,u,ú,u,û,u,ü,u,ý,y,ÿ,y)
  935. return $replace(%temp.fix,kn,n,y,i,k,c,x,c,q,c,e,a,ah,a,u,o,ph,f,m,n,ll,l,aa,a,oo,o,cc,c,z,s)
  936. }
  937. alias trivia.pattern {
  938. if ($thget(temp.pattern)) { return $thget(temp.pattern) }
  939. var %i 2, %max = $iif($thget(temp.type) == M, 2, $tokq), %pattern = $chr(40)
  940. while (%i <= %max) {
  941. if (%i != 2) { %pattern = %pattern $+ $chr(124) }
  942. %pattern = %pattern $+ $lower($fix($tok(%i)))
  943. inc %i
  944. }
  945. %pattern = %pattern $+ $chr(41)
  946. if (($thget(temp.type) != P) && ($thget(temp.type) != T) && ($thget(temp.type) != K)) {
  947. if ($getset(status, exactmatch)) { %pattern = ^ $+ %pattern $+ $ }
  948. elseif ($getset(status, nomid)) { %pattern = ^ $+ %pattern $+ (?=\s|$) $+ $chr(124) $+ (?:^|\s) $+ %pattern $+ $ }
  949. else { %pattern = (?:^|\s) $+ %pattern $+ (?=\s|$) }
  950. }
  951. else { %pattern = (?:^|\s) $+ %pattern $+ (?=\s|$) }
  952. %pattern = / $+ %pattern $+ /g
  953. thset temp.pattern %pattern
  954. return %pattern
  955. }
  956.  
  957. alias trivia.paused { if (($thget(paused)) && ($hget(Trivia $+ $idenn))) { return $true } }
  958. alias trivia.pause {
  959. if ($1) {
  960. if ($trivia.paused) {
  961. .timerq $+ $idenn -r
  962. .timerend $+ $idenn -r
  963. .timerhint $+ $idenn -r
  964. thset paused 0
  965. tsay $msg.trivia.resume
  966. }
  967. else if (($thget(paused) != 1) && (!$timer(q $+ $idenn)) && (!$timer(end $+ $idenn)) && (!$timer(hint $+ $idenn)) && ($hget(Trivia $+ $idenn))) trivx
  968. }
  969. else {
  970. .timerq $+ $idenn -p
  971. .timerend $+ $idenn -p
  972. .timerhint $+ $idenn -p
  973. thset paused 1
  974. tsay $msg.trivia.pause
  975. }
  976. }
  977.  
  978. alias -l give.hint {
  979. set -u3 %ident $1
  980. if ((!$hget(Trivia $+ $idenn)) || ($max.hinted >= $triv(numhint))) { return }
  981. if (!$nick) {
  982. thset Temp.Hints $calc($thget(Temp.Hints) + 1)
  983. var %hintpercent = $calc($triv(perchint) * $thget(Temp.Hints))
  984. var %nexthintpercent = $calc($triv(perchint) * ($thget(Temp.Hints) + 1))
  985. if ($thget(Temp.Skip.Hint $+ $thget(Temp.Hints)) == 1) { return }
  986. if ($hintrepnum(%hintpercent) == $hintrepnum(%nexthintpercent)) thset Temp.Skip.Hint $+ $calc($thget(Temp.Hints) + 1) 1
  987. if ($thget(Temp.Hints) == 1) tsay $eval($ $+ msg.hint. $+ $hintfirst $+ ( %hintpercent ),2)
  988. else tsay $msg.hint.hint(%hintpercent)
  989.  
  990. }
  991. else {
  992. thuset Hint $calc($iif($calc($thget(Temp.Hints) + 0) > $calc($thuser(hint) + 0),$thget(Temp.Hints),$thuser(hint)) + 1)
  993. if ($thget(Temp.Skip.Hint $+ $thuser(hint)) == 1) { return }
  994. var %sayhint = $msg.hint.hint($calc($triv(perchint) * $thuser(hint)))
  995. if (msg * iswm %respond) {
  996. tsay %sayhint
  997. thset Temp.Skip.Hint $+ $thuser(hint) 1
  998. }
  999. else inform %sayhint
  1000. }
  1001. award Hint $thget(Temp.Hints)
  1002. }
  1003. alias -l hintfirst {
  1004. var %hintfirst = $getset(trivia, firsthint)
  1005. if (!%hintfirst) return hint
  1006. if (%hintfirst == 1) return last
  1007. if (%hintfirst == 2) return vowels
  1008. if (%hintfirst == 3) return $gettok(hint.last.vowels.space.scramble, $rand(1,5), $asc(.))
  1009. }
  1010. alias -l get.hint {
  1011. if ($thget(Temp.type) == M) { return }
  1012. if (($thget(temp.rhint. $+ $2)) && ($1 == hint)) { return $thget(temp.rhint. $+ $2) }
  1013. var %perhint = $iif($2,$2,$triv(perchint)), %hintc
  1014.  
  1015. if ($isTotal) {
  1016. thset temp.rhint. $+ $2 $gettotalhints(%perhint)
  1017. return $thget(temp.rhint. $+ $2)
  1018. }
  1019. if ($1 == words) { return $numtok($trivq.answer,32) }
  1020. if ($1 == space) { return $deletter($trivq.answer) }
  1021. if ($1 == last) { return $right($trivq.answer,1) }
  1022. if ($1 == vowels) { return $iif($regsub($trivq.answer, /([^aeiouAEIOU\s])/g, $trivchar, %hintc), %hintc, $trivq.answer) }
  1023. if ($1 == scramble) { return $scramble($trivq.answer) }
  1024. if ($getset(status, plot)) { return $plot(%perhint, $trivq.answer) }
  1025. if ($getset(status, scatter)) {
  1026. thset temp.rhint. $+ $2 $scatter(%perhint, $trivq.answer)
  1027. return $thget(temp.rhint. $+ $2)
  1028. }
  1029. else { return $standard(%perhint, $trivq.answer) }
  1030. }
  1031. alias -l trivchar { return $iif($chr($triv(ch)),$chr($triv(ch)),_) }
  1032. alias -l nonpunct { return /([^';:"\s\xA0\,\?\<\>\|\\\/\[\]\!\@\#\$\%\^\&\*\(\)\{\}\-])/g }
  1033. alias -l deletter {
  1034. var %hintc
  1035. .echo -q $regsub($1-, $nonpunct, $trivchar, %hintc)
  1036. return %hintc
  1037. }
  1038. alias -l hintrepnum { return $int($calc(($len($trivq.answer) / 100) * $1 + 1)) }
  1039. alias -l standard {
  1040. var %in = $replace($2-, $chr(32), $chr(160)), %break = $hintrepnum($1)
  1041. return $replace($left(%in, %break) $+ $iif($getset(status,cross) == 1, $deletter($right(%in, $calc(-1 * %break)))), $chr(160), $chr(32))
  1042. }
  1043. alias -l scramble {
  1044. tokenize 32 $1-
  1045. var %i = 1, %temp.smbl
  1046. while (%i <= $0) {
  1047. var %word = $eval($+($,%i),2)
  1048. while (%word != $null) { var %rand = $rand(1, $len(%word)), %temp.smbl = %temp.smbl $+ $mid(%word, %rand, 1), %word = $left(%word, $calc(%rand - 1)) $+ $right(%word, $calc(-1 * %rand)) }
  1049. %temp.smbl = %temp.smbl $+ ;
  1050. inc %i
  1051. }
  1052. return $lower($replace(%temp.smbl,;,$chr(32)))
  1053. }
  1054. alias -l reverse {
  1055. var %i = $len($1-),%reversed, %space
  1056. while (%i >= 1) {
  1057. if (!%space) { %reversed = %reversed $+ $mid($replace($1-,$chr(32),$chr(160)),%i,1) }
  1058. %space = $false
  1059. if ($chr($mid($1-,%i,1)) == 32) { %space = $true }
  1060. dec %i
  1061. }
  1062. return $replace(%reversed,$chr(160),$chr(32))
  1063. }
  1064.  
  1065. alias scatter {
  1066. var %hintc = $2-
  1067. if ($thget(temp.scattermask)) var %schint = $thget(temp.scattermask)
  1068. else {
  1069. var %schint
  1070. !.echo -q $regsub(%hintc,$nonpunct,@,%schint)
  1071. }
  1072. var %rnum = $int($calc(($regex(%schint,/@/g) / 100) * (100 - $1)))
  1073. while (%rnum >= 0) {
  1074. if ($regex(%schint,/(@)/g)) !.echo -q $regsub(%hintc,/(?<=^.{ $+ $calc($regml($rand(1,$regml(0))).pos - 1) $+ })./,@, %hintc)
  1075. dec %rnum
  1076. }
  1077. thset temp.scattermask %hintc
  1078. return $replace(%hintc,@,$trivchar)
  1079. }
  1080.  
  1081. alias plot {
  1082. if ($1 >= 100) { return $2- }
  1083. var %hintc, %i = 1, %j = 0, %rnum = $int($calc(($regsub($2-,$nonpunct,@,%hintc) / 100) * $1))
  1084. while (%i <= %rnum) {
  1085. if ($regex(%hintc, /(?:^|\s|\xA0)[^\s\xA0@]{ $+ %j $+ }(@)/g) == 1) { inc %j }
  1086. %hintc = $+($left(%hintc,$calc($regml(1).pos - 1)), $mid($2-,$regml(1).pos,1),$right(%hintc,$calc($regml(1).pos * -1)))
  1087. inc %i
  1088. }
  1089. return $replace(%hintc,@,$trivchar)
  1090. }
  1091. alias startandrandom {
  1092. if ($1 > 0) return $replace($hget(hints,$1),@,$trivchar)
  1093. if ($hget(hints)) hfree hints
  1094. var %hintc = $2-, %onhint = 10, %f
  1095. while (%hintc) {
  1096. var %w = $gettok(%hintc,1,32), %rt = $regsub(%w,$nonpunct,@,%f), %hintc = $gettok(%hintc,2-,32), %k = 1
  1097. while (%k <= %onhint) {
  1098. hadd -m hints %k $hget(hints,%k) %f
  1099. if ($regex(%w,$nonpunct) > 1) !.echo -q $regsub(%w, /(?<=^.{ $+ $iif(%k == 1, 0, $calc($regml($rand(1,$regml(0))).pos - 1)) $+ })(.)/,@, %w) $regsub(%f, /(?<=^.{ $+ $calc($regml(1).pos - 1) $+ })./,$regml(1), %f)
  1100. inc %k
  1101. }
  1102. }
  1103. }
  1104.  
  1105.  
  1106. alias -l trivia.newchamp {
  1107. .rename $scoresfil $asctime(yymmddhhmmss) $+ .bak
  1108. setset Champ $calc($setini(Champ, 0) + 1) $nick
  1109. tsay $msg.trivia.victory($nick)
  1110. award Champ $nick
  1111. trivia.flush
  1112. haltdef
  1113. }
  1114.  
  1115. alias sort {
  1116. if (!$exists($scoresfil)) { return }
  1117. window -h $twin
  1118. filter -fwcgut $+ $iif($1 != time,e) [ $$gttok($iif($2 != total,$2) $+ $1) $asc(;) ] $scoresfil $twin $iif(($2) && ($2 != total),/^ $+ $str([^;]*;,$calc($$gttok($2)-1)) $+ $eval($ $+ get. $+ $2,2) $+ ;.* $+ /,/.*/)
  1119. }
  1120. alias -l msg.trivia.topx {
  1121. if ($calc($3 - $2) > 20) { return $msg.trivia.error.topx }
  1122. sort $1 $unit.default
  1123. var %temp.by = $gttok($1), %i = $2, %temp.ten = $e2(Places) $e1($2) $e2(to) $e1($3) $+ $e2(:)
  1124. while (%i <= $3) {
  1125. var %temp.ten = %temp.ten $e1($iif($hof(%i,1),$hof(%i,1) - $hof(%i,%temp.by)) $+ $e2(;)
  1126. inc %i
  1127. }
  1128. return %temp.ten
  1129. }
  1130. alias -l msg.trivia.topstats {
  1131. sort $1 $iif($2 != total, $2)
  1132. var %temp.by = $gttok($iif($2 != total, $2) $+ $1), %temp.ten = $e1($hof(1,1)) $e2(has the best $1 of) $e1($hof(1,%temp.by)) $iif($2 != total,$e2( for the $2 )) $+ $e2(;)
  1133. var %i = 2
  1134. while (%i <= $iif(%topnum,%topnum,10)) {
  1135. var %temp.ten = %temp.ten $iif($hof(%i,1),$e1($hof(%i,1)) $e2(-) $e1($hof(%i,%temp.by)) $+ $e2(;))
  1136. inc %i
  1137. }
  1138. return $iif(!$hof(1,1),$e2(No elements in the hall of fame.),%temp.ten)
  1139. }
  1140. alias topnum { set %topnum $1 }
  1141. alias -l twin { return @trivia $+ $scoresfil }
  1142. alias -l getrank {
  1143. sort score $iif($2 != total, $2)
  1144. set -u0 %getrank $fline($twin,$+($1,;*),1)
  1145. if (!%getrank) { return $hof.size }
  1146. var %score = $getvar($hof(%getrank,1),$iif($2 != total, $2) $+ score)
  1147. while (%score == $getvar($hof(%getrank,1),$iif($2 != total, $2) $+ score)) { dec %getrank }
  1148. inc %getrank
  1149. if (%getrank != 1) {
  1150. set -u0 %getnextrank $calc(%getrank - 1)
  1151. set -u0 %getnextrankuser $hof(%getnextrank,1)
  1152. set -u0 %getnextrankat $user.score(%getnextrankuser,$2)
  1153. }
  1154. unset %uprank
  1155. if (!$3) { return %getrank }
  1156. set -u0 %uprank 1
  1157. var %upscore = $calc(%score + $3)
  1158. while ((%upscore >= $getvar($hof($calc(%getrank - %uprank),1),$iif($2 != total, $2) $+ score)) && (%getrank >= %uprank)) {
  1159. inc %uprank
  1160. }
  1161. dec %uprank
  1162. return %getrank
  1163. }
  1164. alias mrankon {
  1165. if (!$getset(trivia, ranks)) { return $false }
  1166. if ($setini(ranks,0) == 0) { return $false }
  1167. else { return $true }
  1168. }
  1169. alias getmrank {
  1170. if (!$getset(trivia, ranks)) { return }
  1171. var %score = $user.score($1,$2), %i = $setini(ranks,0), %te = 0, %temax = 0
  1172. while (%i >= 1) {
  1173. %te = $setini(ranks,%i)
  1174. if ((%score >= %te) && (%te >= %temax)) { %temax = %te }
  1175. dec %i
  1176. }
  1177. return $getset(ranks,%temax)
  1178. }
  1179. alias getnextmrank {
  1180. var %next.rank = $getnextmrankat($1)
  1181. return $iif(%next.rank, $getset(ranks,%next.rank), None)
  1182. }
  1183. alias getnextmrankat {
  1184. if (!$getset(trivia, ranks)) { return }
  1185. var %score = $1, %i = $setini(ranks,0), %te = 0, %temax = 0, %by = 0
  1186. while (%i >= 1) {
  1187. %te = $setini(ranks,%i)
  1188. if ((%score <= %te) && ((!%by) || ($calc(%score + %by) >= %te))) {
  1189. %temax = %te
  1190. %by = $calc(%te - %score)
  1191. }
  1192. dec %i
  1193. }
  1194. return %temax
  1195. }
  1196.  
  1197. alias -l recordstat {
  1198. sort $1 $unit.default
  1199. return $hof(1,1)
  1200. }
  1201.  
  1202. alias unit.tokens { return year.month.week.day }
  1203. alias get.day { return $int($calc(($ctime - $timezone) / 86400)) }
  1204. alias get.week { return $int($calc((($get.day - 4) - $iif($getset(status,monday),0,1)) / 7)) }
  1205. alias get.month { return $calc(($get.year * 12) + $asctime($ctime,mm)) }
  1206. alias get.year { return $calc($asctime($ctime,yyyy) - 1970) }
  1207. alias process.scores.time {
  1208. var %i = 1
  1209. while (%i <= 4) {
  1210. var %unit = $gettok($unit.tokens,%i,$asc(.))
  1211. var %uvalue = $eval($ $+ get. $+ %unit,2)
  1212. if ((%unit) && (%uvalue)) {
  1213. if ($getvar($1,%unit) != %uvalue) {
  1214. setvar $1 %unit %uvalue
  1215. setvar $1 %unit $+ score $calc(0 + $2)
  1216. setvar $1 %unit $+ streak $calc(0 + $3)
  1217. setvar $1 %unit $+ time $ifd($4,9999)
  1218. setvar $1 %unit $+ wpm $calc(0 + $5)
  1219. }
  1220. else {
  1221. if ($2) setvar $1 %unit $+ score $calc($getvar($1,%unit $+ score) + $2)
  1222. if ($3 > $getvar($1,%unit $+ streak)) setvar $1 %unit $+ streak $3
  1223. if ($4 < $getvar($1,%unit $+ time)) setvar $1 %unit $+ time $4
  1224. if ($5 > $getvar($1,%unit $+ wpm)) setvar $1 %unit $+ wpm $5
  1225. }
  1226. }
  1227. inc %i
  1228. }
  1229. }
  1230.  
  1231. alias setvar {
  1232. if ($3 == $null) return
  1233. if ($exists($tempfil)) var %backburner = $read($tempfil, wnt, $1 $+ ;*)
  1234. if (%backburner != $null) mergeentry $tempfil $scoresfil $1
  1235. var %newline = $readvar($1)
  1236. if (!%newline) { %newline = $1 }
  1237. if ($numtok(%newline,59) < $numtok($tvartoks, $asc(.))) {
  1238. %newline = %newline $+ $str(;0,$calc($numtok($tvartoks, $asc(.)) - $numtok(%newline,59)))
  1239. if ($gettok(%newline,9,59) == 0) { %newline = $puttok(%newline,trivia,9,59) }
  1240. if (($gettok(%newline,8,59) == 0) && ($address($1,5))) { %newline = $puttok(%newline,$address($1,5),8,59) }
  1241. if ($gettok(%newline,6,59) == 0) { %newline = $puttok(%newline,$date,6,59) }
  1242. if ($gettok(%newline,3,59) == 0) { %newline = $puttok(%newline,9999,3,59) }
  1243. }
  1244. %newline = $puttok(%newline,$3-,$gttok($2),59)
  1245. write $iif($readn,-l $+ $readn) $scoresfil %newline
  1246. set -u3 %cache.nick $1
  1247. set -u3 %cache.line %newline
  1248. }
  1249. alias readvar {
  1250. if ($exists($scoresfil)) var %scoreline = $read($scoresfil, wnt, $1 $+ ;*)
  1251. if (!%scoreline) { return }
  1252. if (!$2) { return %scoreline }
  1253. else { return $gettok(%scoreline, $gttok($2), 59) }
  1254. }
  1255. alias getvar {
  1256. if ($1 == %cache.nick) { var %scoreline = %cache.line }
  1257. else {
  1258. var %scoreline = $readvar($1)
  1259. if (!%scoreline) { return }
  1260. set -u3 %cache.nick $1
  1261. set -u3 %cache.line %scoreline
  1262. }
  1263. if (!$2) { return %scoreline }
  1264. else { return $gettok(%scoreline, $gttok($2), 59) }
  1265. }
  1266. alias -l gttok { return $findtok($tvartoks, $1, 1, $asc(.)) }
  1267. alias -l tvartoks { return name.score.time.streak.wpm.lastwin.answered.address.team.admin.block.day.dayscore.daystreak.daytime.daywpm.week.weekscore.weekstreak.weektime.weekwpm.month.monthscore.monthstreak.monthtime.monthwpm.year.yearscore.yearstreak.yeartime.yearwpm }
  1268. alias -l varfil { return $iif($2 == $null, $iif($1 == 0, $lines($scoresfil), $gettok($read($scoresfil, $1),1,59)), $gettok($read($scoresfil, $1),$2,59)) }
  1269. alias trivini { return $iif($exists(trivia.ini),trivia.ini,$iif($exists(" $+ $scriptdir $+ \ $+ trivia.ini $+ ")," $+ $scriptdir $+ \ $+ trivia.ini $+ ",trivia.ini)) }
  1270. alias -l setset {
  1271. if ($3- != $null) { writeini -n $trivini $1 $2 $3- }
  1272. else { remini -n $trivini $$1 $2 }
  1273. }
  1274. alias getset { return $readini($trivini, n, $1, $2) }
  1275. alias -l setini { return $iif($2 != $null, $ini($trivini, $1, $2), $ini($trivini, $1)) }
  1276. alias -l thuser { return $thget($eval(Temp. $+ $1 $+ . $+ $nick,1)) }
  1277. alias -l thuset { thset $eval(Temp. $+ $1 $+ . $+ $nick,1) $2- }
  1278. alias -l thset { if ($hget(Trivia $+ $idenn)) hadd Trivia $+ $idenn $1- }
  1279. alias thget { return $hget(Trivia $+ $idenn, $1) }
  1280.  
  1281. alias -l colorcode { return $gettok(colors off.white.black.blue.green.lightred.brown.purple.orange.yellow.lightgreen.cyan.lightcyan.lightblue.pink.grey.lightgrey,$calc($1 + 1),$asc(.)) }
  1282. alias -l fixer { return $base($1,10,10,2) }
  1283. alias varcolors {
  1284. unset %c1 %c1o %c2 %c2o
  1285. if ((!$getset(color,on)) || (!$tc(1)) || (!$tc(2))) { return }
  1286. %c1o = $iif($tc(1).b,$chr(2)) $+ $iif($tc(1).u,$chr(31)) $+ $chr(3)
  1287. %c2o = $iif($tc(2).b,$chr(2)) $+ $iif($tc(2).u,$chr(31)) $+ $chr(3)
  1288. %c1 = %c1o $+ $fixer($calc($tc(1) - 1)) $+ $iif(($tc(3)) && ($getset(color,bon)), $chr(44) $+ $fixer($calc($tc(3) - 1)))
  1289. %c2 = %c2o $+ $fixer($calc($tc(2) - 1)) $+ $iif(($tc(4)) && ($getset(color,bon)), $chr(44) $+ $fixer($calc($tc(4) - 1)))
  1290. }
  1291. alias rdc {
  1292. if ($getset(status,nocolorshort) == 1) return $1
  1293. var %a
  1294. !.echo -q $regsub($1,/(?<=\x03|\x03\d\d\x2C)(\d)(?!\d)/g,0\1, %a)
  1295. while ($regsub(%a, /(?<=\x03\d\d\x2C\d\d|\x03\d\d\x03|\x03)([\x02\x1F\x16\s\xA0]+)(\x03(?:\d\d(?:\x2C\d\d)?)?)/g,\2\1, %a)) { }
  1296. !.echo -q $regsub(%a, /(\x02)([\x1F\x16\s\xA0]*)\1/g,\2, %a) $&
  1297. $regsub(%a, /(\x1F)([\x02\x16\s\xA0]*)\1/g,\2, %a) $&
  1298. $regsub(%a, /(\x16)([\x02\x1F\s\xA0]*)\1/g,\2, %a) $&
  1299. $regsub(%a, /(?:\x03(?:\d\d(?:\x2C\d\d)?)?)+(\x03(?:(?!\d)|\d\d\x2C\d\d))/g,\1, %a) $&
  1300. $regsub(%a, /(?:\x03\d\d)(\x2C\d\d)(?:\x03\d\d)*(\x03\d\d)/g,\2\1, %a) $&
  1301. $regsub(%a, /(?<=\x03\d\d)(\x2C\d\d)([^\x03]+\x03\d\d)\1/g,\1\2, %a)
  1302. while ($regsub(%a,/(\x03\d\d)((\x2C\d\d)?[^\x03]+)\1(?!\x2c\d)/g,\1\2, %a)) { }
  1303. !.echo -q $regsub(%a, /^\x03(?!\d)|(\x03(\d\d(\x2C\d\d)?)?|\x02|\x16|\x1F)+$/g,,%a) $&
  1304. $regsub(%a, /(?<=\x03|\x03\d\d\x2C)0(\d)(?!\d)/g,\1, %a)
  1305. return %a
  1306. }
  1307.  
  1308. alias -l msg.trivia.award { return %c2 $+ $replace($eval($1,2),^, %c2o $+ $e1($2) $+ %c2,*, %c2o $+ $e1($nick) $+ %c2) $+ %c2o }
  1309. alias -l award {
  1310. if ($getset(status,noawards)) { return }
  1311. var %i = 1, %award = $calc($findtok($award.on.tok, $1, 1, $asc(.)) - 1), %trigger = $2-
  1312. while ($aw(%i)) {
  1313. tokenize 32 $aw(%i)
  1314. if (%award == $1) {
  1315. if (($2 == 0) || (($2 == 1) && (%trigger == $4)) || (($2 == 2) && (%trigger isnum $4 - $5)) || (($2 == 3) && (%trigger >= $4)) || (($2 == 4) && (%trigger <= $4)) || (($2 == 5) && (%trigger == $getrank($nick,$unit.default))) || (($2 == 6) && ($rand(1,$4) <= $5)) || (($2 == 7) && ($4 $+ * iswm %trigger)) || (($2 == 8) && (* $+ $4 iswm %trigger))) { $award.act($3,%trigger,$6-) }
  1316. }
  1317. inc %i
  1318. }
  1319. }
  1320. alias award.act {
  1321. var %do
  1322. if ($1 == 1) { var %do = tact $rdc($msg.trivia.award($3,$2)) }
  1323. if (($1 == 2) || ($1 == 5)) { var %do = tsay $rdc($msg.trivia.award($3,$2)) }
  1324. if ($1 == 3) { var %do = notice $nick $rdc($msg.trivia.award($3,$2)) }
  1325. if ($1 == 4) { var %do = trivia.credit $nick $3 }
  1326. if ($1 == 5) { var %do = tban $nick }
  1327. if ($1 == 6) { var %do = $eval($replace($3-,*,$2),3) }
  1328. .timer 1 0 schan $chan %do
  1329. }
  1330. alias schan {
  1331. set -u3 %ident $1
  1332. $2-
  1333. }
  1334. alias award.on.tok { return Null.Score.Row.Time.WPM.Join.Question.Uprank.Promotion.Answered.RoundStart.RoundStop.Command.NoAnswer.Hint.HTMLUpdate.Champ.TeamVictory.TeamAnswered }
  1335. alias award.val.tok { return Always.Exactly.Between.At Least.At Most.Ranked.Random.Begins.Ends }
  1336. alias award.do.tok { return Null.Describe.Msg.Notice.Give Points.Ban.Special }
  1337.  
  1338. alias -l inform {
  1339. if ((!$1) || (!$server)) { return }
  1340. if (!%respond) {
  1341. var %respondlevel = $getset(status,respondlevel)
  1342. set -u2 %respond .notice $nick
  1343. if (%respondlevel == 2) { }
  1344. if (%respondlevel == 3) { set -u2 %respond msg $iden }
  1345. if (%respondlevel == 4) { set -u2 %respond msg $nick }
  1346. if (%respondlevel == 5) { set -u2 %respond describe $iden }
  1347. }
  1348. $iif($scid(%cid.force),scid %cid.force) $iif($nick == $me, .timer -m 1 $calc($timer(0) * 100)) %respond $check.auto.strip($rdc($1-))
  1349. }
  1350. alias here { set %cid.force $cid }
  1351. alias -l tsay { if (($1) && ($server) && ($me ison $iden)) { $iif($nick == $me, .timer -m 1 $calc($timer(0) * 100)) msg $iden $check.auto.strip($rdc($1-)) } }
  1352. alias -l tact { if (($1) && ($server) && ($me ison $iden)) describe $iden $check.auto.strip($rdc($1-)) }
  1353. alias -l check.auto.strip { return $iif(c isincs $gettok($chan($iden).mode,1,32), $strip($1-), $1-) }
  1354.  
  1355. alias -l do.ping {
  1356. if ($eval(% $+ pingantispam. $+ $nick,2)) return
  1357. ctcp $nick ping
  1358. set -u120 % $+ ping. $+ $nick $ticks
  1359. set -u120 % $+ pingchan. $+ $nick $chan
  1360. set -u120 % $+ pingcid. $+ $nick $cid
  1361. }
  1362. alias -l trivia.report {
  1363. inform $msg.trivia.thanks
  1364. write " $+ $triv(dir) $+ / $+ $iif($1 == 29, $triv(additions), $triv(report)) $+ " $nick $adate $time $2-
  1365. }
  1366.  
  1367. alias addressize {
  1368. if (*!*@* iswm $1) { return $1 }
  1369. return $1 $+ !*@*
  1370. }
  1371. alias -l is.friend {
  1372. var %i = 1
  1373. while ($getset(friend, %i)) {
  1374. if ($addressize($getset(friend, %i)) iswm $address($ifd($1,$nick),5)) { return %i }
  1375. inc %i
  1376. }
  1377. }
  1378. alias -l is.banned {
  1379. var %i = 1
  1380. while ($getset(banned,%i)) {
  1381. if ($addressize($getset(banned, %i)) iswm $address($ifd($1,$nick),5)) { return %i }
  1382. inc %i
  1383. }
  1384. }
  1385. alias -l trivia.banned {
  1386. var %banned = $is.banned($1)
  1387. if (%banned) {
  1388. if (!$1) { inform $msg.trivia.banned }
  1389. return %banned
  1390. }
  1391. }
  1392. alias -l ban.size { return $calc(1 + $setini(banned, 0)) }
  1393. alias -l tban { if (!$trivia.banned($$1)) { setset banned $ban.size $1 } }
  1394. alias -l tunban {
  1395. var %i = $trivia.banned($$1)
  1396. while ($getset(banned, $calc(%i + 1))) {
  1397. setset banned %i $getset(banned, $calc(%i + 1))
  1398. inc %i
  1399. }
  1400. setset banned %i
  1401. }
  1402.  
  1403. alias timealias {
  1404. var %ticks = $ticks
  1405. echo -a ... $eval($ $+ $1,2) ... $calc(($ticks - %ticks) / 1000) ... $1
  1406. }
  1407. alias timealias2 {
  1408. var %ticks = $ticks, %i = 1, %result
  1409. while (%i <= $2) {
  1410. var %result = $eval($ $+ $eval($1-,2),2)
  1411. inc %i
  1412. }
  1413. return $calc(($ticks - %ticks) / (1000 * $2))
  1414. }
  1415. alias iden { return $iif($chan, $chan, $iif(%ident, %ident, $tchan(1))) }
  1416. alias idenn { return $iden $+ . $+ $ifd($network,irc) }
  1417. alias -l deleteplayer { if ($getvar($1)) { write -dl $+ $readn $scoresfil } }
  1418. alias -l hof.size { return $line($twin,0) }
  1419. alias -l hof { return $gettok($line($twin,$1),$2,59) }
  1420. alias -l scoresfil { return $nopath($ifd($thget(scores),$ifd($tchan($trivchan, 4), TriviaScores.fil))) }
  1421. alias -l user.score { return $getvar($1,$unit.prefix($2) $+ score) }
  1422. alias -l trivia.on { if (($timer(q $+ $idenn)) || ($timer(end $+ $idenn))) { return $true } }
  1423. alias -l question.on { if ($timer(end $+ $idenn)) { return $true } }
  1424. alias -l tokq { return $thget(tokq) }
  1425. alias -l tok { return $thget(tok $+ $1) }
  1426. alias -l question.time { return $calc(($ticks - $thget(Start)) / 1000) }
  1427. alias -l te { return $getset(team, $1 $+ $prop) }
  1428. alias -l teamscore { return $thget(Score $+ $1) }
  1429. alias -l max.hinted { return $iif($calc($thget(Temp.Hints) + 0) > $calc($thuser(Hint) + 0), $thget(Temp.Hints), $thuser(hint)) }
  1430. alias -l isteam { return $thget(Team. $+ $1) }
  1431. alias -l chkadate { return $iif($getset(status,adate), $+($gettok($1,2,$asc(/)),/,$gettok($1,1,$asc(/)),/,$gettok($1,3,$asc(/))), $1) }
  1432. alias -l team { if ($thget(team) == 1) { return $true } }
  1433. alias -l tempini { return triviascbb.ini }
  1434. alias -l lag { return $iif($thget(lag $+ $1), $thget(lag $+ $1), $getset(lag,$1)) }
  1435. alias -l slag { return $getset(lag,$1) }
  1436. alias -l tc { return $getset(color, $1 $+ $iif($prop == b, -bold) $+ $iif($prop == u, -underline)) }
  1437. alias -l triv { return $getset(trivia, $1) }
  1438. alias -l aw { return $getset(award, $1) }
  1439.  
  1440. alias e1 { return %c1 $+ $1- $+ %c1o }
  1441. alias e2 { return %c2 $+ $trivtran($1-) $+ %c2o }
  1442. alias trivtran {
  1443. if (!$triv(translate)) return $1-
  1444. if ($isfile($transfile)) {
  1445. var %tran = $read($transfile, wtn, $1- $+ ::=*)
  1446. if ($regex(%tran, /.*::=(.*))) { return $regml(1) }
  1447. if (#* iswm $read($transfile,n,1)) var %nowrite 1
  1448. }
  1449. if (!%nowrite) write $transfile $1- $+ ::= $+ $1-
  1450. return $1-
  1451. }
  1452. alias untrans {
  1453. if (!$triv(translate)) return $1-
  1454. if ($isfile($transfile)) {
  1455. var %tran = $read($transfile, wtn, *::= $+ $1-)
  1456. if ($regex(%tran, /(.*)::=.*)) { return $regml(1) }
  1457. }
  1458. return $1-
  1459. }
  1460. alias tranord { return $1 $+ $trivtran($remove($ord($1),$1)) }
  1461. alias transfile { return " $+ $triv(translate) $+ " }
  1462.  
  1463. alias -l msg.ping.reply { return $e1($nick) $+ $e2($chr(44) your ping is) $e1($calc(($ticks - % [ $+ ping. [ $+ [ $nick ] ] ] ) / 1000)) $e2(secs.) }
  1464. alias -l msg.answer.correct { return $iif($1,$msg.answer.correct2($2,$3,$4),$e2(Winner:) $e1($getmrank($nick) $nick) $iif(!$getset(status,shownone),$e2(Answer:) $e1($trivq.answer)) $iif(!$getset(hide,time),$e2(Time:) $e1($thget(Time))) $iif(!$getset(hide,streak),$e2(Streak:) $e1($getset(Var $+ $idenn, Row))) $iif(!$getset(hide,score),$e2(Points:) $e1($user.score($nick))) $iif(!$getset(hide,wpm),$e2(WPM:) $e1($int($2))) $iif(!$getset(hide,score),$e2(Rank:) $e1($tranord($3)) $iif($4,$e2(Previously:) $e1($tranord($4))))) }
  1465. alias -l msg.answer.correct2 { return $e1($getmrank($nick) $nick) $e2(got the answer) $+ $iif(!$getset(status,shownone),$e2(:) $e1($trivq.answer),$e2(.)) $iif(!$getset(hide,time),$e2(in) $e1($thget(Time)) $e2(seconds.)) $iif(!$getset(hide,score),$e2(Points:) $e1($user.score($nick))) $e2(Rank:) $e1($tranord($2)) }
  1466. alias -l msg.answer.timeout { return $e2(Time's up! The answer was:) $e1($trivq.answer) }
  1467. alias -l msg.answer.timeout.total { return $e2(Time's up! Remaining answers were:) $e1($left($gettotalremain,850)) }
  1468. alias -l msg.answer.timeout.kaos { return $e2(Time's up!) $e1($total.answered) $e2(/) $e1($total.answers) $e2(answered) }
  1469. alias -l msg.answer.timeout.pick { return $e2(Time's up! The answer was:) $e1($left($get.picklist,850)) }
  1470. alias -l msg.answer.timeout2 { return $e2(Time's up!) }
  1471. alias -l msg.question.multi { return $iif($1, $e1($1) $+ $e2(:)) $e2(Multiple Choice:) $e1($right($tok(1),-7)) $+ $e2(;) $e1($get.multianswers) }
  1472. alias -l msg.question.total { return $iif($1, $e1($1) $+ $e2(:)) $e2(Give all correct responses:) $e1($right($tok(1),-7)) }
  1473. alias -l msg.question.kaos { return $iif($1, $e1($1) $+ $e2(:)) $e2(Kaos:) $e1($right($tok(1),-5)) }
  1474. alias -l msg.question.points { return $iif($1, $e1($1) $+ $e2(:)) $e2(For) $e1($ifd($thget(temp.points),0)) $e2(point $+ $iif($thget(temp.points) != 1,s) $+ :) $e1($get.question($2-)) }
  1475. alias -l msg.question.scramble { return $iif($1, $e1($1) $+ $e2(:)) $iif($getset(status, sayscramble),$e2(Unscramble the following:)) $iif($2,$e1($2) $+ $e2(:)) $e1($scramble($tok(2)) $+ ?) }
  1476. alias -l msg.question.standard { return $iif($1, $e1($1) $+ $e2(:)) $e1($get.question($ifd($2,$tok(1)))) }
  1477. alias -l msg.question.answer { return $e2(The answer to the last question was $+ :) $e1($thget(answer)) }
  1478. alias -l msg.trivia.stats { return $iif($getvar($1,$2 $+ score), $e1($getmrank($1,$iif(!$2,total,$2)) $1) $+ $e2(:) $iif(!$getset(hide,score),$e2(Rank:) $e1($tranord($getrank($1,$2))) $e2(out of) $e1($hof.size) $+ $e2(.) $e2(Current wins:) $e1($getvar($1,$2 $+ score)) $+ $e2(.)) $iif(!$getset(hide,streak),$e2(Best streak:) $e1($getvar($1,$2 $+ streak)) $+ $e2(.)) $iif(!$getset(hide,time),$e2(Best time:) $e1($getvar($1,$2 $+ time)) $e2(secs.)) $iif(!$getset(hide,wpm),$e2(WPM:) $e1($getvar($1,$2 $+ wpm)) $+ $e2(.)) $iif($getvar($1,lastwin), $e2(Last Win:) $e1($chkadate($getvar($1, lastwin))) $+ $e2(.)), $e2(No such user exists.)) }
  1479. alias -l msg.trivia.rank { return $iif($user.score($1), $e1($getmrank($1) $1) $+ $e2(:) $iif(!$getset(hide,score),$e2(Current wins:) $e1($user.score($1)) $+ $e2(.)) $iif(($mrankon) && ($getnextmrankat($user.score($1)) != 0),$e2(Next rank:) $e1($getnextmrank($user.score($1))) $iif(!$getset(hide,score),$e2(after:) $e1($calc($getnextmrankat($user.score($1)) - $user.score($1))) $e2(more points.))) $iif(!$getset(hide,score),$e2(Rank:) $e1($tranord($getrank($1,$unit.default))) $e2(out of) $e1($hof.size) $+ $e2(.) $iif(%getrank != 1,$e1($calc(%getnextrankat - $user.score($1))) $e2(points below) $e1(%getnextrankuser) $+ $e2(.))),$e2(Error.)) }
  1480. alias -l msg.trivia.state { return $msg.trivia.version $e2(is currently) $e1($trivon) $+ $e2(.) $iif($getset(status,champ),$e2(Champ Mode Set to) $e1($triv(reset)) $e2(Wins.)) $e2(Question file contains) $e1($numq) $e2(lines.) $e1($numl) $e2(questions. Trivia is:) $e1($trivia.onoff) $+ $e2(.) $iif($trivia.on, $iif($question.on,$e2(Time left:) $e1($calc($thget(lagtimedout) - $question.time))) $e2(Question:) $e1($thget(Current)) $+ $e2(/) $+ $e1($thget(Max)) $e2(Team Game:) $e1($team.onoff) $+ $e2(. Trivia Round started by) $e1($thget(SUser)) $e2(on) $e1($thget(STime))) $e2(Bot time is:) $e1($time) }
  1481. alias -l msg.trivia.enabled { return $e2(Enabling the trivia. Have an op type:) $e1($pre $+ $gtok(2)) $e2(to disable the bot.) }
  1482. alias -l msg.trivia.disabled { return $e2(Disabling the trivia. Have an op type:) $e1($pre $+ $gtok(3)) $e2(to enable the bot.) }
  1483. alias -l msg.trivia.victory { return $e2(The game has been beaten by) $e1($1) $e2(all hail the new champ whose name shall reign supreme!) }
  1484. alias -l msg.trivia.unactive { return $e2(The game has been disabled due to inactivity.) }
  1485. alias -l msg.trivia.emptyoff { return $e2(The game has been disabled due lack of players.) }
  1486. alias -l msg.trivia.pause { return $e2(Trivia paused.) $e1($pre $+ $gtok(8)) $e2(to resume.) }
  1487. alias -l msg.trivia.resume { return $e2(Trivia resumed.) }
  1488. alias -l msg.trivia.started { return $e2(Starting the trivia. Round of) $e1($iif($thget(Max) == Unlimited,$gtok(1,5),$thget(Max))) $e2(questions.) $e1($pre $+ $gtok(6)) $e2(to stop. Total:) $e1($numl) }
  1489. alias -l msg.trivia.stopped { return $e2(Stopping the trivia.) $e1($pre $+ $gtok(5) $iif(!$isdis(1),< $+ $trivtran(number) $+ >)) $e2(to restart.) }
  1490. alias -l msg.trivia.awarded { return $e1($1) $e2(was awarded) $e1($2) $e2(point $+ $iif($2 > 1,s) $+ . Current Wins:) $e1($user.score($1)) }
  1491. alias -l msg.trivia.deducted { return $e1($1) $e2(was deducted) $e1($calc($2 * -1)) $e2(point $+ $iif($2 < -1,s) $+ . Current Wins:) $e1($user.score($1)) }
  1492. alias -l msg.trivia.hof { return $msg.trivia.champ(1) $msg.trivia.topstats(score) }
  1493. alias -l msg.trivia.error.midq { return $e2(Cannot pause while trivia game has a question issued.) }
  1494. alias -l msg.trivia.banned { return $e2(You cannot play $+ $chr(44) you are banned.) }
  1495. alias -l msg.trivia.guessed { return $e2(You already guessed) $e1($1) $e2(times.) }
  1496. alias -l msg.trivia.thanks { return $e2(Thank you for your contribution!) }
  1497. alias -l msg.trivia.totalover { return $e2(All correct responses have been given!) }
  1498. alias -l msg.trivia.version { return $e1($trivia.name $+ $chr(44) v $+ $trivia.version) }
  1499. alias -l msg.trivia.web { return $e2(Get your own copy of) $msg.trivia.version $e2(at) $e1($trivia.web) $e2(.) }
  1500. alias -l msg.trivia.onjoin { return $iif($getset(trivia,onjoin),$get.onjoin($getset(trivia,onjoin)),$e2(Welcome) $e1($getmrank($nick) $nick) $+ $e2($chr(44)) $e1($msg.trivia.version) $e2(is activated. Type ') $+ $e1($pre $+ $gtok(33)) $+ $e2(' for a list of commands or just ') $+ $e1($pre $+ $gtok(5)) $+ $e2(' to start a game!)) }
  1501. alias -l msg.trivia.records { return $iif(!$getset(hide,streak),$e2(Record streak:) $e1($recordstat(streak)) $e2(of) $e1($hof(1,4)) $+ $e2(.)) $iif(!$getset(hide,time),$e2(Record time:) $e1($recordstat(time)) $e2(of) $e1($hof(1,3)) $+ $e2(.)) $iif(!$getset(hide,wpm),$e2(Record wpm:) $e1($recordstat(WPM)) $e2(of) $e1($hof(1,5)) $+ $e2(.)) }
  1502. alias -l msg.trivia.themes { return $e2(Current themes are:) $e1($get.themes) }
  1503. alias -l msg.trivia.champ { return $iif($getset(status,champ), $e2(Current champ:) $e1($getset(Champ, $ini($trivini, Champ, 0))) $+ $e2(. $get.champ($1))) }
  1504. alias -l msg.trivia.showteams { return $msg.trivia.showteam(1) $msg.trivia.showteam(2) $iif($getset(team, 4-team), $msg.trivia.showteam(3) $msg.trivia.showteam(4)) }
  1505. alias -l msg.trivia.showteam { return $iif($get.showteams($1), $e2(Current members of) $e1($te($1)) $e2(are:) $e1($get.showteams($1))) }
  1506. alias -l msg.trivia.hintpaused { return $e2(You requested a $pre $+ $gtok(39) less than) $e1($triv(hintpause)) $e2(seconds ago.) }
  1507. alias -l msg.trivia.roundscores { return $e2(Current Round:) $e1($get.roundscores) }
  1508. alias -l msg.trivia.banlist { return $e2(The following people are banned:) $e1($get.banlist) }
  1509. alias -l msg.team.start { return $e2(Team Trivia: ') $+ $e1($pre $+ $gtok(34) 1) $+ $e2(' or ') $+ $e1($pre $+ $gtok(34) 2) $+ $iif($getset(team,4-team),$e2(' or ') $+ $e1($pre $+ $gtok(34) 3) $+ $e2(' or ') $+ $e1($pre $+ $gtok(34) 4)) $+ $e2(' to add to a team.) }
  1510. alias -l msg.team.add { return $e2(Team:) $e1($1) $e2(has a new member:) $e1($2) }
  1511. alias -l msg.team.joinover { return $e2(I am sorry no more people can join/change at this time.) }
  1512. alias -l msg.team.toomany { return $e2(That team currently has enough players.) }
  1513. alias -l msg.team.joinbefore { return $e2(Teams are no longer accepting player.) }
  1514. alias -l msg.team.alreadyon { return $e2(You are already on that team.) }
  1515. alias -l msg.team.score { return $e1($getmrank($nick) $nick) $e2(won. Point for) $e1($te($isteam($nick))) $+ $e2(.) $msg.team.cscore(1,2) $iif($getset(team,4-team), $msg.team.cscore(3,4)) }
  1516. alias -l msg.team.cscore { return $e1($te($1)) $e2(has) $e1($thget(Score $+ $1)) $e2(points.) $e1($te($2)) $e2(has) $e1($thget(Score $+ $2)) $e2(points.) }
  1517. alias -l msg.team.over { return %c2 $+ $replace($1-, *t1, %c2o $+ $e1($te(1)) $+ %c2,*t2, %c2o $+ $e1($te(2)) $+ %c2,*t3,%c2o $+ $e1($te(3)) $+ %c2,*t4,%c2o $+ $e1($te(4)) $+ %c2) $+ %c2o $+ $e2(!) }
  1518. alias -l msg.hint.words { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(there $iif($$get.hint(words) == 1,is,are)) $e1($$get.hint(words)) $e2(word $+ $iif($$get.hint(words) != 1,s) in the answer.) }
  1519. alias -l msg.hint.vowels { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(the vowels are:) $e1($$get.hint(vowels)) }
  1520. alias -l msg.hint.last { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(the last character in the answer is:) $e1($$get.hint(last)) }
  1521. alias -l msg.hint.space { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(answer space:) $e1($$get.hint(space)) }
  1522. alias -l msg.hint.scramble { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e2(scrambled:) $e1($$get.hint(scramble)) }
  1523. alias -l msg.hint.hint { return $e2(Here's $iif($getset(status,sayhintnum),your $tranord($ifd($thuser(hint),$thget(Temp.Hints))), a) hint $+ $chr(44)) $e1($$get.hint(hint,$1)) }
  1524. alias -l msg.features.built { return $e2(Trivia scores updated:) $e1($1) $e2(!) }
  1525. alias -l msg.trivia.hof.error { return $e1($pre $+ $gtok(14) < $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ >) $e2(to display the hall of fame table of your choice.) }
  1526. alias -l msg.trivia.stats.error { return $e1($pre $+ $gtok(11) < $+ $trivtran(player) $+ $chr(124) $+ $trivtran(number) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ >) $e2(to display stats on that individual.) }
  1527. alias -l msg.trivia.op.ban { return $e2(User is banned.) }
  1528. alias -l msg.trivia.error.ban { return $e2(You need to specify a user or address to ban.) }
  1529. alias -l msg.trivia.error.unban { return $e2(You need to specify a user or address to unban.) }
  1530. alias -l msg.trivia.op.unban { return $e2(User is unbanned.) }
  1531. alias -l msg.trivia.error.badnum { return $e2(You need to specify a valid question number to be asked.) }
  1532. alias -l msg.trivia.op.ask { return $e2(Question will be asked.) }
  1533. alias -l msg.trivia.error.noquestion { return $e2(You need append the question that is to be added directly into the question file.) }
  1534. alias -l msg.trivia.error.nodelim { return $e2(You need at least one delimiter to indicate: question $+ $triv(delimiter) $+ answer) }
  1535. alias -l msg.trivia.op.added { return $e2(Question has been added.) }
  1536. alias -l msg.trivia.error.nosearch { return $e2(You need at least some search text.) }
  1537. alias -l msg.trivia.op.find { return $iif($get.find($1-),$e1($get.find($1-)),$msg.trivia.error.find) }
  1538. alias -l msg.trivia.error.find { return $e2(That text was not found.) }
  1539. alias -l msg.trivia.error.topx { return $e2(Range too great.) }
  1540. alias -l msg.trivia.error.numberrequired { return $e2(You must specify a valid team number for) $e1($1-) $e2(.) }
  1541. alias -l msg.trivia.error.playerrequired { return $e2(You must specify a player.) }
  1542. alias -l msg.trivia.echoanswer { return $e2(Answer:) $e1($trivq.answer) }
  1543.  
  1544. alias -l givehelp {
  1545. if (!$1-) {
  1546. inform $e2(Commands:) $e1($pre $+ $gtok(6) $pre $+ $gtok(5) $pre $+ $gtok(39) $pre $+ $gtok(34) $pre $+ $gtok(29) $pre $+ $gtok(30) $pre $+ $gtok(31) $pre $+ $gtok(27) $pre $+ $gtok(28) $pre $+ $gtok(14) $pre $+ $gtok(19) $pre $+ $gtok(16) $pre $+ $gtok(21) $pre $+ $gtok(25) $pre $+ $gtok(38) $pre $+ $gtok(23) $pre $+ $gtok(26) $pre $+ $gtok(44) $pre $+ $gtok(37) $pre $+ $gtok(11) $pre $+ $gtok(1) $pre $+ $gtok(3) $pre $+ $gtok(2) $pre $+ $gtok(10) $pre $+ $gtok(41) $pre $+ $gtok(42) $pre $+ $gtok(43) $pre $+ $gtok(35) $pre $+ $gtok(36) $pre $+ $gtok(4) $pre $+ $gtok(7) $pre $+ $gtok(8) $pre $+ $gtok(62))
  1547. inform $e1($pre $+ $gtok(33) < $+ $trivtran(command) $+ >) $e2(for specific help. Some commands may be disabled.)
  1548. }
  1549. var %ctok = $iif($pre $+ * iswm $1, $ctok($right($1,$calc(-1 * $len($pre)))), $ctok($1))
  1550. if ((%ctok == 1)) { inform $e1($gtok(%ctok) -----) $e2(Displays the state of the bot) }
  1551. if ((%ctok == 6)) { inform $e1($gtok(%ctok) ---) $e2(Stops trivia) }
  1552. if ((%ctok == 3)) { inform $e1($gtok(%ctok) ----) $e2(Enables trivia bot) }
  1553. if ((%ctok == 2)) { inform $e1($gtok(%ctok) ---) $e2(Disables trivia bot) }
  1554. if ((%ctok == 7)) { inform $e1($gtok(%ctok) ----) $e2(Pauses trivia bot) }
  1555. if ((%ctok == 8)) { inform $e1($gtok(%ctok) ----) $e2(Resumes trivia bot) }
  1556. if ((%ctok == 4)) { inform $e1($gtok(%ctok) < $+ $trivtran(command) $+ > -) $e1($gtok(1,2)) $+ $e2($chr(44)) $e1($gtok(2,2)) $+ $e2($chr(44)) $e1($gtok(3,2)) $+ $e2($chr(44)) $e1($gtok(4,2)) $+ $e2($chr(44)) $e1($gtok(5,2)) $+ $e2($chr(44)) $e1($gtok(6,2)) $+ $e2($chr(44)) $e1($gtok(7,2)) $+ $e2($chr(44)) $e1($gtok(8,2)) $+ $e2($chr(44) commands to allow ops to control the trivia bot.) }
  1557. if ((%ctok == 5)) { inform $e1($gtok(%ctok) x --) $e2(Starts trivia, x can be a number, "unlimited", <theme> or "team" for team mode) }
  1558. if ((%ctok == 39)) { inform $e1($gtok(%ctok) ------) $e2(Gives a hint) }
  1559. if ((%ctok == 42)) { inform $e1($gtok(%ctok) ------) $e2(Gives the last character of the answer) }
  1560. if ((%ctok == 41)) { inform $e1($gtok(%ctok) ------) $e2(Gives the number of words in the answer) }
  1561. if ((%ctok == 43)) { inform $e1($gtok(%ctok) ------) $e2(Gives the vowels of the answer) }
  1562. if ((%ctok == 34)) { inform $e1($gtok(%ctok) x ----) $e2(Joins a team, must be in team mode, x can be a 1 or 2) }
  1563. if ((%ctok == 29)) { inform $e1($gtok(%ctok) -------) $e2(Allows you to add questions: $pre $+ $gtok(29) What is the square root of 4*two*2) }
  1564. if ((%ctok == 30)) { inform $e1($gtok(%ctok) ----) $e2(Lets you report problems with the questions: $pre $+ $gtok(30) The square root of 4 is also -2) }
  1565. if ((%ctok == 31)) { inform $e1($gtok(%ctok) -----) $e2(Checks your lag from the bot) }
  1566. if ((%ctok == 27)) { inform $e1($gtok(%ctok) ---) $e2(Displays the version of the bot) }
  1567. if ((%ctok == 28)) { inform $e1($gtok(%ctok) -------) $e2(Displays the web page for the bot) }
  1568. if ((%ctok == 14)) { inform $e1($gtok(%ctok) < $+ $gtok(1,3) $+ $chr(124) $+ $gtok(2,3) $+ $chr(124) $+ $gtok(3,3) $+ $chr(124) $+ $gtok(4,3) $+ > < $+ $gtok(1,4) $+ $chr(124) $+ $gtok(2,4) $+ $chr(124) $+ $gtok(3,4) $+ $chr(124) $+ $gtok(4,4) $+ $chr(124) $+ $gtok(5,4) $+ > -------) $e2(Displays the hall of fame, for requested entry) }
  1569. if ((%ctok == 19)) { inform $e1($gtok(%ctok) ---) $e2(Displays the record times. Same as $pre $+ $gtok(14) $gtok(2,3)) }
  1570. if ((%ctok == 16)) { inform $e1($gtok(%ctok) --) $e2(Displays the record streaks. Same as $pre $+ $gtok(14) $gtok(3,3)) }
  1571. if ((%ctok == 21)) { inform $e1($gtok(%ctok) ----) $e2(Displays the record words per minute. Same as $pre $+ $gtok(14) $gtok(4,3)) }
  1572. if ((%ctok == 25)) { inform $e1($gtok(%ctok) ---) $e2(Displays the record $gtok(2,3) & $gtok(3,3) & $gtok(4,3)) }
  1573. if ((%ctok == 23)) { inform $e1($gtok(%ctok) ----) $e2(Displays the bot's server) }
  1574. if ((%ctok == 26)) { inform $e1($gtok(%ctok) -----) $e2(Displays the champ stats) }
  1575. if ((%ctok == 36)) { inform $e1($gtok(%ctok)) $e2(Displays the scores for the current round.) }
  1576. if ((%ctok == 35)) { inform $e1($gtok(%ctok)) $e2(Displays the teams and which players are on each.) }
  1577. if ((%ctok == 44)) { inform $e1($gtok(%ctok) ----) $e2(Repeats the question) }
  1578. if ((%ctok == 37)) { inform $e1($gtok(%ctok) ----) $e2(Provides the answer to the last question to an op who requests it) }
  1579. if ((%ctok == 38)) { inform $e1($gtok(%ctok) ----) $e2(After half the time to answer has expired allows an instant timeout.) }
  1580. if ((%ctok == 10)) { inform $e1($gtok(%ctok) ----) $e2(Lists available themes) }
  1581. if ((%ctok == 11)) { inform $e1($gtok(%ctok) ------) $e2(Returns your current stats, or $pre $+ $gtok(11) <player> for somebody else) }
  1582. if ((%ctok == 62)) { inform $e1($gtok(%ctok) ----) $e2(Displays score required for next promotion.) }
  1583. }
  1584.  
  1585. alias -l get.question {
  1586. var %gq $1-
  1587. if (!$getset(status,noautoqm)) { var %aqm = 1 }
  1588. if ($right(%gq,1) isin :!?.-) { var %aqm = 0 }
  1589. if ($right(%gq,1) isin -) { var %gq = $left(%gq,-1) }
  1590. if ($thget(temp.bonus) == S) { %gq = $scramble(%gq) }
  1591. if ($thget(temp.bonus) == R) { %gq = $reverse(%gq) }
  1592. if ($thget(temp.bonus) == G) { %gq = $scatter(75,%gq) }
  1593. return %gq $+ $iif(%aqm,?)
  1594. }
  1595. alias -l get.banlist {
  1596. var %i = 1, %b.temp
  1597. while ($getset(banned,%i)) {
  1598. var %b.temp = %b.temp $getset(banned,%i)
  1599. inc %i
  1600. }
  1601. return %b.temp
  1602. }
  1603. alias -l get.roundscores {
  1604. if ($window(@round $+ $idenn)) { window -c @round $+ $idenn }
  1605. window -hn @round $+ $idenn
  1606. .timer 1 0 window -c @round $+ $idenn
  1607. var %i = 1
  1608. while ($hmatch(Trivia $+ $idenn, Score.*, %i)) {
  1609. var %j = $line(@round $+ $idenn,0)
  1610. while (( $hget(Trivia $+ $idenn, $hmatch(Trivia $+ $idenn, Score.*, %i)) > $thget(Score. $+ $line(@round $+ $idenn, %j))) && (%j >= 1)) { dec %j }
  1611. iline @round $+ $idenn $calc(%j + 1) $remove($hmatch(Trivia $+ $idenn, Score.*, %i),Score.)
  1612. inc %i
  1613. }
  1614. var %roundscores
  1615. %i = 1
  1616. while (%i <= 15) {
  1617. %roundscores = %roundscores $iif($line(@round $+ $idenn,%i),$line(@round $+ $idenn,%i) $+ - $+ $thget(Score. $+ $line(@round $+ $idenn,%i)))
  1618. inc %i
  1619. }
  1620. return %roundscores
  1621. }
  1622. alias sortroundscores {
  1623. var %j = 1
  1624. while (%j <= $line(@round $+ $idenn,0)) {
  1625. var %k = %j
  1626. while (%k <= $line(@round $+ $idenn,0)) {
  1627. if ($thget(Score. $+ $line(@round $+ $idenn, %j)) > $thget(Score. $+ $line(@round $+ $idenn, %k))) {
  1628. var %temp.name = $line(@round $+ $idenn, %j)
  1629. rline @round $+ $idenn %j $line(@round $+ $idenn, %k)
  1630. rline @round $+ $idenn %j %temp.name
  1631. }
  1632. inc %k
  1633. }
  1634. inc %j
  1635. }
  1636. }
  1637. alias get.showteams {
  1638. var %i = 1
  1639. while ($hmatch(Trivia $+ $idenn, Team.*, %i)) {
  1640. if ($isteam($remove($hmatch(Trivia $+ $idenn, Team.*, %i),Team.)) == $1) { var %temp.team = %temp.team $remove($hmatch(Trivia $+ $idenn, Team.*, %i),Team.) }
  1641. inc %i
  1642. }
  1643. return %temp.team
  1644. }
  1645. alias -l get.champ {
  1646. if (($setini(Champ,0) <= 0) || (!$getset(status,champ))) { return }
  1647. var %temp.champ, %i = $calc($ini($trivini, Champ, 0) - 1)
  1648. while ((%i >= 1) && (!$1)) {
  1649. var %temp.champ = %temp.champ $getset(Champ, %i)
  1650. dec %i
  1651. }
  1652. return %temp.champ
  1653. }
  1654. alias -l get.multianswers {
  1655. var %i 2, %answers.t
  1656. if ($window(@multianswer)) { window -c @multianswer }
  1657. window -h @multianswer
  1658. .timer 1 0 window -c @multianswer
  1659. while ($tok(%i)) {
  1660. aline @multianswer $tok(%i)
  1661. inc %i
  1662. }
  1663. filter -wwct 1 13 @multianswer @multianswer *
  1664. var %i 2
  1665. var %answers.t $line(@multianswer,1)
  1666. while ($line(@multianswer, %i)) { var %answers.t = %answers.t $+ , $line(@multianswer, %i), %i = $calc(%i + 1) }
  1667. return %answers.t
  1668. }
  1669. alias -l get.themes {
  1670. var %i = 1
  1671. while ($getset(triviamode $+ %i, name)) {
  1672. var %temp.themes = %temp.themes $getset(triviamode $+ %i, name)
  1673. inc %i
  1674. }
  1675. return $e1(%temp.themes)
  1676. }
  1677. alias -l get.onjoin {
  1678. return %c2 $+ $replace($1-,$chr(35),$+(%c2o,%c1,$chan,%c1o,%c2),*, $+(%c2o,%c1,$getmrank($nick) $nick,%c1o,%c2),@, $+(%c2o,%c1,$tranord($getrank($nick,$unit.default)),%c1o,%c2),^, $+(%c2o,%c1,$ifd($getvar($nick,score),0),%c1o,%c2)) $+ %c2o
  1679. }
  1680. alias -l get.picklist {
  1681. if ($tokq <= 2) return $tok(2)
  1682. var %i = 2, %picklist
  1683. while (%i <= $tokq) {
  1684. %picklist = %picklist $tok(%i)
  1685. if (%i < $calc($tokq - 1)) { %picklist = %picklist $+ $chr(44) }
  1686. if (%i == $calc($tokq - 1)) { %picklist = %picklist $trivtran(and) }
  1687. inc %i
  1688. }
  1689. return %picklist
  1690.  
  1691. }
  1692.  
  1693. alias bgcolor { return #000000 }
  1694. alias textcolor { return #339933 }
  1695. alias linkcolor { return #33FF00 }
  1696. alias alinkcolor { return #666600 }
  1697. alias vlinkcolor { return #666666 }
  1698.  
  1699. alias htmlbuild {
  1700. var %start.ticks = $ticks
  1701. set %htmlfile " $+ $mircdir $+ \ $+ $ifd($getset(build,genname),triv.htm) $+ "
  1702. sort score $unit.default
  1703. if ($exists(%htmlfile)) { .remove %htmlfile }
  1704. write %htmlfile <HTML><head><title> $+ $iden $iif($network,$trivtran(Trivia Scores on) $network) $+ </title></head>
  1705. write %htmlfile <body bgcolor=" $+ $bgcolor $+ " text=" $+ $textcolor $+ " link=" $+ $linkcolor $+ " alink=" $+ $alinkcolor $+ " vlink=" $+ $vlinkcolor $+ ">
  1706. write %htmlfile $trivtran(The scores file was compiled by:) $strip($msg.trivia.version) <br>
  1707. write %htmlfile $trivtran(This file was created on:) $time $chkadate($date) <br>
  1708. write %htmlfile <table BORDER COLS=5 WIDTH="80%" ><tr><tr>
  1709. write %htmlfile <th> $+ $trivtran(Ranking) $+ </th><th> $+ $trivtran(Name) $+ </th> $+ $iif(!$getset(hide,score),<th> $+ $trivtran(Score) $+ </th>) $+ $iif(!$getset(hide,time),<th> $+ $trivtran(Best Time) $+ </th>) $+ $iif(!$getset(hide,streak),<th> $+ $trivtran(Best Streak) $+ </th>) $+ $iif(!$getset(hide,wpm),<th> $+ $trivtran(Best WPM) $+ </th>) $+ </tr>
  1710. var %i = 1, %j = $hof.size
  1711. if ($getset(build,top) isnum 1 - %j) { %j = $getset(build,top) }
  1712. if ($version >= 6.15) {
  1713. set %count.num.t %i
  1714. filter -wkr %i $+ - $+ %j $twin htmlprocess
  1715. unset %count.num.t
  1716. }
  1717. else {
  1718. while (%i <= %j) {
  1719. write %htmlfile <tr><th> $+ %i $+ </th><td> $+ $hof(%i,1) $+ </td> $+ $iif(!$getset(hide,score),<td> $+ $hof(%i,$gttok($unit.mark $+ score)) $+ </td>) $+ $iif(!$getset(hide,time),<td> $+ $hof(%i,$gttok($unit.mark $+ time)) $+ </td>) $+ $iif(!$getset(hide,streak),<td> $+ $hof(%i,$gttok($unit.mark $+ streak)) $+ </td>) $+ $iif(!$getset(hide,wpm),<td> $+ $hof(%i,$gttok($unit.mark $+ wpm)) $+ </td>) $+ </tr>
  1720. inc %i
  1721. }
  1722. }
  1723. write %htmlfile </table><br>
  1724. write %htmlfile $trivtran(Made with) <a href=" $+ $trivia.web $+ " "target="_top"> $+ $strip($msg.trivia.version) $+ </a><br>
  1725. echo -a $e2(Finished:) $e1(%htmlfile) $e2(is written. In) $e1($calc(($ticks - %start.ticks) / 1000)) $+ $e2(secs.)
  1726. unset %htmlfile
  1727. }
  1728. alias htmlprocess {
  1729. write %htmlfile <tr><th> $+ %count.num.t $+ </th><td> $+ $gettok($1,1,59) $+ </td> $+ $iif(!$getset(hide,score),<td> $+ $gettok($1,$gttok($unit.mark $+ score),59) $+ </td>) $+ $iif(!$getset(hide,time),<td> $+ $gettok($1,$gttok($unit.mark $+ time),59) $+ </td>) $+ $iif(!$getset(hide,streak),<td> $+ $gettok($1,$gttok($unit.mark $+ streak),59) $+ </td>) $+ $iif(!$getset(hide,wpm),<td> $+ $gettok($1,$gttok($unit.mark $+ wpm),59) $+ </td>) $+ </tr>
  1730. inc %count.num.t
  1731. }
  1732.  
  1733. alias xmlbuild {
  1734. if ($version < 6.15) {
  1735. echo -a Update to a later version of mIRC. This code will not work with versions prior to 6.15.
  1736. return
  1737. }
  1738. var %start.ticks = $ticks
  1739. set %xmlfile " $+ $mircdir $+ \ $+ triv-rss-091.xml $+ "
  1740. sort score $unit.default
  1741. if ($exists(%xmlfile)) { .remove %xmlfile }
  1742.  
  1743. write %xmlfile <?xml version="1.0" ?>
  1744. write %xmlfile <rss version="0.91">
  1745. write %xmlfile <channel>
  1746. write %xmlfile <title> $trivia.name </title>
  1747. write %xmlfile <link> $trivia.web </link>
  1748. write %xmlfile <description>Latest Scores</description>
  1749. write %xmlfile <language>en-us</language>
  1750. write %xmlfile <copyright>Copyright $asctime(yyyy) $+ </copyright>
  1751. write %xmlfile <lastBuildDate> $asctime($gmt, ddd $+ $chr(44) dd mmm yyyy HH:nn:ss) GMT </lastBuildDate>
  1752.  
  1753. var %i = 1, %j = $hof.size
  1754. if ($getset(build,top) isnum 1 - %j) { %j = $getset(build,top) }
  1755. set %count.num.t %i
  1756. filter -wkr %i $+ - $+ %j $twin xmlprocess
  1757. unset %count.num.t
  1758.  
  1759. write %xmlfile </channel>
  1760. write %xmlfile </rss>
  1761.  
  1762. echo -a $e2(Finished:) $e1(%xmlfile) $e2(is written. In) $e1($calc(($ticks - %start.ticks) / 1000)) $+ $e2(secs.)
  1763. unset %xmlfile
  1764. }
  1765. alias xmlprocess {
  1766. write %xmlfile <item>
  1767. write %xmlfile <title> $+ $gettok($1,1,59) $+ </title>
  1768. write %xmlfile <description> Score: $gettok($1,$gttok($unit.mark $+ score),59) Record Time: $gettok($1,$gttok($unit.mark $+ time),59) Streak: $gettok($1,$gttok($unit.mark $+ streak),59) WPM: $gettok($1,$gttok($unit.mark $+ wpm),59) </description>
  1769. write %xmlfile <link> $+ $trivia.web $+ </link>
  1770. write %xmlfile </item>
  1771. inc %count.num.t
  1772. }
  1773. alias xmlbuildon { setset build xml 1 }
  1774. alias xmlbuildoff { setset build xml 0 }
  1775.  
  1776. alias unit.mark { return $iif($unit.default != total,$unit.default) }
  1777. alias htmltrigger {
  1778. if ($getset(build,xml)) { xmlbuild }
  1779. if ($getset(build,generate)) { htmlbuild }
  1780. if (($getset(build,auto)) && ($exists($+(",$triv(dir),\,ftpbatch.txt,")))) { run -n ftp $+(-s:,",$triv(dir),\,ftpbatch.txt") }
  1781. if (($getset(build,copy)) && ($exists(" $+ $getset(build,from) $+ ")) && ($exists(" $+ $getset(build,to) $+ "))) { .copy -o " $+ $getset(build,from) $+ " " $+ $getset(build,to) $+ \ $+ $nopath($getset(build,from)) $+ " }
  1782. if ($getset(build,web)) { tsay $msg.features.built($getset(build,web)) }
  1783. award HTMLUpdate 0
  1784. }
  1785.  
  1786. alias find { echo $get.find($1-) }
  1787. alias add { if ($exists($qfile(1))) write $qfile(1) $1- }
  1788. alias ask {
  1789. var %asknm = 1
  1790. while ($thget(Ask $+ %asknm)) { inc %asknm }
  1791. if ($hget(Trivia $+ $idenn)) { thset Ask $+ %asknm $iif($1-,$1-,$$?="Force which question number(#) or ask what question(Question*Answer)?") }
  1792. }
  1793. alias sortfile {
  1794. var %file = " $+ $sfile($mircdir) $+ "
  1795. filter -ffct 1 13 %file %file *
  1796. }
  1797. alias killdup {
  1798. var %file = " $+ $sfile($mircdir) $+ ", %i = 0
  1799. window -hn @temp.window
  1800. window -hn @temp.windowfile
  1801. filter -fwct 1 13 %file @temp.windowfile *
  1802. while ($line(@temp.windowfile,0) >= %i) {
  1803. var %line = $line(@temp.windowfile,%i)
  1804. if (%line) { aline -n @temp.window %line }
  1805. unset %line
  1806. inc %i
  1807. }
  1808. filter -wfc @temp.window %file *
  1809. window -c @temp.window
  1810. window -c @temp.windowfile
  1811. }
  1812. alias killfixdup {
  1813. var %file = $sfile($mircdir), %i = 0, %fixed = 0
  1814. window -hn @temp.windowfix
  1815. window -hn @temp.windowfile
  1816. .timer 1 0 window -c @temp.windowfix
  1817. .timer 1 0 window -c @temp.windowfile
  1818. filter -fwct 1 13 " $+ %file $+ " @temp.windowfile *
  1819. while ($line(@temp.windowfile,0) >= %i) {
  1820. if ($line(@temp.windowfile,%i)) {
  1821. aline -n @temp.windowfix $fix($line(@temp.windowfile,%i))
  1822. if (%fixed != $line(@temp.windowfix,0)) { write $nopath(%file) $+ .fix $line(@temp.windowfile,%i) }
  1823. var %fixed = $line(@temp.windowfix,0)
  1824. }
  1825. inc %i
  1826. }
  1827. echo -s Killed dups, saved as %file $+ .fix $+ !
  1828. }
  1829. alias reformfile {
  1830. if (!$exists($1)) { echo File not found. | return }
  1831. var %i = 1, %replace, %matchez = 0
  1832. while (%i <= $lines($1)) {
  1833. if ($regsub($read($1,%i),$2, $3, %replace)) { write $1 $+ .ref %replace | inc %matchez }
  1834. inc %i
  1835. }
  1836. echo Done, %matchez lines replaced, saved as $1 $+ .ref
  1837. }
  1838. alias tpurge {
  1839. var %i = 1
  1840. sort score
  1841. while ($hof(%i,1)) {
  1842. if ($hof(%i,2) <= $$1) { copyentry $$scoresfil $$tempfil $hof(%i,1) }
  1843. inc %i
  1844. }
  1845. }
  1846. alias tdpurge {
  1847. var %i = 1
  1848. sort score
  1849. while ($hof(%i,1)) {
  1850. if ($round($calc(($ctime($date) - $ctime($hof(%i,6)))/86400),0) > $$1) { copyentry $$scoresfil $$tempfil $hof(%i,1) }
  1851. inc %i
  1852. }
  1853. }
  1854. alias copyentry {
  1855. if (!$exists($1)) { echo -a $1 does not exist. | return }
  1856. if (!$exists($2)) { echo -a $2 does not exist. | return }
  1857. write $2 $$read($1, w, $3 $+ ;*)
  1858. write -dl $+ $$readn $1
  1859. }
  1860. alias debackburn { mergefiles $tempfil $scoresfil }
  1861. alias mergefiles {
  1862. echo Merging files $1 and $2
  1863. if (!$exists($1)) { echo -a $1 does not exist. | return }
  1864. if (!$exists($2)) { echo -a $2 does not exist. | return }
  1865. while ($lines($1) > 0) {
  1866. if ($numtok($read($1,1),$asc(;)) <= 1) { echo -a ERROR, file does not appear to be standard format. | return }
  1867. var %player = $gettok($read($1,1),1,$asc(;))
  1868. mergeentry $1 $2 %player
  1869. }
  1870. }
  1871. alias mergeentry {
  1872. if (!$exists($1)) { echo -a $1 does not exist. | return }
  1873. if (!$exists($2)) { echo -a $2 does not exist. | return }
  1874. var %merger = $read($1, wnt, $3 $+ ;*)
  1875. var %other = $read($2, wnt, $3 $+ ;*)
  1876. var %merger.line = $readn
  1877. if (%merger) {
  1878. if (%other) {
  1879. write $2 PlayerMoving= $+ %merger
  1880. write -d1 $+ %merger.line $1
  1881. tmergeplayers PlayerMoving= $+ $3 $3
  1882. }
  1883. else copyentry $1 $2 $3
  1884. }
  1885. }
  1886. alias tfind {
  1887. if ($exists($scoresfil)) {
  1888. echo -a Finding Duplicate Entries
  1889. window -h $twin
  1890. filter -fwc $scoresfil $twin
  1891. var %k = $line($twin,0)
  1892. while (%k > 0) {
  1893. %hostname = $replace($mask($gettok($line($twin,%k), $gttok(address), 59),2),.,\.,*,.*)
  1894. if (%hostname) {
  1895. var %j = 1
  1896. var %fline = $fline($twin,$str([^;]*;,7) $+ %hostname $+ ;.*,1,2)
  1897. while (%fline) {
  1898. if (%j == 2) {
  1899. echo -a Multiple references:
  1900. echo -a ... $gettok($line($twin,%prev.fline),1,59) ... $gettok($line($twin,%prev.fline),$gttok(address),59)
  1901. }
  1902. if (%j >= 2) {
  1903. echo -a ... $gettok($line($twin,%fline),1,59) ... $gettok($line($twin,%fline),$gttok(address),59)
  1904. dline $twin %prev.fline
  1905. }
  1906. inc %j
  1907. var %prev.fline = %fline
  1908. var %fline = $fline($twin,$str([^;]*;,7) $+ %hostname $+ ;.*,2,2)
  1909. }
  1910. }
  1911. dec %k
  1912. }
  1913. }
  1914. echo -a To combine entries use: /tmerge <from-nick> <to-nick>
  1915. window -c $twin
  1916. }
  1917. alias tmerge {
  1918. tmergeplayers $1 $2
  1919. tsay $msg.trivia.stats($2)
  1920. }
  1921. alias tmergeplayers {
  1922. if (($$getvar($$1,score)) && ($$getvar($$2,score))) {
  1923. var %i = $numtok($unit.tokens, $asc(.))
  1924. while (%i > 0) {
  1925. var %unit = $gettok($unit.tokens, %i, $asc(.))
  1926. if ($getvar($1, %unit) == $eval($ $+ get. $+ %unit,2)) {
  1927. if ($getvar($2, %unit) == $eval($ $+ get. $+ %unit,2)) {
  1928. setvar $2 %unit $+ score $calc($getvar($2,%unit $+ score) + $getvar($1,%unit $+ score))
  1929. if ($getvar($1, %unit $+ WPM) > $getvar($2,%unit $+ WPM)) { setvar $2 %unit $+ WPM $getvar($1, %unit $+ WPM) }
  1930. if ($getvar($1, %unit $+ streak) > $getvar($2,%unit $+ streak)) { setvar $2 %unit $+ streak $getvar($1, %unit $+ streak) }
  1931. if ($getvar($1, %unit $+ time) < $getvar($2,%unit $+ time)) { setvar $2 %unit $+ time $getvar($1, %unit $+ time) }
  1932. }
  1933. else {
  1934. setvar $2 %unit $+ score $getvar(%unit $+ score)
  1935. setvar $2 %unit $+ WPM $getvar(%unit $+ WPM)
  1936. setvar $2 %unit $+ streak $getvar(%unit $+ streak)
  1937. setvar $2 %unit $+ time $getvar(%unit $+ time)
  1938. }
  1939. }
  1940. dec %i
  1941. }
  1942. setvar $2 score $calc($getvar($2,score) + $getvar($1,score))
  1943. if ($getvar($1, wpm) > $getvar($2,wpm)) { setvar $2 wpm $getvar($1, wpm) }
  1944. if ($getvar($1, streak) > $getvar($2,streak)) { setvar $2 streak $getvar($1, streak) }
  1945. if ($getvar($1, time) < $getvar($2,time)) { setvar $2 time $getvar($1, time) }
  1946. setvar $2 admin $or($getvar($1,admin),$getvar($2,admin))
  1947. deleteplayer $1
  1948. }
  1949. }
  1950. alias trename {
  1951. setvar $1 name $2
  1952. tsay $msg.trivia.stats($2)
  1953. }
  1954. alias triviad {
  1955. if (($1 >= 1) && ($2)) { .timertriviaad 0 $calc($$1 * 60) timer.ad $chan $2- }
  1956. else { .timertriviaad off }
  1957. }
  1958. alias triviad2 {
  1959. if (($1 >= 1) && ($2)) { .timertriviaad 0 $calc($$1 * 60) msg $chan $e1($2-) }
  1960. else { .timertriviaad off }
  1961. }
  1962. alias truntimes {
  1963. if (($regex($1,/\d+:\d+/)) && ($regex($2,/\d+:\d+/))) {
  1964. .timertriviarunon -o $1 1 1 tboton $1
  1965. .timertriviarunoff -o $2 1 1 tbotoff $2
  1966. }
  1967. else { .timertriviarun* off }
  1968. }
  1969. alias tboton {
  1970. .timertriviarunon -o $1 1 1 tboton $1
  1971. setset status bot 1
  1972. trivia
  1973. }
  1974. alias askrotate {
  1975. set %askcount $calc((%askcount + 1) % $numq)
  1976. ask %askcount
  1977. }
  1978. alias tbotoff {
  1979. .timertriviarunoff -o $1 1 1 tbotoff $1
  1980. if ($trivia.on) { strivia }
  1981. setset status bot 0
  1982. }
  1983. alias tempfil { return backburner.txt }
  1984. alias timer.ad { if (!$trivia.on) { msg $1 $e1($2-) } }
  1985.  
  1986. dialog trivset {
  1987. title "Trivia Settings"
  1988. size -1 -1 912 544
  1989. option pixels
  1990. tab General, 1, 4 8 896 523
  1991. box Channels, 9, 12 36 502 108, tab 1
  1992. text Delimiter, 10, 22 443 68 20, tab 1
  1993. text Add/Report, 11, 18 405 92 20, tab 1
  1994. button Add, 24, 24 204 64 20, tab 1
  1995. edit , 30, 84 113 418 22, tab 1 autohs
  1996. edit $triv(delimiter), 31, 20 463 34 24, tab 1
  1997. edit $triv(additions), 32, 112 405 86 24, tab 1 autohs
  1998. edit $triv(report), 33, 204 405 86 24, tab 1 autohs
  1999. edit $triv(dir), 35, 100 371 402 24, tab 1 autohs
  2000. text Percent Hint, 14, 532 84 68 20, tab 1
  2001. edit $triv(perchint), 99, 676 84 40 26, tab 1
  2002. text Number of hints, 15, 532 66 136 20, tab 1
  2003. edit $triv(numhint), 861, 676 58 40 26, tab 1
  2004. text Hint Reduction, 16, 536 352 108 20, tab 1
  2005. edit $triv(DPH), 863, 704 356 48 24, tab 1
  2006. text Points per answer, 17, 536 326 148 20, tab 1
  2007. edit $triv(PPQ), 65, 704 326 48 24, tab 1
  2008. list 108, 82 48 424 64, tab 1 size
  2009. button Add, 115, 18 60 58 20, tab 1
  2010. button Remove, 119, 18 88 62 20, tab 1
  2011. text Channel:, 125, 16 116 62 20, tab 1
  2012. edit , 132, 96 300 398 24, tab 1 autohs
  2013. box "Points", 133, 520 308 308 76, tab 1
  2014. box "Global", 134, 12 344 496 152, tab 1
  2015. button "Scores", 141, 36 304 56 20, tab 1
  2016. button "Define", 20, 424 440 55 21, tab 1
  2017. check "Trivia Ranks", 148, 364 416 116 24, tab 1
  2018. check Crosshatch, 47, 532 124 116 20, tab 1
  2019. text Chr, 21, 652 124 31 26, tab 1
  2020. edit , 961, 684 124 28 26, tab 1
  2021. box "Hints", 80, 524 48 304 256, tab 1
  2022. radio "Scatter", 58, 612 196 75 20, group tab 1
  2023. radio "Plot", 129, 692 196 75 20, tab 1
  2024. radio "Basic", 130, 536 196 75 20, tab 1
  2025. text $hint.example, 199, 536 172 274 20, tab 1
  2026. check "Say Hint Number", 147, 532 144 160 24, tab 1
  2027. radio "Standard", 149, 532 248 92 20, group tab 1
  2028. radio "Last Letter", 150, 624 252 100 20, tab 1
  2029. radio "Vowels", 151, 536 276 72 20, tab 1
  2030. radio "Random", 152, 624 280 88 20, tab 1
  2031. text "First Hint Type", 153, 536 224 122 20, tab 1
  2032. button "Remove", 12, 24 272 64 20, tab 1
  2033. list 34, 92 200 410 92, tab 1 sort size
  2034. box "Channel Properties", 83, 12 144 498 192, tab 1
  2035. edit $triv(translate), 131, 232 464 272 24, tab 1 autohs
  2036. button "Translation File", 136, 108 468 115 20, tab 1
  2037. button "Trivia Dir", 13, 20 376 67 17, tab 1
  2038. text "Nick", 543, 28 168 34 20, tab 1
  2039. edit "", 544, 64 168 76 25, tab 1 autohs
  2040. text "Network", 66, 160 168 70 20, tab 1
  2041. edit "", 67, 236 164 116 25, tab 1 autohs
  2042. check Auto-Hint, 41, 532 103 132 20, tab 1
  2043. tab Options, 6
  2044. text questions, 18, 72 219 80 21, tab 6
  2045. check No-activity off, 88, 20 187 140 20, tab 6
  2046. edit $triv(naoff), 89, 16 215 50 32, tab 6
  2047. text seconds, 19, 250 211 76 25, tab 6
  2048. check Hint-Pause, 96, 200 185 140 20, tab 6
  2049. edit $triv(hintpause), 97, 198 211 50 32, tab 6
  2050. check Echo Answer, 40, 20 60 140 20, tab 6
  2051. check Timeout Answer, 45, 200 106 140 20, tab 6
  2052. check Join Message, 46, 12 336 120 20, tab 6
  2053. check Traditional win, 48, 20 105 140 20, tab 6
  2054. check Auto-Start, 49, 385 60 140 20, tab 6
  2055. check Say Scramble:, 53, 202 60 140 20, tab 6
  2056. check Showteam End, 55, 200 81 140 20, tab 6
  2057. check Answer Space, 56, 384 127 140 20, tab 6
  2058. check No Mid-Match, 57, 574 160 140 20, tab 6
  2059. check Show Matched, 59, 200 131 140 20, tab 6
  2060. check Use Adate, 60, 20 82 140 20, tab 6
  2061. check No ? end, 830, 574 60 140 20, tab 6
  2062. check No Spell Correct, 817, 574 140 140 20, tab 6
  2063. check "Monday Week", 126, 384 83 140 20, tab 6
  2064. check Limit Guesses, 51, 384 166 140 20, tab 6
  2065. edit $triv(limitguess), 144, 384 191 36 32, tab 6
  2066. check Round HoF, 52, 384 105 140 20, tab 6
  2067. edit , 22, 12 368 728 89, tab 6 read multi autovs
  2068. edit $triv(onjoin), 138, 148 336 596 29, tab 6 autohs
  2069. check No Partial Match, 43, 574 180 140 20, tab 6
  2070. text "tries", 146, 420 192 58 28, tab 6
  2071. check No Decheater, 44, 574 80 140 20, tab 6
  2072. check No Color Short, 61, 574 100 140 20, tab 6
  2073. check "Score", 106, 28 292 84 20, tab 6
  2074. check "Time", 169, 120 292 80 20, tab 6
  2075. check "Streak", 171, 204 292 80 20, tab 6
  2076. check "WPM", 173, 288 292 72 20, tab 6
  2077. box "Hide Stat", 174, 12 264 368 60, tab 6
  2078. check "No Catergories", 62, 574 120 140 20, tab 6
  2079. check "Empty Off", 54, 20 127 140 20, tab 6
  2080. check "No Bonus", 50, 574 200 140 20, tab 6
  2081. check "No Q number", 63, 574 220 140 20, tab 6
  2082. box Settings, 70, 8 40 732 288, tab 6
  2083. check "Keep Ask", 156, 20 150 140 20, tab 6
  2084. check "Show Nothing", 143, 200 156 140 20, tab 6
  2085. tab Defaults, 2
  2086. box , 23, 280 63 322 80, tab 2
  2087. box , 25, 602 67 174 76, tab 2
  2088. check Colors, 116, 280 48 88 20, tab 2 push
  2089. text Primary, 110, 286 74 60 17, tab 2
  2090. text Secondary, 120, 286 110 84 21, tab 2
  2091. edit $tc(1), 121, 372 74 35 28, tab 2 read
  2092. edit $tc(2), 122, 376 110 35 28, tab 2 read
  2093. edit $tc(3), 123, 607 74 43 28, tab 2 read
  2094. edit $tc(4), 124, 607 110 43 28, tab 2 read
  2095. check B, 117, 541 74 24 24, tab 2 push
  2096. check U, 118, 568 74 24 24, tab 2 push
  2097. check B, 127, 541 110 24 24, tab 2 push
  2098. check U, 128, 568 110 20 24, tab 2 push
  2099. combo 111, 412 74 124 240, tab 2 size drop
  2100. combo 112, 412 110 124 240, tab 2 size drop
  2101. combo 113, 652 74 120 240, tab 2 size drop
  2102. combo 114, 652 110 120 240, tab 2 size drop
  2103. box Time, 26, 12 188 264 244, tab 2
  2104. text Before Start, 27, 30 208 155 25, tab 2
  2105. text Between Questions (answered), 36, 30 342 155 25, tab 2
  2106. text Given to Answer, 37, 30 234 155 25, tab 2
  2107. text Before Auto-Hint, 38, 30 288 155 25, tab 2
  2108. text (timed-out), 39, 30 369 155 25, tab 2
  2109. text Before hint allowed, 862, 30 261 155 25, tab 2
  2110. text Between Ping Delay, 167, 30 398 155 25, tab 2
  2111. text Between Auto-Hints, 177, 30 315 155 25, tab 2
  2112. edit $slag(start), 135, 192 208 65 24, tab 2
  2113. edit $slag(answered), 145, 192 346 65 24, tab 2
  2114. edit $slag(timedout), 155, 192 234 65 24, tab 2
  2115. edit $slag(hint), 165, 192 290 65 24, tab 2
  2116. edit $slag(timed), 175, 192 374 65 24, tab 2
  2117. edit $slag(hintallow), 185, 192 262 65 24, tab 2
  2118. edit $slag(ping), 195, 192 402 65 28, tab 2
  2119. edit $slag(betweenhint), 205, 192 318 65 24, tab 2
  2120. box Questions, 64, 14 40 262 144, tab 2
  2121. text Default Round, 68, 120 54 78 17, tab 2
  2122. text Champ Goal, 69, 284 380 94 21, tab 2
  2123. text Team Round, 71, 120 102 70 17, tab 2
  2124. edit $triv(default), 299, 148 74 91 24, tab 2
  2125. edit $triv(reset), 215, 384 380 79 28, tab 2
  2126. edit $triv(dteam), 217, 164 122 71 24, tab 2
  2127. button $record.type($triv(Record)), 218, 82 150 149 20, tab 2
  2128. button Themes, 700, 374 304 68 20, tab 2
  2129. radio Unlimited, 201, 24 82 96 20, tab 2
  2130. radio Team, 202, 24 104 92 20, tab 2
  2131. radio Normal, 203, 24 60 84 20, tab 2
  2132. check Disable, 816, 284 300 80 20, tab 2
  2133. box , 8, 278 284 186 56, tab 2
  2134. check "Background", 158, 600 48 92 24, tab 2 push
  2135. check Champ Mode, 42, 284 356 136 21, tab 2
  2136. box , 179, 278 344 188 68, tab 2
  2137. box Score By, 178, 280 200 184 84, tab 2
  2138. check "Change", 182, 288 224 84 20, tab 2
  2139. combo 183, 288 248 128 100, tab 2 size drop
  2140. tab Teams, 3
  2141. box Names, 72, 12 80 872 140, tab 3
  2142. text Team 1, 73, 28 112 60 20, tab 3
  2143. text Team 2, 74, 28 152 60 20, tab 3
  2144. text Team 3, 308, 396 112 60 20, disable tab 3
  2145. text Team 4, 309, 396 152 60 20, disable tab 3
  2146. box Victories, 75, 20 220 868 220, tab 3
  2147. text Tied Message, 76, 32 256 66 20, tab 3
  2148. text Team 1 Wins, 77, 32 285 66 20, tab 3
  2149. text Team 2 Wins, 78, 32 314 66 20, tab 3
  2150. text Team 3 Wins, 303, 32 343 66 20, disable tab 3
  2151. text Team 4 Wins, 304, 32 372 66 20, disable tab 3
  2152. edit $te(1), 380, 92 112 280 27, tab 3 autohs
  2153. edit $te(2), 381, 92 152 280 27, tab 3 autohs
  2154. edit $te(4), 382, 468 152 280 27, disable tab 3 autohs
  2155. edit $te(3), 383, 468 112 280 27, disable tab 3 autohs
  2156. edit $te(0).victory, 320, 96 256 770 25, tab 3 autohs
  2157. edit $te(1).victory, 321, 96 285 770 25, tab 3 autohs
  2158. edit $te(2).victory, 322, 96 314 770 25, tab 3 autohs
  2159. edit $te(3).victory, 323, 96 343 770 25, disable tab 3 autohs
  2160. edit $te(4).victory, 324, 96 372 770 25, disable tab 3 autohs
  2161. check Limit Join Period, 330, 284 52 152 27, tab 3 push
  2162. edit $te(JoinBefore), 335, 440 51 112 27, tab 3
  2163. radio 2 Teams, 28, 48 48 92 20, tab 3
  2164. radio 4 Teams, 29, 152 52 84 20, tab 3
  2165. tab Awards, 4
  2166. box Awards, 79, 14 56 872 220, tab 4
  2167. button Delete, 411, 828 236 52 20, tab 4
  2168. button Add, 412, 828 84 52 20, tab 4
  2169. list 420, 19 72 800 190, tab 4 size
  2170. text "* is winner's nick.", 81, 398 425 144 25, tab 4
  2171. text "^ is value of trigger", 82, 554 425 156 25, tab 4
  2172. check Disable, 819, 20 36 84 21, tab 4
  2173. combo 137, 94 296 144 100, tab 4 size drop
  2174. edit "", 139, 432 300 68 25, tab 4
  2175. text "Award", 140, 26 392 62 24, tab 4
  2176. edit "", 142, 92 388 712 33, tab 4 autohs
  2177. text "Trigger on", 154, 32 296 58 24, tab 4
  2178. combo 159, 314 300 108 100, tab 4 size drop
  2179. text "and", 160, 518 300 30 20, hide tab 4
  2180. edit "", 161, 556 300 68 25, hide tab 4
  2181. text "points", 162, 480 324 46 20, tab 4
  2182. text "Do Action", 163, 36 348 50 24, tab 4
  2183. text "values", 164, 264 300 42 24, tab 4
  2184. combo 166, 90 348 144 120, tab 4 size drop
  2185. tab Status, 5
  2186. text Trivia Script version:, 84, 24 48 150 20, tab 5
  2187. text $strip($msg.trivia.version), 85, 184 48 150 20, tab 5
  2188. text Trivia bot is currently:, 86, 24 70 150 20, tab 5
  2189. text $trivon, 504, 184 70 80 20, tab 5
  2190. text Current mIRC version is:, 87, 24 92 150 20, tab 5
  2191. text $version, 90, 184 92 80 20, tab 5
  2192. text Current Trivia directory exists:, 91, 24 114 150 20, tab 5
  2193. text $trivia.dir, 92, 184 114 80 20, tab 5
  2194. text Currently in Trivia Channel:, 93, 24 136 150 20, tab 5
  2195. text $trivia.chan, 94, 184 136 80 20, tab 5
  2196. text Question file in Directory:, 95, 24 158 150 20, tab 5
  2197. text $trivia.file, 98, 184 158 80 20, tab 5
  2198. text Number of questions:, 103, 24 180 150 20, tab 5
  2199. text $numl, 104, 184 180 78 20, tab 5
  2200. button Delete Scores, 515, 280 104 128 20, tab 5
  2201. button Scores, 519, 280 76 124 20, tab 5
  2202. list 601, 26 210 284 114, tab 5 sort size
  2203. button Unban, 602, 314 296 80 20, tab 5
  2204. button Ban, 603, 314 218 80 20, tab 5
  2205. list 610, 18 336 292 154, tab 5 sort size
  2206. button Add Friend, 611, 314 342 80 20, tab 5
  2207. button Remove, 612, 318 468 80 20, tab 5
  2208. tab Commands, 7
  2209. box Command Limits, 105, 288 184 300 48, tab 7
  2210. combo 806, 300 200 276 132, disable tab 7 size drop
  2211. text Command Prefix, 107, 28 456 82 20, tab 7
  2212. edit %command-prefix, 850, 112 452 88 29, tab 7
  2213. text blank = default, 109, 32 484 170 24, tab 7
  2214. button "Build HTML Options", 157, 304 476 207 25, tab 7
  2215. list 800, 20 60 256 356, tab 7 size
  2216. text "Commands", 170, 20 40 102 16, tab 7
  2217. combo 809, 300 248 276 100, disable tab 7 size drop
  2218. box "Respond Method", 168, 288 232 300 48, tab 7
  2219. check "Disable", 801, 296 80 92 24, tab 7
  2220. text "Name", 172, 292 112 42 20, tab 7
  2221. edit "", 803, 344 112 236 21, tab 7 read
  2222. edit "", 802, 288 132 296 49, tab 7 read autovs
  2223. box "Default Respond Method", 180, 284 348 304 72, tab 7
  2224. combo 181, 300 364 280 136, tab 7 size drop
  2225. box "Command Attributes", 176, 284 56 308 292, tab 7
  2226. button Cancel, 101, 618 486 52 20, cancel
  2227. button OK, 100, 673 486 52 20, ok
  2228. button Apply, 102, 560 486 48 20
  2229. link $nopath($trivia.web), 518, 560 460 160 20
  2230. }
  2231.  
  2232. on *:dialog:trivset:init:*:{
  2233. var %i = 1
  2234. while ($getset(chan, %i)) {
  2235. did -a $dname 108 $gettok($getset(chan, %i), 1, 59)
  2236. inc %i
  2237. }
  2238. if ($did(108,1)) { did -c $dname 108 1 }
  2239. var %i = $numtok($status.toks, $asc(.))
  2240. while (%i >= 1) {
  2241. if ($getset(status, $gettok($status.toks, %i, $asc(.))) == 1) { did -c $dname $calc(39 + %i) }
  2242. dec %i
  2243. }
  2244. if (!$did(58).state) {
  2245. if (!$getset(status, plot)) { did -c $dname 130 }
  2246. else { did -c $dname 129 }
  2247. }
  2248. if ($getset(trivia,ranks) == 1) { did -c $dname 148 }
  2249. if ($getset(status,naoff) == 1) { did -c $dname 88 }
  2250. if ($getset(status,hintpause) == 1) { did -c $dname 96 }
  2251. if ($getset(status,autostart) == 1) { did -c $dname 49 }
  2252. if ($getset(status,monday) == 1) { did -c $dname 126 }
  2253. if ($getset(status,noautoqm) == 1) { did -c $dname 830 }
  2254. if ($getset(status,noawards) == 1) { did -c $dname 819 }
  2255. if ($getset(status,nospellfix) == 1) { did -c $dname 817 }
  2256. if ($getset(status,sayhintnum) == 1) { did -c $dname 147 }
  2257. if ($getset(status,keepask) == 1) { did -c $dname 156 }
  2258. if ($getset(status,shownone) == 1) { did -c $dname 143 }
  2259. did -c $dname $calc(149 + $getset(trivia,firsthint))
  2260. if ($getset(hide,score) == 1) { did -c $dname 106 }
  2261. if ($getset(hide,time) == 1) { did -c $dname 169 }
  2262. if ($getset(hide,streak) == 1) { did -c $dname 171 }
  2263. if ($getset(hide,wpm) == 1) { did -c $dname 173 }
  2264. if ($getset(color,on) == 1) { did -c $dname 116 }
  2265. if ($getset(color,bon) == 1) { did -c $dname 158 }
  2266. if ($getset(color,1-bold) == 1) { did -c $dname 117 }
  2267. if ($getset(color,1-underline) == 1) { did -c $dname 118 }
  2268. if ($getset(color,2-bold) == 1) { did -c $dname 127 }
  2269. if ($getset(color,2-underline) == 1) { did -c $dname 128 }
  2270. if ($getset(trivia,odefault) == Unlimited) { did -c $dname 201 }
  2271. elseif ($getset(trivia,odefault) == Team) { did -c $dname 202 }
  2272. else { did -c $dname 203 }
  2273. if ($getset(team,Joinbeforeon) == 1) { did -c $dname 330 }
  2274. if ($getset(team,4-team) == 1) {
  2275. trivset.teams 1
  2276. did -c $dname 29
  2277. }
  2278. else { did -c $dname 28 }
  2279. var %i = 0
  2280. while (%i <= 16) {
  2281. did -a $dname 111,112,113,114 $colorcode(%i)
  2282. inc %i
  2283. }
  2284. did -a $dname 806 Default
  2285. did -a $dname 806 User
  2286. did -a $dname 806 Voice
  2287. did -a $dname 806 Half-Op
  2288. did -a $dname 806 Op
  2289. did -a $dname 806 Friend
  2290. did -a $dname 806 Nobody
  2291. did -c $dname 806 1
  2292. did -a $dname 183 Day
  2293. did -a $dname 183 Week
  2294. did -a $dname 183 Month
  2295. did -a $dname 183 Year
  2296. did -a $dname 183 Total
  2297. did -c $dname 183 $ifd($getset(status,scoreby),5)
  2298. did -a $dname 181,809 Default
  2299. did -a $dname 181,809 Notice
  2300. did -a $dname 181,809 MSG Channel
  2301. did -a $dname 181,809 MSG User
  2302. did -a $dname 181,809 Describe Channel
  2303. did -c $dname 181 $ifd($getset(status,respondlevel),1)
  2304. did -c $dname 809 1
  2305. did -c $dname 111 $calc($did(121) + 1)
  2306. did -c $dname 112 $calc($did(122) + 1)
  2307. did -c $dname 113 $calc($did(123) + 1)
  2308. did -c $dname 114 $calc($did(124) + 1)
  2309. awards.load
  2310. var %i = 1
  2311. while ($setini(banned,%i)) {
  2312. did -a $dname 601 $getset(banned,%i)
  2313. inc %i
  2314. }
  2315. did -a $dname 961 $iif($chr($triv(ch)),$chr($triv(ch)),_)
  2316. disable.load
  2317. trivia.load.friends
  2318. check.toggle.multichan
  2319. check.toggle.options
  2320. check.color.toggle
  2321. check.awards.toggle
  2322. multichan.load
  2323. }
  2324. on *:dialog:trivset:sclick:100,102:{
  2325. setset trivia delimiter $did(31)
  2326. setset trivia additions $did(32)
  2327. setset trivia report $did(33)
  2328. setset trivia dir $did(35)
  2329. setset trivia translate $did(131)
  2330. setset status plot $did(129).state
  2331. setset status naoff $did(88).state
  2332. setset status monday $did(126).state
  2333. setset status noautoqm $did(830).state
  2334. setset status noawards $did(819).state
  2335. setset status nospellfix $did(817).state
  2336. setset status sayhintnum $did(147).state
  2337. setset status keepask $did(156).state
  2338. setset status shownone $did(143).state
  2339. setset hide score $did(106).state
  2340. setset hide time $did(169).state
  2341. setset hide streak $did(171).state
  2342. setset hide wpm $did(173).state
  2343. setset trivia naoff $did(89)
  2344. setset status hintpause $did(96).state
  2345. setset trivia hintpause $did(97)
  2346. setset trivia limitguess $did(144)
  2347. setset trivia perchint $did(99)
  2348. setset trivia numhint $did(861)
  2349. setset trivia DPH $did(863)
  2350. setset trivia PPQ $did(65)
  2351. var %i = 0
  2352. while (%i < 4) {
  2353. if ($did($calc(149 + %i)).state == 1) setset trivia firsthint %i
  2354. inc %i
  2355. }
  2356. setset trivia ranks $did(148).state
  2357. setset color on $did(116).state
  2358. setset color bon $did(158).state
  2359. setset color 1-bold $did(117).state
  2360. setset color 1-underline $did(118).state
  2361. setset color 2-bold $did(127).state
  2362. setset color 2-underline $did(128).state
  2363. setset team JoinBeforeon $did(330).state
  2364. setset team Joinbefore $did(335)
  2365. setset color 1 $int($did(121))
  2366. setset color 2 $int($did(122))
  2367. setset color 3 $int($did(123))
  2368. setset color 4 $int($did(124))
  2369. varcolors
  2370. var %i = 1
  2371. while (%i <= 8) {
  2372. setset lag $gettok(start.answered.timedout.hint.timed.hintallow.ping.betweenhint, %i, $asc(.)) $int($did($calc(125 + (%i * 10))))
  2373. inc %i
  2374. }
  2375. var %i = $numtok($status.toks, $asc(.))
  2376. while (%i >= 1) {
  2377. setset status $gettok($status.toks, %i, $asc(.)) $did($calc(39 + %i)).state
  2378. dec %i
  2379. }
  2380. setset trivia onjoin $did(138)
  2381. setset trivia default $int($did(299))
  2382. setset trivia odefault
  2383. if ($did(201).state == 1) { setset trivia odefault Unlimited }
  2384. if ($did(202).state == 1) { setset trivia odefault Team }
  2385. setset trivia reset $int($did(215))
  2386. setset trivia dteam $int($did(217))
  2387. setset award
  2388. var %i = 1
  2389. while (%i <= $did(420).lines) {
  2390. setset award %i $did(420,%i)
  2391. inc %i
  2392. }
  2393. setset team 1 $did(380)
  2394. setset team 2 $did(381)
  2395. setset team 3 $did(382)
  2396. setset team 4 $did(383)
  2397. setset team 0victory $did(320)
  2398. setset team 1victory $did(321)
  2399. setset team 2victory $did(322)
  2400. setset team 3victory $did(323)
  2401. setset team 4victory $did(324)
  2402. setset team 4-team $did(29).state
  2403. var %i = 1
  2404. setset trivia ch $asc($right($did(961),1))
  2405. %command-prefix = $did(850)
  2406. disable.save
  2407. setset status respondlevel $did(181).sel
  2408. setset status scoreby $did(183).sel
  2409. }
  2410. on *:dialog:trivset:sclick:816:{
  2411. setset disable 18.disable $did($did).state
  2412. check.toggle.options
  2413. }
  2414. on *:dialog:trivset:sclick:12:{
  2415. if ((!$did(34).sel) || (!$did(108).sel)) { return }
  2416. var %todel = $did(34).sel
  2417. did -d $dname 34 %todel
  2418. did -c $dname 34 %todel
  2419. save.qs
  2420. }
  2421. on *:dialog:trivset:sclick:24:{
  2422. var %temp.file = $$sfile($iif($isdir($did(35)),$did(35),$mircdir))
  2423. did -a $dname 34 $nopath(%temp.file)
  2424. did -ra $dname 35 $nofile(%temp.file)
  2425. save.qs
  2426. }
  2427. on *:dialog:trivset:edit:30:{
  2428. var %temp.num = $did(108).sel
  2429. tchan.set $did(108).sel 1 $did(30)
  2430. did -o $dname 108 $did(108).sel $did(30)
  2431. did -c $dname 108 %temp.num
  2432. }
  2433. on *:dialog:trivset:sclick:108:{ multichan.load }
  2434. on *:dialog:trivset:sclick:115:{
  2435. var %toadd = $$?="Add what channel?"
  2436. did -a $dname 108 %toadd
  2437. chan.add %toadd
  2438. }
  2439. on *:dialog:trivset:sclick:119:{
  2440. var %todel = $did(108).sel
  2441. chan.del %todel
  2442. did -d $dname 108 %todel
  2443. did -c $dname 108 %todel
  2444. did -r $dname 30,34,132
  2445. multichan.load
  2446. check.toggle.multichan
  2447. }
  2448. on *:dialog:trivset:sclick:136:{
  2449. var %temp.file = $$sfile(" $+ $mircdir $+ \ $+ *.txt $+ ", Choose a trivia translation file.)
  2450. did -ra $dname 131 $nopath(%temp.file)
  2451. }
  2452. on *:dialog:trivset:sclick:13:{
  2453. var %temp.file = $$sdir($mircdir, Choose a trivia directory.)
  2454. echo -s .... %temp.file
  2455. did -ra $dname 35 %temp.file
  2456. }
  2457. on *:dialog:trivset:edit:132:{ tchan.set $$did(108).sel 4 $$did(132) }
  2458. on *:dialog:trivset:edit:67:{ tchan.set $$did(108).sel 2 $$did(67) }
  2459. on *:dialog:trivset:edit:544:{ tchan.set $$did(108).sel 3 $$did(544) }
  2460. on *:dialog:trivset:sclick:141:{
  2461. did -ra $dname 132 $nopath($$sfile(" $+ $mircdir $+ \ $+ *.fil $+ ",Choose a scores file.))
  2462. tchan.set $$did(108).sel 4 $did(132)
  2463. }
  2464. ;########################################################
  2465. ;# MOUSE EVENTS. #
  2466. ;########################################################
  2467. on *:dialog:trivset:mouse:40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,88,96,106,126,143,156,169,171,173,817,830:{
  2468. if (%didt == $did) { return }
  2469. if ($did == 43) { exp Forbids any partial matches, for example if the answer is "truck" and you guess "not a truck" it won't take the answer. }
  2470. if ($did == 44) { exp Disables the decheater feature, which might produce blocks between words or odd characters on some fonts. Prevents people from using some cheating scripts. }
  2471. if ($did == 50) { exp Disables bonus. For example if a question is "2004: This picture won movie of the year-" the bot would take this question to be worth 2004 points. }
  2472. if ($did == 54) { exp If the room is empty the bot turns off. }
  2473. if ($did == 61) { exp Turns off the color shortening. Color shortening is a feature which reduces the amount of text sent by optimizing the colorcodes. }
  2474. if ($did == 62) { exp Turns off categories. If categories exist in a question file #Category after a list of questions, it doesn't look for or display it. }
  2475. if ($did == 106) { exp Hide score. Refuses to indicate how many more points any person has. }
  2476. if ($did == 169) { exp Hide time. Refuses to indicate how long it took for any person to answer. }
  2477. if ($did == 171) { exp Hide streak. Refuses to indicate the current or record streak. }
  2478. if ($did == 173) { exp Hide WPM. Refuses to indicate the Words Per Minute people achieve. }
  2479. if ($did == 40) { exp Echo's the answer so that you can see it after the question is read. }
  2480. if ($did == 60) { exp Uses the American dating style for the $pre $+ stats response. MM/DD/YY rather than DD/MM/YY. }
  2481. if ($did == 63) { exp Stops showing the number before the question in the question message. }
  2482. if ($did == 48) { exp Traditional win provides more less clinical information about the correct answer. }
  2483. if ($did == 56) { exp Provides the spacing of the answer directly after the question is read. }
  2484. if ($did == 46) { exp Gives a message to each person who joins the trivia channel, providing information about the bot. * = nick, $chr(35) = channel, @ = rank, ^ = score. eg: Welcome to #, * trivia bot is active... "!trivia" to start a game. Blank uses default. }
  2485. if ($did == 53) { exp For scramble questions, this forces the standard scramble category to read Unscramble the Following. }
  2486. if ($did == 57) { exp Rather than accept answers anywhere in a response, this feature forces the bot to ignore answered contained entirely inside a response. }
  2487. if ($did == 49) { exp This feature makes the bot start up as soon as you rejoin the trivia channel. }
  2488. if ($did == 42) { exp This allows for champ mode, when a specific score is reached the game resets the score and logs the winner. }
  2489. if ($did == 58) { exp Rather than start the hint from left to right it displays random letters in the hint. }
  2490. if ($did == 41) { exp This feature automaticly displays a hint to the channel after a time specified in Defaults. }
  2491. if ($did == 45) { exp This allows people to be told the correct answer after nobody in the room answered correctly. }
  2492. if ($did == 55) { exp When a team game is ends this provides a list of players on each team. }
  2493. if ($did == 59) { exp By default the bot displays the first answer in the answer file as correct. But, with this enabled the matched answer is displayed. }
  2494. if ($did == 88) { exp After a specified number of questions, the bot will turn itself off. }
  2495. if ($did == 96) { exp After a hint is requested this feature blocks the correct answer from being accepted from that person for a given amount of time. }
  2496. if ($did == 47) { exp This allows for unfinished part of a hint to use a specific character to indicate where letters are missing. }
  2497. if ($did == 51) { exp This option limits the number of guesses to the specific value. }
  2498. if ($did == 52) { exp This option makes a round hall of fame displayed along with the win messages throughout a trivia round. }
  2499. if ($did == 156) { exp This feature retains the hash table that scores the asked questions beyond one round of trivia. Make repeats happen less often. }
  2500. if ($did == 143) { exp After a win, this feature would will turn off any acknowledgement of the answer to the room. Protect questions. }
  2501. if ($did == 126) { exp In the United States and other countries the week starts on Sunday, this is default. This feature starts the week mark a day later. }
  2502. if ($did == 817) { exp Turns off the spell correction and only allows exact answers to be accepted. }
  2503. if ($did == 830) { exp Turns off the automatic ? at the end of each question. A - at the end of the question also does this. }
  2504. set -u5 %didt $did
  2505. }
  2506. alias exp { did -ra $dname 22 $$1- }
  2507. ;########################################################
  2508. ;# Stray. #
  2509. ;########################################################
  2510. on *:dialog:trivset:sclick:20:{ if (!$dialog(trivrank)) dialog -m trivrank trivrank }
  2511. on *:dialog:trivset:sclick:28,29:{ trivset.teams $iif($did != 28,1) }
  2512. alias hint.example { return This is an example of a hint }
  2513. on *:dialog:trivset:sclick:58,129,130:{
  2514. if ($did == 58) { did -ra $dname 199 $scatter(50,$hint.example) }
  2515. else if ($did == 129) { did -ra $dname 199 $plot(50,$hint.example) }
  2516. else { did -ra $dname 199 $standard(50,$hint.example) }
  2517. }
  2518. on *:dialog:trivset:sclick:111,112,113,114:{ did -ra $dname $calc($did + 10) $calc($did($did).sel - 1) }
  2519. on *:dialog:trivset:sclick:218:{
  2520. var %record = $calc($triv(Record) + 1)
  2521. if (%record == 9) { var %record = 1 }
  2522. did -ra $dname $did $record.type(%record)
  2523. setset Trivia Record %record
  2524. }
  2525. ;########################################################
  2526. ;# Awards. #
  2527. ;########################################################
  2528. on *:dialog:trivset:sclick:412:{
  2529. did -a $dname 420 0 0 0 0 0 Award
  2530. did -c $dname 420 $did(420).lines
  2531. check.award.click
  2532. }
  2533. on *:dialog:trivset:sclick:411:{ did -d $dname 420 $$did(420,1).sel | check.awards.toggle }
  2534. on *:dialog:trivset:sclick:420:{ check.award.click }
  2535. alias check.award.click {
  2536. check.awards.toggle
  2537. tokenize 32 $$did(420).seltext
  2538. did -c $dname 137 $calc($1 + 1)
  2539. did -c $dname 159 $calc($2 + 1)
  2540. did -c $dname 166 $calc($3 + 1)
  2541. did -ra $dname 139 $4
  2542. did -ra $dname 161 $5
  2543. did -ra $dname 142 $6-
  2544. check.award.range
  2545. }
  2546. alias check.award.range {
  2547. did $iif((($did(159).seltext == Between) || ($did(159).seltext == Random)),-v,-h) $dname 160,161
  2548. }
  2549. on *:dialog:trivset:sclick:137,159,166:{ award.modified }
  2550. on *:dialog:trivset:edit:139,142,161:{ award.modified }
  2551. alias award.modified {
  2552. if (!$did(420).sel) { return }
  2553. var %t.line = $did(420).sel
  2554. did -o $dname 420 $did(420).sel $calc($did(137).sel - 1) $calc($did(159).sel - 1) $calc($did(166).sel - 1) $did(139) $did(161) $did(142)
  2555. did -c $dname 420 %t.line
  2556. check.award.range
  2557. }
  2558. ;########################################################
  2559. ;# Settings. #
  2560. ;########################################################
  2561. on *:dialog:trivset:sclick:515:{
  2562. if ($?!="Are you sure you wish to delete all scores?") {
  2563. rename $scoresfil $asctime(yymmddhhmmss) $+ .bak
  2564. trivia.flush
  2565. }
  2566. }
  2567. on *:dialog:trivset:sclick:518:{ run $trivia.web }
  2568. on *:dialog:trivset:sclick:519:{ dialog -m triviascores triviascores }
  2569. on *:dialog:trivset:sclick:602:{
  2570. tunban $did(601,1).sel
  2571. did -d $dname 601 $$did(601,1).sel
  2572. }
  2573. on *:dialog:trivset:sclick:603:{
  2574. var %ban = $$?"Enter the nick or address (nick!ident@host) of a person to ban, note wildcards are permitted."
  2575. tban %ban
  2576. did -a $dname 601 %ban
  2577. }
  2578. on *:dialog:trivset:sclick:611:{
  2579. var %friend.add = $$?"Enter the nick or address (nick!ident@host) of a friend to add, note wildcards are permitted."
  2580. did -a $dname 610 %friend.add
  2581. triviafriend.add %friend.add
  2582. }
  2583. on *:dialog:trivset:sclick:612:{
  2584. triviafriend.del $$did(610).sel
  2585. trivia.load.friends
  2586. }
  2587. on *:dialog:trivset:sclick:700:{ if (!$dialog(triviatheme)) { dialog -m triviatheme triviatheme } }
  2588. on *:dialog:trivset:sclick:157:{ if (!$dialog(trivbuild)) { dialog -m trivbuild trivbuild } }
  2589. ;########################################################
  2590. ;# Disables #
  2591. ;########################################################
  2592. on *:dialog:trivset:sclick:800:{
  2593. disable.access
  2594. disable.check.disabled
  2595. }
  2596. on *:dialog:trivset:sclick:801:{
  2597. setset disable $$did(800).sel $+ .disable $did($did).state
  2598. did -oc $dname 800 $did(800).sel $gettok($disable.tokens,$did(800).sel,$asc(;)) $iif($getset(disable,$did(800).sel $+ .disable),( $+ Disabled $+ ))
  2599. disable.check.disabled
  2600. }
  2601. on *:dialog:trivset:sclick:806:{ setset disable $$did(800).sel $+ .limitlevel $did($did).sel }
  2602. on *:dialog:trivset:sclick:809:{ setset disable $$did(800).sel $+ .respondlevel $did($did).sel }
  2603. alias disable.access {
  2604. did $iif($getset(disable,$did(800).sel $+ .disable) == 1,-c,-u) trivset 801
  2605. did -ra trivset 802 $gettok($disable.info.tokens,$did(800).sel,$asc(;))
  2606. did -ra trivset 803 $did(800).seltext
  2607. did -c trivset 806 $ifd($getset(disable,$did(800).sel $+ .limitlevel),1)
  2608. did -c trivset 809 $ifd($getset(disable,$did(800).sel $+ .respondlevel),1)
  2609. }
  2610. alias disable.check.disabled { did $iif(!$did(801).state,-e,-b) $dname 802,803,806,809 }
  2611. alias disable.save { }
  2612. alias disable.load {
  2613. did -r trivset 800
  2614. tokenize $asc(;) $disable.tokens
  2615. var %i = 1
  2616. while (%i <= $0) {
  2617. did -a trivset 800 $eval($ $+ %i,2) $iif($getset(disable,%i $+ .disable),( $+ Disabled $+ ))
  2618. inc %i
  2619. }
  2620. }
  2621. alias disable.tokens { return trivia N;trivia unlimited;trivia team;trivia team N;pause/resume;op;op unban;hof;hoftime;hofstreak;hofwpm;records;op find;op ask;next;answer;ping;themes;add/report;op ban;disable/enable;hint;vowels;last;words;repeat;op add;trivia;strivia;promotion;join message;help;join N;op team }
  2622. alias disable.info.tokens { return Start N question game;Start unlimited Game;Start team game;Start team game for N questions;pause/resume;operator commands;op unban;hall of fame;hoftime;hofstreak;hofwpm;records;op find;op ask;End current question early;Answer to last question;ping;themes;add/report;op ban;disable/enable;hint;vowels;last;words;repeat;op add;trivia;strivia;promotion;join channel message;general help and command specific help;join team command;op team <player> <#>, sets team assignment }
  2623. alias isdis {
  2624. check.respond $1
  2625. if ($getset(disable, $1 $+ .disable) == 1) { return $true }
  2626. if (($chan) && ($nick) && (!$trivia.allowed($1))) { return $true }
  2627. }
  2628. alias -l trivia.allowed {
  2629. var %level = $getset(disable,$$1 $+ .limitlevel)
  2630. if ((!%level) || (%level == 1)) {
  2631. %level = 1
  2632. if ($1 == 6) %level = 4
  2633. }
  2634. if (%level == 7) { return }
  2635. if (($is.friend) && (%level <= 6)) { return $true }
  2636. if (($nick isop $chan) && (%level <= 5)) { return $true }
  2637. if (($nick ishelp $chan) && (%level <= 4)) { return $true }
  2638. if (($nick isvoice $chan) && (%level <= 3)) { return $true }
  2639. if (($nick ison $chan) && (%level <= 2)) { return $true }
  2640. }
  2641. alias -l check.respond {
  2642. unset %respond
  2643. var %respondlevel = $getset(disable,$1 $+ .respondlevel)
  2644. if (%respondlevel == 2) set -u2 %respond .notice $nick
  2645. else if (%respondlevel == 3) set -u2 %respond msg $iden
  2646. else if (%respondlevel == 4) set -u2 %respond .msg $nick
  2647. else if (%respondlevel == 5) set -u2 %respond describe $iden
  2648. }
  2649. ;########################################################
  2650. ;# DIALOG TOGGLES #
  2651. ;########################################################
  2652. on *:dialog:trivset:sclick:158,116:{ check.color.toggle }
  2653. on *:dialog:trivset:sclick:88,96,51,47,42,330,819,148,46,182:{ check.toggle.options }
  2654. alias check.toggle.options {
  2655. did $iif($did(88).state,-e,-b) $dname 89
  2656. did $iif($did(96).state,-e,-b) $dname 97
  2657. did $iif($did(51).state,-e,-b) $dname 144
  2658. did $iif($did(47).state,-e,-b) $dname 961,21
  2659. did $iif($did(42).state,-e,-b) $dname 215
  2660. did $iif($did(330).state,-e,-b) $dname 335
  2661. did $iif(!$did(816).state,-e,-b) $dname 700
  2662. did $iif($did(148).state,-e,-b) $dname 20
  2663. did $iif($did(46).state,-e,-b) $dname 138
  2664. did $iif($did(182).state,-e,-b) $dname 183
  2665. if (($did == 819) || (!$did)) {
  2666. did $iif(!$did(819).state,-e,-b) $dname 420,411,412
  2667. did -u $dname 420
  2668. check.awards.toggle
  2669. }
  2670. }
  2671. alias check.awards.toggle { did $iif($did(420).sel,-e,-b) $dname 137,159,166,139,142,161,140,154,160,162,163,164,81,82 }
  2672. alias check.toggle.multichan { did $iif($did(108).sel,-e,-b) $dname 12,24,30,34,132,141,544,67 }
  2673. alias check.color.toggle {
  2674. did $iif($did(116).state,-e,-b) $dname 23,25,120,110,121,122,123,124,117,118,127,128,111,112,113,114
  2675. if (!$did(158).state) did -b $dname 25,123,124,113,114
  2676. }
  2677. ;########################################################
  2678. ;# TRIVIA SETUP, alias expanded. #
  2679. ;########################################################
  2680. alias save.qs {
  2681. var %i = 1
  2682. tchan.noqs $$did(108).sel
  2683. while (%i <= $did(34).lines) {
  2684. tchan.set $did(108).sel $calc(4 + %i) $did(34,%i)
  2685. inc %i
  2686. }
  2687. }
  2688. alias status.toks { return echo.autohint.champ.exactmatch.nodecheater.showanswer.onjoin.cross.tradwin.autostart.nobonus.limitguess.rrs.sayscramble.emptyoff.noshowt.answers.nomid.scatter.showmatched.adate.nocolorshort.nocat.nosaycurrent }
  2689. alias chan.add { tchan.set $calc($setini(chan,0) + 1) 1 $1- }
  2690. alias chan.set {
  2691. var %chan.num = $tfindchan($1)
  2692. if (%chan.num) { tchan.set %chan.num $2 $3- }
  2693. }
  2694. alias chan.del {
  2695. var %i = $$1, %j = $setini(chan,0)
  2696. while (%i < %j) {
  2697. setset chan %i $getset(chan,$calc(%i + 1))
  2698. inc %i
  2699. }
  2700. setset chan %j
  2701. }
  2702. alias tchan.noqs { setset chan $1 $gettok($getset(chan, $1),1-4,59) }
  2703. alias tchan.set {
  2704. if ($3- != $null) {
  2705. var %nl = $getset(chan,$1)
  2706. if (!%nl) { %nl = $1 $+ ;*;*; $+ $scoresfil $+ ; $+ questions.txt }
  2707. if ($2 > $numtok(%nl,59)) %nl = %nl $+ $str(;0,$calc($2 - $numtok(%nl,59)))
  2708. %nl = $puttok(%nl,$3-,$2,59)
  2709. setset chan $1 %nl
  2710. }
  2711. }
  2712. alias tfindchan {
  2713. var %i = 1
  2714. while ($tchan(%i)) {
  2715. if (((!$1) || ($tchan(%i) == $1)) && ((!$2) || ($tchan(%i,3) iswm $2)) && ((!$3) || ($tchan(%i,2) iswm $3))) { return %i }
  2716. inc %i
  2717. }
  2718. }
  2719. alias multichan.load {
  2720. if (!$did(108).sel) { return }
  2721. did -r $dname 34
  2722. did -ra $dname 30 $tchan($did(108).sel)
  2723. did -ra $dname 67 $ifd($tchan($did(108).sel,2),*)
  2724. did -ra $dname 544 $ifd($tchan($did(108).sel,3),*)
  2725. did -ra $dname 132 $tchan($did(108).sel,4)
  2726. var %i = 5
  2727. while ($tchan($did(108).sel, %i)) {
  2728. did -a $dname 34 $tchan($did(108).sel,%i)
  2729. inc %i
  2730. }
  2731. check.toggle.multichan
  2732. }
  2733. alias awards.load {
  2734. var %i = 1
  2735. did -r $dname 420
  2736. while ($aw(%i)) {
  2737. did -a $dname 420 $aw(%i)
  2738. inc %i
  2739. }
  2740. did -r $dname 137,159,166
  2741. %i = 1
  2742. while ($gettok($award.on.tok, %i, $asc(.))) {
  2743. did -a $dname 137 $gettok($award.on.tok, %i, $asc(.))
  2744. inc %i
  2745. }
  2746. %i = 1
  2747. while ($gettok($award.val.tok, %i, $asc(.))) {
  2748. did -a $dname 159 $gettok($award.val.tok, %i, $asc(.))
  2749. inc %i
  2750. }
  2751. %i = 1
  2752. while ($gettok($award.do.tok, %i, $asc(.))) {
  2753. did -a $dname 166 $gettok($award.do.tok, %i, $asc(.))
  2754. inc %i
  2755. }
  2756. }
  2757. alias -l record.type { return $gettok(hof.streak.time.wpm.champ.web.roundscores.records, $ifd($1, 8), $asc(.)) }
  2758. alias -l trivset.teams { did $iif($1, -e, -b) $dname 308,309,303,304,382,383,323,324 }
  2759. alias triviafriend.del {
  2760. var %i = $$1, %j = $setini(friend,0)
  2761. while (%i < %j) {
  2762. setset friend %i $getset(friend,$calc(%i + 1))
  2763. inc %i
  2764. }
  2765. setset friend %j
  2766. }
  2767. alias triviafriend.add {
  2768. var %i = 1
  2769. while ($getset(friend, %i)) { inc %i }
  2770. setset friend %i $1-
  2771. }
  2772. alias triviafriend.clear { setset friend }
  2773. alias trivia.load.friends {
  2774. did -r $dname 610
  2775. var %i = 1
  2776. while ($getset(friend, %i)) {
  2777. did -a $dname 610 $getset(friend, %i)
  2778. inc %i
  2779. }
  2780. }
  2781. ;########################################################
  2782. ;# TRIVIA RANKS DIALOG. #
  2783. ;########################################################
  2784. dialog trivrank {
  2785. title "Trivia Ranks"
  2786. size -1 -1 180 104
  2787. option dbu
  2788. list 1, 2 12 146 50, size
  2789. text "Rank Name", 11, 4 66 31 8
  2790. edit "", 2, 46 64 74 10, autohs
  2791. text "Points Required", 10, 4 76 39 8
  2792. edit "", 3, 46 76 36 10, read autohs
  2793. button "Add", 4, 150 12 21 8
  2794. button "Del", 5, 150 24 21 8
  2795. button "Ok", 999, 114 78 17 8, ok
  2796. check "Trivia Ranks", 6, 4 4 50 6
  2797. }
  2798. ;########################################################
  2799. ;# DIALOG EVENTS. #
  2800. ;########################################################
  2801. on *:dialog:trivrank:init:*:{
  2802. if ($getset(trivia,ranks) == 1) { did -c $dname 6 }
  2803. check.toggle.ranks
  2804. var %i = $setini(ranks,0), %j = 1
  2805. while (%j <= %i) {
  2806. did -a $dname 1 $setini(ranks,%j) : $getset(ranks, $setini(ranks,%j))
  2807. inc %j
  2808. }
  2809. }
  2810. on *:dialog:trivrank:sclick:1:{
  2811. did -ra $dname 3 $setini(ranks, $did(1).sel)
  2812. did -ra $dname 2 $getset(ranks, $setini(ranks, $did(1).sel))
  2813. }
  2814. on *:dialog:trivrank:edit:2:{
  2815. if (!$did(1).sel) return
  2816. setset ranks $$did(3) $$did(2)
  2817. var %p = $did(1).sel
  2818. did -o $dname 1 %p $did(3) : $did(2)
  2819. did -c $dname 1 %p
  2820. }
  2821. on *:dialog:trivrank:sclick:4:{
  2822. var %r = $$?="What is the minimum amount points for this rank?"
  2823. if ((%r !isnum) || ($getset(ranks,%r))) return
  2824. var %n = $$?="What is this rank called?"
  2825. setset ranks %r %n
  2826. did -a $dname 1 %r : %n
  2827. }
  2828. on *:dialog:trivrank:sclick:5:{
  2829. var %p = $$did(1).sel
  2830. setset ranks $$setini(ranks, %p)
  2831. did -d $dname 1 %p
  2832. did -r $dname 2,3
  2833. }
  2834. on *:dialog:trivrank:sclick:6:{
  2835. setset trivia ranks $did(6).state
  2836. check.toggle.ranks
  2837. }
  2838. alias check.toggle.ranks { did $iif($did(6).state,-e,-b) $dname 1,2,3,4,5,10,11 }
  2839. ;########################################################
  2840. ;# TRIVIA BUILD DIALOG. #
  2841. ;########################################################
  2842. dialog trivbuild {
  2843. title "Build Html"
  2844. size -1 -1 200 232
  2845. option dbu
  2846. check Run FTP Batch, 1, 8 52 50 10
  2847. edit "", 2, 10 124 86 88, autohs autovs
  2848. button Ok, 99, 172 220 23 10, ok
  2849. radio Write All Scores, 3, 80 12 50 10
  2850. radio Write Top, 4, 132 12 34 10
  2851. edit 25, 5, 168 12 20 10
  2852. box Generate Scores File, 57, 76 4 118 35
  2853. text Password, 54, 104 172 25 8
  2854. box Ftp Batch Creator, 55, 100 124 84 88
  2855. text Username, 53, 104 160 25 8
  2856. text Ftp Site, 51, 104 136 25 8
  2857. edit "", 6, 136 136 46 10, autohs
  2858. text Port, 52, 104 148 25 8
  2859. edit "", 7, 136 148 46 10, autohs
  2860. edit "", 8, 136 160 46 10, autohs
  2861. edit "", 9, 136 172 46 10,i autohs
  2862. edit "triv.htm", 11, 136 196 46 10, autohs
  2863. text Filename, 56, 104 196 23 6
  2864. text Every, 58, 8 16 17 6
  2865. edit "", 13, 28 16 22 10, autohs
  2866. text Points, 14, 52 16 17 6
  2867. button "Cancel", 12, 144 220 23 10, cancel
  2868. text "Directory", 50, 104 184 25 8
  2869. edit "", 16, 136 184 46 10
  2870. check "Announce Update", 17, 8 68 54 10
  2871. edit "", 18, 92 48 98 10, autohs
  2872. text "URL", 20, 80 48 10 7
  2873. text "Batch File", 21, 12 116 29 8
  2874. check "Generate Scores File", 15, 8 36 62 10
  2875. box "On Trigger", 10, 4 4 70 102
  2876. box "Announce Update", 19, 76 40 118 22
  2877. check "Copy File", 22, 8 84 58 10
  2878. box "Copy File", 23, 76 64 118 42
  2879. edit "", 24, 100 72 90 10, autohs
  2880. button "File", 25, 80 72 17 8
  2881. button "Dir", 26, 80 92 17 8
  2882. edit "", 27, 100 92 90 10, autohs
  2883. text "TO", 28, 124 84 9 7
  2884. box "Run FTP Batch", 29, 4 108 190 110
  2885. edit "", 30, 116 24 74 10
  2886. text "Generate File", 31, 80 24 33 8
  2887. }
  2888. ;########################################################
  2889. ;# TRIVIA BUILD EVENTS. #
  2890. ;########################################################
  2891. on *:dialog:trivbuild:sclick:1,17,22,15,4,3:{ trivbuild.toggle.check }
  2892. on *:dialog:trivbuild:edit:13:{ trivbuild.toggle.check }
  2893. on *:dialog:trivbuild:edit:6,7,8,9,16,11:{ build.generate }
  2894. on *:dialog:trivbuild:sclick:25:{ did -ra $dname 24 $$sfile($mircdir) }
  2895. on *:dialog:trivbuild:sclick:26:{ did -ra $dname 27 $$sdir($mircdir) }
  2896. alias trivbuild.toggle.check {
  2897. did -b $dname 1,17,15,22,4,3,5,30,18,24,27,6,7,8,9,16,2,11
  2898. if (!$did(13)) { return }
  2899. did -e $dname 1,17,22,15
  2900. if ($did(1).state) {
  2901. did -e $dname 2,6,7,8,9,16,11
  2902. build.generate
  2903. }
  2904. if ($did(17).state) did -e $dname 17,18
  2905. if ($did(22).state) did -e $dname 24,27
  2906. if ($did(15).state) did -e $dname 3,4,30
  2907. if ($did(4).state) did -e $dname 5
  2908. }
  2909. on *:dialog:trivbuild:init:*:{
  2910. if ($getset(build,auto)) { did -c $dname 1 }
  2911. if ($getset(build,web)) { did -c $dname 17 }
  2912. if ($getset(build,copy)) { did -c $dname 22 }
  2913. if ($getset(build,generate)) { did -c $dname 15 }
  2914. did -c $dname $iif($getset(build,top),4,3)
  2915. did -ra $dname 5 $getset(build,top)
  2916. did -ra $dname 13 $getset(build,instabuild)
  2917. did -ra $dname 18 $getset(build,web)
  2918. did -ra $dname 30 $getset(build,genname)
  2919. did -ra $dname 24 $getset(build,from)
  2920. did -ra $dname 27 $getset(build,to)
  2921. if ($getset(build,host)) { did -ra $dname 6 $getset(build,host) }
  2922. if ($getset(build,port)) { did -ra $dname 7 $getset(build,port) }
  2923. if ($getset(build,user)) { did -ra $dname 8 $getset(build,user) }
  2924. if ($getset(build,pass)) { did -ra $dname 9 $decode($getset(build,pass),m) }
  2925. if ($getset(build,dir)) { did -ra $dname 16 $getset(build,dir) }
  2926. if ($getset(build,file)) { did -ra $dname 11 $getset(build,file) }
  2927. build.generate
  2928. trivbuild.toggle.check
  2929. }
  2930. on *:dialog:trivbuild:sclick:99:{
  2931. setset build instabuild $did(13)
  2932. setset build auto $did(1).state
  2933. setset build generate $did(15).state
  2934. setset build genname $did(30)
  2935. setset build copy $did(22).state
  2936. setset build web $iif($did(17).state, $did(18))
  2937. setset build from $did(24)
  2938. setset build to $did(27)
  2939. setset build host $did(6)
  2940. setset build port $did(7)
  2941. setset build user $did(8)
  2942. setset build pass $encode($did(9),m)
  2943. setset build dir $did(16)
  2944. setset build file $did(11)
  2945. setset build top $iif($did(4).state,$did(5))
  2946. setset build html $did(11)
  2947. build.generate
  2948. if ($did(2)) { filter -ifc $dname 2 $+(",$triv(dir),\,ftpbatch.txt,") * }
  2949. }
  2950. alias build.generate {
  2951. did -r $dname 2
  2952. did -i $dname 2 $did(2).lines open
  2953. did -i $dname 2 $did(2).lines $did(6) $did(7)
  2954. did -i $dname 2 $did(2).lines $did(8)
  2955. did -i $dname 2 $did(2).lines $did(9)
  2956. if ($did(16)) { did -i $dname 2 $did(2).lines cd $did(16) }
  2957. did -i $dname 2 $did(2).lines put $shortfn($mircdir $+ $did(11))
  2958. did -i $dname 2 $did(2).lines bye
  2959. }
  2960. ;########################################################
  2961. ;# TRIVIA THEMES DIALOG. #
  2962. ;########################################################
  2963. dialog triviatheme {
  2964. title "Trivia Themes"
  2965. size -1 -1 508 340
  2966. option pixels
  2967. list 1, 22 24 376 88, sort size
  2968. button Add, 2, 410 28 50 20
  2969. button Remove, 3, 410 62 50 20
  2970. text Name:, 30, 242 142 60 16
  2971. text Points per Question:, 33, 238 224 100 16
  2972. text Hint-Point Decrease:, 34, 238 250 100 16
  2973. edit , 11, 318 142 152 20, autohs
  2974. edit , 12, 318 168 156 20, autohs
  2975. edit , 13, 350 194 40 20, autohs
  2976. edit , 14, 350 224 40 20, autohs
  2977. edit , 15, 350 250 40 20, autohs
  2978. check Team Game, 16, 402 254 72 20, push
  2979. check Limit Guesses, 17, 402 224 72 20, push
  2980. check Roundscores, 18, 402 196 72 20, push
  2981. box Lag, 35, 8 124 220 208
  2982. text Before Start, 26, 18 150 96 20
  2983. text Between Questions (Answered), 37, 18 180 96 28
  2984. text Given to Answer, 38, 18 214 96 20
  2985. text Before Auto-Hint, 39, 18 244 88 20
  2986. text Between Question (Timed Out), 40, 18 274 88 28
  2987. edit , 19, 140 150 80 20
  2988. edit , 20, 140 180 80 20
  2989. edit , 21, 140 210 80 20
  2990. edit , 22, 140 240 80 20
  2991. edit , 23, 140 274 80 20
  2992. edit , 24, 140 304 80 20
  2993. button OK, 999, 430 310 40 20, ok
  2994. text "Before hint allowed", 5, 16 308 102 16
  2995. box "Themes", 6, 8 8 480 116
  2996. box "Theme Features", 7, 232 124 256 160
  2997. button "Question File", 8, 240 168 67 17
  2998. text "Number of Questions", 4, 240 196 102 16
  2999. }
  3000. ;########################################################
  3001. ;# TRIVIA THEMES EVENTS. #
  3002. ;########################################################
  3003. on *:dialog:triviatheme:init:*:{
  3004. var %i = 1
  3005. while ($getset(triviamode $+ %i, name)) {
  3006. did -a triviatheme 1 $+($getset(triviamode $+ %i, name),;,$getset(triviamode $+ %i, file),;,$getset(triviamode $+ %i, max),;,$getset(triviamode $+ %i, PPQ),;,$getset(triviamode $+ %i, DPH),;,$getset(triviamode $+ %i, team),;,$getset(triviamode $+ %i, guess),;,$getset(triviamode $+ %i, rrs),;,$getset(triviamode $+ %i, lagstart),;,$getset(triviamode $+ %i, laganswered),;,$getset(triviamode $+ %i, lagtimedout),;,$getset(triviamode $+ %i, laghint),;,$getset(triviamode $+ %i, lagtimed),;,$getset(triviamode $+ %i, laghintallow))
  3007. inc %i
  3008. }
  3009. }
  3010. on *:dialog:triviatheme:sclick:1:{
  3011. did -ra triviatheme 11 $gettok($did(1).seltext, 1, $asc(;))
  3012. did -ra triviatheme 12 $gettok($did(1).seltext, 2, $asc(;))
  3013. did -ra triviatheme 13 $gettok($did(1).seltext, 3, $asc(;))
  3014. did -ra triviatheme 14 $gettok($did(1).seltext, 4, $asc(;))
  3015. did -ra triviatheme 15 $gettok($did(1).seltext, 5, $asc(;))
  3016. did -u triviatheme 16,17,18
  3017. if ($gettok($did(1).seltext, 6, $asc(;))) { did -c triviatheme 16 }
  3018. if ($gettok($did(1).seltext, 7, $asc(;))) { did -c triviatheme 17 }
  3019. if ($gettok($did(1).seltext, 8, $asc(;))) { did -c triviatheme 18 }
  3020. did -ra triviatheme 19 $ifd($gettok($did(1).seltext, 9, $asc(;)),$slag(start))
  3021. did -ra triviatheme 20 $ifd($gettok($did(1).seltext, 10, $asc(;)),$slag(answered))
  3022. did -ra triviatheme 21 $ifd($gettok($did(1).seltext, 11, $asc(;)),$slag(timedout))
  3023. did -ra triviatheme 22 $ifd($gettok($did(1).seltext, 12, $asc(;)),$slag(hint))
  3024. did -ra triviatheme 23 $ifd($gettok($did(1).seltext, 13, $asc(;)),$slag(timed))
  3025. did -ra triviatheme 24 $ifd($gettok($did(1).seltext, 14, $asc(;)),$slag(hintallow))
  3026. }
  3027. on *:dialog:triviatheme:sclick:2:{
  3028. did -a triviatheme 1 $+(Themename,;,questions.txt,;,10,;,1,;,0,;,0,;,0,;,0,;,$slag(start),;,$slag(answered),;,$slag(timedout),;,$slag(hint),;,$slag(timed),;,$slag(hintallow))
  3029. triviatheme.save
  3030. }
  3031. on *:dialog:triviatheme:sclick:3:{
  3032. did -d triviatheme 1 $did(1).sel
  3033. triviatheme.save
  3034. }
  3035. on *:dialog:triviatheme:sclick:8:{
  3036. did -ra $dname 12 $nopath($$sfile(" $+ $mircdir $+ *.txt $+ ",Choose a question file.))
  3037. triviatheme.update
  3038. }
  3039. on *:dialog:triviatheme:edit:11,12,13,14,15,19,20,21,22,23,24:{ triviatheme.update }
  3040. on *:dialog:triviatheme:sclick:16,17,18:{ triviatheme.update }
  3041. on *:dialog:triviatheme:sclick:999:{ triviatheme.save }
  3042. alias triviatheme.update { if ($did(1).sel) { did -oc triviatheme 1 $did(1).sel $+($did(11),;,$did(12),;,$did(13),;,$did(14),;,$did(15),;,$did(16).state,;,$did(17).state,;,$did(18).state,;,$did(19),;,$did(20),;,$did(21),;,$did(22),;,$did(23),;,$did(14)) } }
  3043. alias triviatheme.save {
  3044. var %i = 1
  3045. while ($getset(triviamode $+ %i,name)) {
  3046. setset triviamode $+ %i
  3047. inc %i
  3048. }
  3049. %i = 1
  3050. while ($did(1,%i).text) {
  3051. setset triviamode $+ %i name $gettok($did(1, %i).text,1,59)
  3052. setset triviamode $+ %i file $gettok($did(1, %i).text,2,59)
  3053. setset triviamode $+ %i max $gettok($did(1, %i).text,3,59)
  3054. setset triviamode $+ %i ppq $gettok($did(1, %i).text,4,59)
  3055. setset triviamode $+ %i dph $gettok($did(1, %i).text,5,59)
  3056. setset triviamode $+ %i team $gettok($did(1, %i).text,6,59)
  3057. setset triviamode $+ %i guess $gettok($did(1, %i).text,7,59)
  3058. setset triviamode $+ %i rrs $gettok($did(1, %i).text,8,59)
  3059. setset triviamode $+ %i lagstart $gettok($did(1, %i).text,9,59)
  3060. setset triviamode $+ %i laganswered $gettok($did(1, %i).text,10,59)
  3061. setset triviamode $+ %i lagtimedout $gettok($did(1, %i).text,11,59)
  3062. setset triviamode $+ %i laghint $gettok($did(1, %i).text,12,59)
  3063. setset triviamode $+ %i lagtimed $gettok($did(1, %i).text,13,59)
  3064. setset triviamode $+ %i laghintallow $gettok($did(1, %i).text,14,59)
  3065. inc %i
  3066. }
  3067. }
  3068. ;########################################################
  3069. ;# TRIVIA SCORES DIALOG. #
  3070. ;########################################################
  3071. dialog triviascores {
  3072. title "Trivia Scores"
  3073. size -1 -1 452 288
  3074. option pixels
  3075. list 1, 5 20 100 200, size vsbar
  3076. list 2, 115 20 75 200, size vsbar
  3077. list 3, 200 20 75 200, size vsbar
  3078. list 4, 285 20 75 200, size vsbar
  3079. list 5, 370 20 75 200, size vsbar
  3080. button Delete, 10, 5 225 75 20
  3081. button Reset Score, 11, 115 225 75 20
  3082. button Reset Streak, 12, 200 225 75 20
  3083. button Reset Time, 13, 285 225 75 20
  3084. button Reset WPM, 14, 370 225 75 20
  3085. button Name, 20, 5 5 50 15
  3086. button Score, 21, 115 5 50 15
  3087. button Streak, 22, 200 5 50 15
  3088. button Time, 23, 285 5 50 15
  3089. button WPM, 24, 370 5 50 15
  3090. button Ok, 100, 398 258 45 20, ok
  3091. }
  3092.  
  3093. on 1:dialog:triviascores:init:*: { sortscores score }
  3094. alias -l sortscores {
  3095. sort $1
  3096. loaddata.triviascores
  3097. }
  3098. alias -l loaddata.triviascores {
  3099. did -r $dname 1,2,3,4,5
  3100. var %i = 1
  3101. while ($hof(%i,1) != $null) {
  3102. did -a $dname 1 $hof(%i,1)
  3103. did -a $dname 2 $hof(%i,2)
  3104. did -a $dname 3 $hof(%i,4)
  3105. did -a $dname 4 $hof(%i,3)
  3106. did -a $dname 5 $hof(%i,5)
  3107. inc %i
  3108. }
  3109. }
  3110. on 1:dialog:triviascores:sclick:1,2,3,4,5:{ did -c $dname 1,2,3,4,5 $did($did).sel }
  3111. on 1:dialog:triviascores:sclick:20,21,22,23,24: { sortscores $gettok(name.score.streak.time.wpm, $calc($did - 19), $asc(.)) }
  3112. on 1:dialog:triviascores:sclick:10: {
  3113. deleteplayer $did(1).seltext
  3114. if ($did(1).sel) { did -d triviascores 1,2,3,4,5 $did(1).sel }
  3115. }
  3116. on 1:dialog:triviascores:sclick:11,12,13,14: {
  3117. setvar $did(1).seltext $gettok(score.streak.time.wpm, $calc($did - 10), 46) $iif($did == 13, 9999, 0)
  3118. if ($did(1).sel) { did -o triviascores $calc($did - 9) $did(1).sel 0 }
  3119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement