[aliases]
n0=op /mode # +oooooo $$1 $2-
n1=dop /mode # -oooooo $$1 $2- 
n2=deop /mode # -oooooo $$1 $2-
n3=v /mode # +vvvvvv $$1 $2-
n4=dv /mode # -vvvvvv $$1 $2-
n5=voc /mode # +vvvvvv $$1 $2-
n6=devoc /mode # -vvvvvv $$1 $2-
n7=j /join #$$1 $2-
n8=p /part #
n9=w /whois $$1 $$1
n10=k { if ( $2 == $null ) { set %kick.msg $read text.files/kicks.ran |  /kick # $$1 %kick.msg | halt } | { /kick # $$1 $2- } }
n11=ping /ctcp $$1 ping
n12=mod /mode # $$1
n13=
n14=randnick {
n15=  inc -u10 %neednick
n16=  if (%neednick >= 2) { var %altnick = trivvy [ $+ [ $rand(1,1000) ] ]
n17=  tnick %altnick } 
n18=}
n19=
n20=amiopped { if ( $getread(-s,qset,selfop) == on  &&  $me == %botnick  && $me !isop %trivchan  &&  $getread(-s,qset,services) == on ) { .opmenow } }
n21=
n22=closediag  { /remove ini/haveused.ini | .dialog -k lstfiles }
n23=
n24=serv.routine {
n25=  if %checknick == $null { /timerchecknick 1 10 .checkmynick }
n26=  if ( %op2.status == $null ) { inc -u20 %op2.status 1 | /timeralpha 1 15 { amiopped } }
n27=  inc -u60 %op.status 1
n28=}
n29=
n30=serv2.routine { if %op.status == $null {
n31=    if ( %checknick == $null ) && ( $getread(-s,qset,reclaimnick) == on ) && ( $getread(-s,qset,services) == on )  { checkmynick }
n32=    if ( $me = %botnick ) && ( $getread(-s,qset,selfop) == on ) && ( $me !isop %trivchan ) { /timergamma 1 10 opmenow }
n33=  unset %joinedchan }
n34=}
n35=
n36=opmenow { if (%net == dalnet) { .timerop 1 3 /msg %chanop %com3 %trivchan $me }
n37=else { .timerop 1 3 /msg %chanop %com3 %trivchan } }
n38=
n39=reclaimnick { 
n40=  if ( %kill.status == $null ) && ( $getread(-s,qset,reclaimnick) == on ) {
n41=    inc -u60 %kill.status 1
n42=    if ( %net == galaxy ) { .msg NS REMOVE %botnick %bpassword | halt }
n43=  /msg %nickop %com2 %botnick %bpassword }
n44=}
n45=identself { if %ident.status == $null { 
n46=    inc -u5 %ident.status 1
n47=  msg %nickop %com1 %com5 %bpassword }
n48=}
n49=checkmynick { if ( $me != %botnick ) { nick %botnick | inc -u30 %checknick 1 } }
n50=
n51=services {
n52=  if ( %botnick == $null ) { set %botnick enter`bot`nick }
n53=  if ( %bpassword == $null ) { set %bpassword enter`bot`pwd }
n54=  if ( %net == austnet ) { .rlevel service | .auser service *!*service@austnet.org | set %chanop chanop | set %nickop nickop@austnet.org | set %com1 identify | set %com2 kill | set %com3 op | set %inotice *To authenticate your identity* | set %knotice *has been killed as requested* }
n55=  if ( %net == galaxy ) { .rlevel service | .auser service *!*@galaxynet.org | set %chanop q | set %nickop NS@services.galaxynet.org | set %com1 auth | set %com3 opme | set %inotice *The nick you are using is registered* | set %knotice *You may change your nick in about 15 seconds* | set %com5 %botnick }
n56=  if ( %net == undernet ) { .rlevel service | .auser service *!*cservice@undernet.org | set %chanop x | set %nickop x@channels.undernet.org | set %com1 login | set %com3 op | set %com5 %botnick | unset %inotice | unset %knotice }
n57=  if ( %net == dalnet ) { .rlevel service | .auser service *!*service@dal.net | set %chanop chanserv@services.dal.net | set %nickop NickServ@services.dal.net | set %com1 identify | set %com2 ghost | set %com3 op | set %inotice *This nick is owned by someone else* | set %knotice *Your ghost has been successfully killed* }
n58=  if ( %net == other ) {
n59=    .rlevel service
n60=    if (%servmask != $null) { .auser service %servmask }
n61=    if (%servn1 != $null) { set %chanop %servn1 }
n62=    if (%servn2 != $null) { set %nickop %servn2 }
n63=    if (%servn3 != $null) { set %nickop2 %servn3 }
n64=    if (%command2 != $null) { set %com1 %command2 }
n65=    if (%command3 != $null) { set %com2 %command3 }
n66=    if (%command1 != $null) { set %com3 %command1 } 
n67=    if (%ivar != $null) { set %inotice %ivar }
n68=  if (%kvar != $null) { set %knotice %kvar } }
n69=  if ( %lastnet == galaxy ) || ( %lastnet == under ) { unset %com5 }
n70=  unset %lastnet
n71=}
n72=
n73=thisw {
n74=  if $getread(wins,$replace($nick,[,',],")) == $null { return 0 } 
n75=  { return $getread(wins,$replace($nick,[,',],")) }
n76=}
n77=thism {
n78=  if $getred(wins,$replace($nick,[,',],")) == $null { return 0 }  
n79=  { return $getred(wins,$replace($nick,[,',],")) }
n80=}
n81=thisd {
n82=  if $getreadd(wins,$replace($nick,[,',],")) == $null { return 0 }  
n83=  { return $getreadd(wins,$replace($nick,[,',],")) }
n84=}
n85=getus {
n86=  return $readini remote.ini $1 $2 $3  
n87=}
n88=getrad { return $readini seen/seen.ini $1 $2 $3 }
n89=getrad2 { return $readini seen/whochecked.ini $1 $2 $3 }
n90=
n91=getrd { return $readini seen/part.ini $1 $2 $3 }
n92=
n93=floodproc {
n94=  inc -u10 %revolvetrigfld 1
n95=  if ( %revolvetrigfld >= 10 ) { halt } 
n96=  inc -u $+ $2  % $+ $1 $+ . [ $+ [ $site ] ]
n97=  if ( %abuse. [ $+ [ $site ] ] == 2 ) && ( % [ $+ [ $1 $+ . [ $+ [ $site ] ] ] ] > 2 ) { kick $chan $nick 4[Auto-Kick4] $1 Trigger Flood Protection - Repeat flooders earn a ban | .mode # +b *!*@ $+ $site | .msg %trivchan 4[! $+ $1 TRIGGER FLOOD4] detected,  $nick -4 is banned from %trivchan for repeatedly flooding | halt }
n98=  if ( %abuse. [ $+ [ $site ] ] == 1 ) && ( % [ $+ [ $1 $+ . [ $+ [ $site ] ] ] ] > 2 ) { kick $chan $nick 4[Auto-Kick4] $1 Trigger Flood Protection - Please don't try to flood me! | .ignore -cpku60 *!*@ $+ $site | .msg %trivchan 4[! $+ $1 TRIGGER FLOOD4] detected,  $nick -4 will be ignored for the next 60 secs for overuse of  $+ $getread(-s,triggers, $1 ) $+  Command | inc -u300 %abuse. [ $+ [ $site ] ] | halt }
n99=  if ( % [ $+ [ $1 $+ . [ $+ [ $site ] ] ] ] > 2 )  { echo -a 4[ $+ $1 TRIGGER FLOOD4] detected from $nick $+ / $+ $site -4 60 sec. ignore | .ignore -cpku60 *!*@ $+ $site | .msg %trivchan 4[! $+ $1 TRIGGER FLOOD4] detected,  $nick -4 will be ignored for the next 60 secs for overuse of  $+ $getread(-s,triggers, $1 ) $+  Command | inc -u300 %abuse. [ $+ [ $site ] ] | halt }
n100=}
n101=
n102=resettop10v {
n103=  set %top1score 0 | set %top1winr *
n104=  set %top2score 0 | set %top2winr *
n105=  set %top3score 0 | set %top3winr *
n106=  set %top4score 0 | set %top4winr *
n107=  set %top5score 0 | set %top5winr *
n108=  set %top6score 0 | set %top6winr *
n109=  set %top7score 0 | set %top7winr *
n110=  set %top8score 0 | set %top8winr *
n111=  set %top9score 0 | set %top9winr *
n112=  set %top10score 0 | set %top10winr *
n113=  if ($getread(-s,miscop,trivia.channel) != $null) && ($me ison $getread(-s,miscop,trivia.channel)) { msg $getread(-s,miscop,trivia.channel)  4Cleared Top Ten Variables }
n114=}
n115=
n116=resetjack {
n117=  set %topjp1score 0 | set %topjp1winr *
n118=  set %topjp2score 0 | set %topjp2winr *
n119=  set %topjp3score 0 | set %topjp3winr *
n120=  set %topjp4score  0 | set %topjp4winr *
n121=  set %topjp5score 0 | set %topjp5winr *
n122=  set %topjp6score 0 | set %topjp6winr *
n123=  set %topjp7score  0 | set %topjp7winr *
n124=  set %topjp8score  0 | set %topjp8winr *
n125=  set %topjp9score 0 | set %topjp9winr *
n126=  set %topjp10score  0 | set %topjp10winr *
n127=}
n128=
n129=resettopmonthv  {
n130=  set %tp1score 0 | set %tp1winr * 
n131=  set %tp2score 0 | set %tp2winr *
n132=  set %tp3score 0 | set %tp3winr *
n133=  set %tp4score 0 | set %tp4winr *
n134=  set %tp5score 0 | set %tp5winr *
n135=  set %tp6score 0 | set %tp6winr *
n136=  set %tp7score 0 | set %tp7winr *
n137=  set %tp8score 0 | set %tp8winr *
n138=  set %tp9score 0 | set %tp9winr *
n139=  set %tp10score 0 | set %tp10winr *
n140=  if ($getread(miscop,trivia.channel) != $null) && ($me ison $getread(miscop,trivia.channel)) { msg $getread(-s,miscop,trivia.channel)  4Cleared Top Ten MONTHLY Variables }
n141=}
n142=
n143=resetwkmth {
n144=  set %last1winr * | set %last1score 0
n145=  set %last2winr * | set %last2score 0
n146=  set %last3winr * | set %last3score 0
n147=  set %last4winr * | set %last4score 0
n148=  set %last5winr * | set %last5score 0
n149=  set %lst1winr *  | set %lst1score 0
n150=  set %lst2winr *  | set %lst2score 0
n151=  set %lst3winr *  | set %lst3score 0
n152=  set %lst4winr *  | set %lst4score 0
n153=  set %lst5winr *  | set %lst5score 0
n154=}
n155=
n156=resettopdaily  {
n157=  set %d1scr 0 | set %d1winr * 
n158=  set %d2scr 0 | set %d2winr * 
n159=  set %d3scr 0 | set %d3winr * 
n160=  set %d4scr 0 | set %d4winr * 
n161=  set %d5scr 0 | set %d5winr * 
n162=  set %d6scr 0 | set %d6winr * 
n163=  set %d7scr 0 | set %d7winr * 
n164=}
n165=
n166=arg return $gettok($1,$2,$asc($3))
n167=
n168=ateballreply {
n169=  if ($1 == -pa) {
n170=    if ($replace($2-,$chr(32),$chr(160)) == $arg(%trivq,2,*) || $replace($2-,$chr(32),$chr(160))) == $arg(%trivq,3,*)) { return Yes } | else { return No }
n171=  }
n172=  else {
n173=    var %8ballrnd = $rand(1,10)
n174=    if (%8ballrnd == 1) { return Ja } | if (%8ballrnd == 2) { return Nee }
n175=    if (%8ballrnd == 3) { return Misschien wel misschien niet } | if (%8ballrnd == 4) { return De toekomst ziet er niet goed uit }
n176=    if (%8ballrnd == 5) { return Ben je Gek?! } | if (%8ballrnd == 6) { return Vraag mij dat nog eens als $nick($chan,$rand(1,$nick($chan,0))) niet in de buurt is :) }
n177=    if (%8ballrnd == 7) { return Ik dacht het niet } | if (%8ballrnd == 8) { return De toekomst zal het uitwijzen }
n178=    if (%8ballrnd == 9) { return Dat wil je niet weten } | if (%8ballrnd == 10) { return Voor u een vraag voor mij een weet }
n179=  }
n180=}
n181=
n182=check.qlstf {
n183=  if ($getread(-s,lstfiles,ask) == 1) { halt }
n184=  unset %cttf
n185=  if ($findfile($mircdirlst,*.lst,0) > 1) {
n186=    dialog -m lstfiles lstfiles
n187=    :fetch
n188=    inc %cttf
n189=    did -a lstfiles 2 $nopath($findfile($mircdirlst,*.lst,%cttf))
n190=    if (%cttf == $findfile($mircdirlst,*.lst,0)) { halt } | else { goto fetch }
n191=  }
n192=  if ($findfile($mircdirlst,*.lst,0) == 1) { dowrite -s lstfiles file $nopath($findfile($mircdirlst,*.lst,1)) }
n193=  echo -a Using question file $nopath($findfile($mircdirlst,*.lst,1))
n194=}
n195=
n196=docheck {
n197=  if ($1 == -sct) { if (%trivia.status.cur != 1 && $getread(-s,miscop,noton.msg) == on) { dospam } } 
n198=  if ($1 == -adis) { if ($getread(-s,miscop,adis) == on && $me ison $getread(-s,miscop,trivia.channel) && $nick($getread(-s,miscop,trivia.channel),0) == 1) { echo -a Trivia Halted - $getread(-s,miscop,trivia.channel) is empty of players | strivia } }
n199=  if ($1 == -reclaimnick) { if ($getread(-s,qset,reclaimnick) == on && $getread(-s,qset,services) == on) { checkmynick } }
n200=  if ($1 == -amiopped) { if ($getread(-s,qset,selfop) == on && $getread(-s,qset,services) == on) { amiopped } }
n201=  if ($1 == -resetscore) { if (%autorest == on) { checkauto } }
n202=  if ($1 == -identify) { if ($getread(-s,qset,timedident) == on) { identself } }
n203=}
n204=
n205=dospam { 
n206=  %lastad2 = %lastad 
n207=  %lastad = %trivia.noton.msg
n208=  :spam
n209=  set %trivia.noton.msg $read text.files\ [ $+ [ $getread(-s,miscop,ad.file) ] ]
n210=  if (%trivia.noton.msg == %lastad || %trivia.noton.msg == %lastad2) { goto spam }
n211=  msg $getread(-s,miscop,trivia.channel) %rclm %trivia.noton.msg 
n212=}
n213=
n214=dorms {
n215=  %oldgetrms = %oldgetrms2
n216=  %oldgetrms2 = %getrms
n217=  :getrms
n218=  %getrms = $rand(1,%rndmax)
n219=  if (%getrms == %oldgetrms || %getrms == %oldgetrms2) { goto getrms }
n220=  if (% [ $+ [ rnd.msg. [ $+ [ %getrms ] ] ] ] == $null) { % [ $+ [ rnd.msg. [ $+ [ %getrms ] ] ] ] = Unset Random Message %getrms }
n221=  /msg $getread(-s,miscop,trivia.channel) %rclm % [ $+ [ rnd.msg. [ $+ [ %getrms ] ] ] ] 
n222=}
n223=
n224=dotank {
n225=  if ($getread(beers,$nick) == $null) { dowrite beer $replace($nick,[,',],") 0 }
n226=  var %s.beer = $getread(beers,$replace($nick,[,',],"))
n227=  inc %s.beer 1
n228=  dowrite beer $replace($nick,[,',],") %s.beer
n229=  describe $getread(-s,miscop,trivia.channel) pours $nick an Ice Cold Beer
n230=  :end
n231=}
n232=
n233=genfileview {
n234=  if ($1 == fixnull) {
n235=    unset %cttf
n236=    :fetch
n237=    inc %cttf
n238=    did -a fixnull 3 $nopath($findfile($mircdirlst,*.lst,%cttf))
n239=    if (%cttf == $findfile($mircdirlst,*.lst,0)) { halt } | else { goto fetch }
n240=    halt
n241=  }
n242=  unset %cttf
n243=  :fetch
n244=  inc %cttf
n245=  did -a lstfiles 2 $nopath($findfile($mircdirlst,*.lst,%cttf))
n246=  if (%cttf == $findfile($mircdirlst,*.lst,0)) { halt } | else { goto fetch }
n247=}
n248=
n249=getwinline {
n250=  %oldgetrm2 = %oldgetrm
n251=  %oldgetrm = %getrm
n252=  :getrm
n253=  %getrm = $read text.files\rm.ran
n254=  if (%getrm == %oldgetrm || %getrm == %oldgetrm2) { goto getrm }
n255=  %thisrm = $replace(%getrm,&nick,%clqa $+ $1 $+ %clqb,&answer,%clqa $+ " $+ $4 $+ " $+ %clqb,&points,%clqa $+ $chr(160) $+ $2 $+ $chr(160) $+ %clqb,&time,%clqa $+ $chr(160) $+ $3 $+ %clqb)
n256=  ;  %thisrm = $replace($replace($replace(%getrm,&nick,$1),&answer,$2),&points,$3)
n257=  return %clqb %thisrm
n258=}
n259=
n260=hasbeenask return $readini $n.file(-a) $1 $2
n261=haveused return $readini ini\haveused.ini files $1
n262=
n263=loadinfo {
n264=  var %cmdlist = start&stop&hint&hint2&pingme&repeat&server&row&fast&wins&won&help&seen&skip&answer&top10&topmonth&8ball&status&beer&credits&hint2resultcount&hint2result
n265=  if ($1 == lstfiles) {
n266=  if ($getread(-s,lstfiles,ask) == 1) { did -c lstfiles 4 } | if ($getread(-s,lstfiles,file) == mix) { did -c lstfiles 5 } }
n267=  if ($1 == miscop) {
n268=    did -o miscop 15 1 $getread(-s,miscop,wins.beer) | did -o miscop 17 1 $getread(-s,miscop,credits.ea)
n269=    did -o miscop 18 1 $getread(-s,miscop,wins.voice) | did -o miscop 16 1 $getread(-s,miscop,beer.tank)
n270=    did -o miscop 20 1 $getread(-s,miscop,ad.file) | did -o miscop 19 1 $getread(-s,miscop,time.remind)
n271=    var %qsttmsv = 1
n272=    :next3
n273=    if ($getread(-s,miscop,$gettok($getread(-s,tokenz,qsttms),%qsttmsv,38)) == on) { did -c miscop $calc($calc(%qsttmsv * 2) + 19) } | else { did -c miscop $calc($calc(%qsttmsv * 2) + 20) }
n274=    inc %qsttmsv 1
n275=    if (%qsttmsv == 9) goto end3
n276=    goto next3
n277=    :end3
n278=  }
n279=  if ($1 == commands) {
n280=    var %comnum 1
n281=    :next8
n282=    did -a commands %comnum $getread(-s,triggers,$gettok( %cmdlist,%comnum,38) )
n283=    inc %comnum 1
n284=    if ( %comnum == 23 ) { goto end10 }
n285=    goto next8
n286=    :end10 
n287=    if ($getread(-s,triggers,hint2result) == letters) { did -c commands 23 } | else { did -c commands 24 }
n288=  }
n289=  if ($1 == fixnull) {
n290=    did -b fixnull 4
n291=  }
n292=  if ($1 == rndmsg) {
n293=    if (%onwin == $null) { set %onwin 5 }
n294=    if (%onmin == $null) { set %onmin 5 }
n295=    if (%rndset == $null) { set %rndset 0 }
n296=    if (%rndmax == $null) { set %rndmax 5 }
n297=    if (%dorms == $null) { set %dorms onwin }
n298=    var %rndmsgv = 1
n299=    :next
n300=    did -a rndmsg $calc(%rndmsgv + 7) %rnd.msg. [ $+ [ $calc(%rndmsgv + %rndset) ] ] | did -a rndmsg $calc(%rndmsgv + 87) $calc(%rndmsgv + %rndset)  
n301=    inc %rndmsgv 1
n302=    if ( %rndmsgv == 6 ) { goto end }
n303=    goto next
n304=    :end 
n305=    if %dorms == onwin { did -a rndmsg 4 %onwin | did -a rndmsg 50 wins | did -c rndmsg 6 } |   if %dorms == onmin { did -a rndmsg 4 %onmin | did -a rndmsg 50 minutes | did -c rndmsg 7 } 
n306=    if ( %rndmsg == on ) { did -c rndmsg 13 } 
n307=    if ( %rndmsg == off ) { did -c rndmsg 14 }
n308=    did -a rndmsg 2 %rndmax
n309=    did -a rndmsg 16 $calc(%rndset + 1) to $calc(%rndset + 5)
n310=  }
n311=
n312=  if ($1 == mtcols) || ($1 == dcols) || ($1 == wcols) || ($1 == jpcols) || ($1 == tdcols) {
n313=    if ( $istok($getread(-s,tokenz,colist), $encode( %clt [ $+ [ $2 ] ] ) ,46) == $true )  { did -c $dname $findtok($getread(-s,tokenz,colist), $encode( %clt [ $+ [ $2 ] ] ),1,46) }
n314=    if ( $istok($getread(-s,tokenz,colist), $encode( %clt [ $+ [ $2 ] $+ ] a ) ,46) == $true )  { did -c $dname $calc($findtok($getread(-s,tokenz,colist), $encode( %clt [ $+ [ $2 ] $+ ] a ) ,1,46) + 20 ) }
n315=    did -a $dname 17  %clt [ $+ [ $2 ] ]
n316=    did -a $dname 18  %clt [ $+ [ $2 ] $+ ] a
n317=
n318=  }
n319=  if ($1 == rmcols) || ($1 == mcols) {
n320=    if ( $istok($getread(-s,tokenz,messcol), $encode( % [ $+ [ $2 ] $+ ] lm ) ,46) == $true )  { did -c $dname $findtok($getread(-s,tokenz,messcol), $encode( % [ $+ [ $2 ] $+ ] lm ),1,46) }
n321=    did -a $dname 17 % [ $+ [ $2 ] $+ ] lm
n322=  }
n323=
n324=  if ( $1 == remote ) {
n325=    if (%remset == $null) { set %remset 0 }
n326=    if ( %remset == 0 ) { did -o remote 401 1 01 to 10 } | if ( %remset == 10 ) { did -o remote 401 1 11 to 20 }
n327=    if ( %remset == 20 ) { did -o remote 401 1 21 to 30 } | if ( %remset == 30 ) { did -o remote 401 1 31 to 40 }
n328=    var %remotev = 1
n329=    var %remoter = 101
n330=    var %remoter2 = 201
n331=    :next
n332=    did -u remote %remoter2 | did -u remote $calc(%remoter2 + 1)
n333=    did -a remote %remotev  $gettok($getread(-s,tokenz,remotecom),$calc(%remotev + %remset),38)
n334=    did -a remote $calc(%remotev + 10) $calc(%remotev + %remset) 
n335=    if ( $getread(-s,remote,remote [ $+ [ $calc(%remotev + %remset) ] ] ) == $null ) { dowrite -s remote remote [ $+ [ $calc(%remotev + %remset) ] ] 500 }
n336=    if ( $getread(-s,remote,remote [ $+ [ $calc(%remotev + %remset) ] ] ) == 100 ) { did -c remote %remoter } 
n337=    if ( $getread(-s,remote,remote [ $+ [ $calc(%remotev + %remset) ] ] ) == 200 ) { did -c remote $calc(%remoter + 1 ) }
n338=    if ( $getread(-s,remote,remote [ $+ [ $calc(%remotev + %remset) ] ] ) == 500 ) { did -c remote $calc(%remoter + 2 ) }  
n339=    if ( $getread(-s,remote,remcmd [ $+ [ $calc(%remotev + %remset) ] $+ ] a ) == ON ) { did -c remote %remoter2 }
n340=    if ( $getread(-s,remote,remcmd [ $+ [ $calc(%remotev + %remset) ] $+ ] b ) == ON )  { did -c remote $calc(%remoter2 + 1) } 
n341=    inc %remotev 1
n342=    inc %remoter 3
n343=    inc %remoter2 2
n344=    if ( %remotev == 11 ) { goto end }
n345=    goto next
n346=    :end 
n347=  }
n348=} 
n349=
n350=readinfo {
n351=  %read = $read -l1 $n.file(-r)
n352=  ;if ($left(%read,1) != &) { write $n.file(-r) $read -l1 $n.file(-r) | write -l1 $n.file(-r) & $+ $getread(-s,lstfiles,file) Unknown Subject*Unknown Author*Unknown Origin | %read = $read -l1 $n.file(-r) }
n353=  ;%read = $remove(%read,&)
n354=  echo -a 12- | echo -a 12 $+ $arg(%read,1,*) | echo -a 12 $+ $arg(%read,2,*) | echo -a 12 $+ $arg(%read,3,*) |  echo -a 12-
n355=}
n356=
n357=question.file {
n358=  if ($getread(-s,lstfiles,file) != mix) { return $getread(-s,lstfiles,file) | halt }
n359=  if ($calc($lines(ini\haveused.ini) - 1) == $findfile($mircdirlst,*.lst,0)) { .remove ini\haveused.ini }
n360=  :getnew
n361=  %qst.files.tor = $rand(1,$findfile($mircdirlst,*.lst,0))
n362=  if ($haveused($replace($findfile($mircdirlst,*.lst,%qst.files.tor),$chr(32),$chr(160))) == true) { goto getnew }
n363=  writeini ini\haveused.ini files $replace($findfile($mircdirlst,*.lst,%qst.files.tor),$chr(32),$chr(160)) true
n364=  return $findfile($mircdirlst,*.lst,%qst.files.tor)
n365=}
n366=
n367=scanfile {
n368=  if ($1 == -f) { set %nullfile = lst\ $+ $2 }
n369=  clear -s
n370=  echo -s Scanning $remove(%nullfile,lst\)
n371=  set %nullfile.lines $lines(%nullfile)
n372=  set %nullfile.cur 0
n373=  set %nullfile.err 0
n374=  :readline
n375=  inc %nullfile.cur
n376=  if (%nullfile.cur <= %nullfile.lines) {
n377=    if ($nullread != $null && $arg($nullread,2,*) != $null) { goto readline }
n378=    echo -s Line %nullfile.cur of %nullfile $nullread
n379=    write -dl $+ %nullfile.cur %nullfile
n380=    echo -s Fixed error on line %nullfile.cur of %nullfile
n381=    inc %nullfile.err
n382=    goto readline
n383=  }
n384=  echo -s Corrected %nullfile.err Errors
n385=}
n386=
n387=
n388=nullread return $read -l $+ %nullfile.cur $mircdir $+ %nullfile
n389=cleartopten { 
n390=  unset %top1winr | unset %top1score
n391=  unset %top2winr | unset %top2score
n392=  unset %top3winr | unset %top3score
n393=  unset %top4winr | unset %top4score
n394=  unset %top5winr | unset %top5score
n395=  unset %top6winr | unset %top6score
n396=  unset %top7winr | unset %top7score
n397=  unset %top8winr | unset %top8score
n398=  unset %top9winr | unset %top9score
n399=  unset %top10winr | unset %top10score
n400=}
n401=
n402=pre return -dl $+ %nullfile.cur
n403=
n404=start.check.timer3 { .timer402 1 10 docheck -identify }
n405=
n406=start.check.timer { 
n407=  ; .timer1 0 $getread(-s,miscop,time.remind) docheck -sct
n408=  .timer2 0 1 docheck -adis
n409=  .timer400 0 15 docheck -reclaimnick
n410=  .timer401 0 30 docheck -amiopped
n411=}
n412=
n413=start.check.timer2 { 
n414=  .timer1 0 $getread(-s,miscop,time.remind) docheck -sct
n415=  .timer400 0 15 docheck -reclaimnick
n416=  .timer401 0 30 docheck -amiopped
n417=  .timer403 0 60 docheck -resetscore
n418=}
n419=
n420=strivia {
n421=  .timers off
n422=  .unset %trivq
n423=  if ($1 == -o) { msg $getread(-s,miscop,trivia.channel) 0,1Trivia status is nu off }
n424=  if ($1 == -cc) { msg $getread(-s,miscop,trivia.channel) 0,1 Trivia gestopt door console!  }
n425=  if ($1 == -p) { msg $getread(-s,miscop,trivia.channel) 0,1 Trivia Stopped door een speler!  }
n426=  %trivia.status.cur = 0
n427=  start.check.timer2
n428=}
n429=trivia {
n430=  if ( %rndmsg == on ) && ( %dorms == onmin ) { .timer555 0 $calc(%onmin *60)  { /dorms } }
n431=  %trivia.status.cur = 1
n432=  start.check.timer
n433=  timer403 off
n434=  ;echo -a 4Reseting question numers
n435=  %num = 0
n436=  echo -a 4Starting trivia in 10 seconds
n437=  if %usercp == on { usercap }
n438=  msg $getread(-s,miscop,trivia.channel) 0,1 Trivia start in 10 seconden, Klaar??? 
n439=  .timerstarting_trivia 1 10 trivq
n440=}
n441=n.file {
n442=  if ($1 == -a) { return ask\ $+ $nopath($replace(%qst.fil,lst,ask)) }
n443=  if ($1 == -r) { return lst\ $+ $nopath($getread(-s,lstfiles,file)) }
n444=  else { return lst\ $+ $nopath(%qst.fil) }
n445=}
n446=
n447=trivq {
n448=  %qst.fil = $question.file
n449=  :getline
n450=  if ($lines($n.file(-a)) >= $lines($n.file)) { .remove $n.file(-a) }
n451=  %nxt.qst = $rand(1,$lines($n.file))
n452=  if ($hasbeenask($replace(%qst.fil,$chr(32),$chr(160)),%nxt.qst) == true) { goto getline }
n453=  writeini -n $n.file(-a) $replace(%qst.fil,$chr(32),$chr(160)) %nxt.qst true
n454=  goto jumppoint
n455=  :error
n456=  .echo -s 11,12 TrivBot Advance: An error has occurred:11,4 $error - 11,12 It may be due to Questions not being MIXED, or possibly if a question file is too large.  Visit http://trivia.mystiqal.org for help 
n457=  .reseterror
n458=  :jumppoint
n459=  %qstfle = $nopath(%qst.fil)
n460=  %tmp = $read -l $+ %nxt.qst $n.file
n461=  %trivq = $replace(%tmp,$chr(32),$chr(160))
n462=  if $len(%trivq) > 440 { goto getline }
n463=  if ($arg(%trivq,1,*) == $null || $arg(%trivq,2,*) == $null) { msg $getread(-s,miscop,trivia.channel) Even de vragen schudden! Hier komt de volgende... | .msg $me Bad Question %qstfle $+ . %nxt.qst $+ . %trivq | goto getline }
n464=  if ( %rp == 3 ) { .saveini | checktop10 }
n465=  if (%rp == 5) { dailytop10 }
n466=  if ( %rp == 12 ) { checktopmonth }
n467=  if (%top20 == on && %rp == 14) { checktop20 }
n468=  if (%top20 == on && %rp == 16) { checktopmonth20 }
n469=  if %chantxt > 0 { unset %chanq | unset %chantxt }
n470=  if (%autostop != on) { unset %chanq }
n471=  if (%chanmsgs == on) { /msg $getread(-s,miscop,trivia.channel) $rhype }
n472=  %start = $ticks | set %hint false 
n473=  unset %ansnum
n474=  set %ansnum $arg(%trivq,2,*)
n475=  set %rndpoint $rand(%rpv,%rpvm) | set %qvalue Vraag Waarde
n476=  set %chaos off 
n477=  if %bonus == on { bonusv }
n478=  set %questask $replace($arg(%trivq,1,*),$chr(160),$chr(32)) ?  
n479=  set %quest $arg(%trivq,1,*)
n480=  if ( UWord isin $left(%quest,5) )  { 
n481=    if ($len(%ansnum) >= 13 ) { goto getline }  |  if ($len(%ansnum) <= 3 ) { goto getline } 
n482=    if ($chr(46) isin %ansnum ) { goto getline } |  if ($chr(45) isin %ansnum ) { goto getline }
n483=    if ($chr(39) isin %ansnum ) { goto getline } |  if ($chr(48) isin %ansnum ) { goto getline } | if ($chr(49) isin %ansnum ) { goto getline }
n484=    if ($chr(33) isin %ansnum ) { goto getline } | if ($chr(47) isin %ansnum ) { goto getline }
n485=  $scramble } 
n486=  if (plant isin $right(%quest,10) && %megbonus == on) { funguss }
n487=  if (mannelijk isin $right(%quest,10) && %megbonus == on) { funguss }
n488=  if (MegaBonus: isin $left(%quest,10) && %megbonus == on) { funguss }
n489=  if (bird isin $left(%quest,10)) { %rndpoint = %rpv }
n490=
n491=  if ( Kaos isin $left(%quest,4) ) {
n492=    if (%jp != $null) { unset %jp | set %jackpot %lastjackpot }
n493=    set %chaos on | set %ch.ans 0 
n494=    set %lett2 $count(%trivq,$chr(42))  | set %lett %lett2 | if (%lett > 10) { set %lett 10 }
n495=    var %looper 0
n496=    unset %chaoshint1
n497=    :kaoser
n498=    inc %looper
n499=    if (%looper > %lett2) { goto kaoser2 }
n500=    var %chaosanswer $arg(%trivq,$calc(%looper + 1),*)
n501=    set %hint4 $replace(%chaosanswer,$chr(160),$chr(32),a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*,1,*,2,*,3,*,4,*,5,*,6,*,7,*,8,*,9,*,0,*) 
n502=    var %chaoshint1 = %chaoshint1 [ %hint4 ] 
n503=    set %aw $+ %looper $arg(%trivq,$calc(%looper + 1),*)
n504=    set %allans %allans $+ $chr(42) $+ %aw [ $+ [ %looper ] ]
n505=    goto kaoser
n506=    :kaoser2
n507=
n508=  }
n509=  if %antitheft == on { antitheft }
n510=  ; if (%handicap == on) && ( %rndpoint > 99 ) { if %last1winr != $null { ignore -cu30  %last1winr } |  if %last2winr != $null { ignore -cu30  %last2winr } |  if %last3winr != $null { ignore -cu30  %last3winr } | msg $getread(-s,miscop,trivia.channel) 4 Last Weeks Top 3 Players are now on a 30 second delay !  }
n511=
n512=  if (%antitheft == $null) && (%chaos == off) { msg $getread(-s,miscop,trivia.channel) %oc2 $left(%qstfle,3) $+ . $+ %nxt.qst %clq %questask }
n513=  ;  if (%antitheft == $null) && (%chaos == off) { msg $getread(-s,miscop,trivia.channel) 00,04 KAOS %clq $right(%questask,-4) }
n514=
n515=  if (%antitheft == $null) && (%chaos == on) { set %rpvc $round($calc(%rpvm * 2 / %lett),0) | msg $getread(-s,miscop,trivia.channel) %oc2 $+  KAOS %clq $right(%questask,-5) 99,99 %clqb %lett Antwoorden 99,99 %clqv %rpvc Punten voor elk juist antwoord %clqa TOTAL: $calc(%rpvc * %lett) Punten  }
n516=  ;  if %chaos == on { msg $getread(-s,miscop,trivia.channel)  }
n517=
n518=  if (%wimp == on) { notice %chnick $arg(%trivq,2,*)  $arg(%trivq,3,*) $arg(%trivq,4,*) $arg(%trivq,5,*) $arg(%trivq,6,*) $arg(%trivq,7,*) $arg(%trivq,8,*) $arg(%trivq,9,*) $arg(%trivq,10,*) $arg(%trivq,11,*) }
n519=
n520=  if %chaos == off { 
n521=    set %hint4 $replace($arg(%trivq,2,*),$chr(160),$chr(32),a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*,1,*,2,*,3,*,4,*,5,*,6,*,7,*,8,*,9,*,0,*) 
n522=    set %hint5 $replace($arg(%trivq,2,*),$chr(160),$chr(32),b,*,c,*,d,*,f,*,g,*,h,*,j,*,k,*,l,*,m,*,n,*,p,*,q,*,r,*,s,*,t,*,v,*,w,*,x,*,y,*,z,*,1,*,2,*,3,*,4,*,5,*,6,*,7,*,8,*,9,*,0,*) 
n523=    msg $getread(-s,miscop,trivia.channel) %clq 1e Hint: %hint4  %clqv %qvalue : %rndpoint Punten  
n524=  }
n525=  if (%chaos == on) && ($getread(-s,miscop,kaos.hint) == on) {  msg $getread(-s,miscop,trivia.channel) %clq 1e Hint: %chaoshint1  }
n526=
n527=  if (%hnt1 == $null ) { set %hint true | set %hintt true } 
n528=  set %hint3 $left(%ansnum,$getread(-s,triggers,hint2resultcount)) 
n529=
n530=  if %chaos == off { 
n531=    .timer6 1 $getread(-s,miscop,time.left) trivf 
n532=    .timer5 1 $getread(-s,miscop,time.left2) trivg 
n533=    .timer3 1 $getread(-s,miscop,time.allow) trivt 
n534=  }
n535=
n536=  if (%chaos == on) { 
n537=    .timer5 1 $getread(-s,miscop,time.left2) trivca 
n538=    .timer6 1 $getread(-s,miscop,time.left) trivc 
n539=    .set %tms Tijd is om | .timer3 1 $getread(-s,miscop,time.allow) kaos.scr 
n540=  }
n541=  inc %num 1
n542=}
n543=
n544=;NON-KAOS HINTING: trivg is HINT 2 , trivf is HINT 3, trivt is TIMES UP.
n545=trivg {
n546=  ;if (%hnt1 == on)  { msg $getread(-s,miscop,trivia.channel) %clqv $round(%tme1a,1) sec. }
n547=  if (%hnt1 == $null ) { if (%scrcost == on) { set %rndpoint $round($calc(%rndpoint /2),0) } | msg $getread(-s,miscop,trivia.channel) %clq 2e Hint:  %hint3 $+ $right(%hint4,$calc(0-$getread(-s,triggers,hint2resultcount)))  %clqv $round(%tme1a,1) sec & %rndpoint Punten }
n548=}
n549=trivf {
n550=  if (%hnt1 == on) {  msg $getread(-s,miscop,trivia.channel)  %clqv $round(%tme1b,1) sec. }
n551=  if (%hnt1 == $null ) { if (%scrcost == on) { set %rndpoint $round($calc(%rndpoint /2),0) } | msg $getread(-s,miscop,trivia.channel) %clq 3e Hint:  %hint3 $+ $right(%hint5,$calc(0-$getread(-s,triggers,hint2resultcount)))  %clqv $round(%tme1b,1) sec & %rndpoint Punten }
n552=}
n553=
n554=trivt {
n555=  if ($getread(-s,miscop,show.ans) == on) { msg $getread(-s,miscop,trivia.channel)  %clqa Tijd is om  %clqb Het antwoord was -> %clqa $arg(%trivq,2,*) %clqb <- }
n556=  else { msg $getread(-s,miscop,trivia.channel)  %clqa Was deze te moeilijk voor u? Eens zien of je de volgende aankan...  }
n557=  if ($getread(-s,miscop,jackpot) == on) && ($getread(-s,miscop,jdisp) == on) && (%jp == $null) { %jackpot = $calc(%jackpot + %rndpoint) | msg $getread(-s,miscop,trivia.channel) %clqa %rndpoint Punten %clqb $+ Gaan naar de JACKPOT. Totaal: $+ %clqa %jackpot Punten }
n558=  if ($getread(-s,miscop,jackpot) == on) && ($getread(-s,miscop,jdisp) == off) && (%jp == $null) { %jackpot = $calc(%jackpot + %rndpoint) | msg $getread(-s,miscop,trivia.channel) %clqa %rndpoint Punten %clqb $+ Gaan naar de JACKPOT }
n559=  if ($getread(-s,miscop,jackpot) == on) && (%jp == 1) { %jackpot = $calc(%jackpot + %rndpoint) | msg $getread(-s,miscop,trivia.channel) %clqa %rndpoint JACKPOT Punten %clqb Gaan opnieuw naar de JACKPOT | unset %jp }
n560=  %ltrivq = $arg(%trivq,2,*)
n561=  if ($arg(%trivq,3,*) != $null) { %ltrivq = $arg(%trivq,2,*) $+ * $+ $arg(%trivq,3,*) }
n562=  unset %trivq | set %hintt false | unset %questask | unset %ansnm | unset %ansnum
n563=  .timer 1 $getread(-s,miscop,time.between) trivq
n564=  inc %chanq 1
n565=  if (%chanq >= %stopon) && (%chantxt == $null) { strivia  | unset %chanq | msg $getread(-s,miscop,trivia.channel) 00,01 Trivia is automatisch gestopt. Om te herstarten typ !start  }
n566=  if %autorest == on $checkauto
n567=}
n568=
n569=;KAOS HINTS:  trivca is HINT 2, trivc is HINT3, kaos.scr is TIMESUP.
n570=trivca { 
n571=  if ($getread(-s,miscop,kaos.hint) == on) { 
n572=    var %looper 0
n573=    unset %chaoshint3
n574=    :kaoser
n575=    inc %looper
n576=    if (%looper > %lett2) { goto kaoser2 }
n577=    if ( %aw [ $+ [ %looper ] ] != $null) { var %chaosanswer $arg(%trivq,$calc(%looper + 1),*) }
n578=    if ( %aw [ $+ [ %looper ] ] == $null) { var %chaoshint3 = %chaoshint3 [ 04X00 ] | goto kaoser }
n579=    set %hint4 $replace(%chaosanswer,$chr(160),$chr(32),a,*,b,*,c,*,d,*,e,*,f,*,g,*,h,*,i,*,j,*,k,*,l,*,m,*,n,*,o,*,p,*,q,*,r,*,s,*,t,*,u,*,v,*,w,*,x,*,y,*,z,*,1,*,2,*,3,*,4,*,5,*,6,*,7,*,8,*,9,*,0,*) 
n580=    :skippoint
n581=    var %chaoshint3 = %chaoshint3 [ $left(%chaosanswer,3) $+ $right(%hint4,-3) ] 
n582=    goto kaoser
n583=    :kaoser2
n584=  msg $getread(-s,miscop,trivia.channel) %clq 1e Hint:  %chaoshint3 99,99 %clqv $round(%tme1a,1) sec }
n585=  else {  msg $getread(-s,miscop,trivia.channel) %clqv Juiste antwoorden tot nu toe: %clq %ch.ans van de mogelijke %lett 99,99 %clqv $round(%tme1a,1) sec. }
n586=}
n587=trivc {
n588=  if ($getread(-s,miscop,kaos.hint) == on) { 
n589=    var %looper 0
n590=    unset %chaoshint2
n591=    :kaoser3
n592=    inc %looper
n593=    if (%looper > %lett2) { goto kaoser4 }
n594=    if (%aw [ $+ [ %looper ] ] != $null) { var %chaosanswer $arg(%trivq,$calc(%looper + 1),*) }
n595=    if (%aw [ $+ [ %looper ] ] == $null) { var %chaoshint2 = %chaoshint2 [ 04X00 ] | goto kaoser3 }
n596=    set %hint5 $replace(%chaosanswer,$chr(160),$chr(32),b,*,c,*,d,*,f,*,g,*,h,*,j,*,k,*,l,*,m,*,n,*,p,*,q,*,r,*,s,*,t,*,v,*,w,*,x,*,y,*,z,*,1,*,2,*,3,*,4,*,5,*,6,*,7,*,8,*,9,*,0,*) 
n597=    var %chaoshint2 = %chaoshint2 [ $left(%chaosanswer,3) $+ $right(%hint5,-3) ]
n598=    goto kaoser3
n599=    :kaoser4
n600=  msg $getread(-s,miscop,trivia.channel) %clq 3e Hint:  %chaoshint2 99,99 %clqv $round(%tme1b,1) sec }
n601=  else { msg $getread(-s,miscop,trivia.channel)  %clqv Juiste antwoorden tot nu toe: %clq %ch.ans van de mogelijke %lett 99,99 %clqv $round(%tme1b,1) sec. }
n602=}
n603=
n604=kaos.scr { 
n605=  set %chaos off
n606=  .timer3 off |  .timer5 off  |  .timer6 off |  set %zz1  $+ 00 $+ $rand(a,z) $+  $+ 12 
n607=  var %xy = 1
n608=  :start
n609=  inc %xy
n610=  var %kaosans = %kaosans $arg(%trivq,%xy,*)
n611=  if (%ch.ann [ $+ [ $calc(%xy - 1) ] ] != $null ) { var %s.win = $getread(wins,$replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],")) | var %m.win = $getred(wins,$replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],")) | var %d.win = $getreadd(wins,$replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],")) | inc %s.win %rpvc | inc %m.win %rpvc | inc %d.win %rpvc | dowrite wins $replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],") %s.win | dowrit wins $replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],") %m.win | dailwrite wins $replace(%ch.ann [ $+ [ $calc(%xy - 1) ] ],[,',],") %d.win | inc %totalwins 1 | unset %ch.ann [ $+ [ $calc(%xy - 1) ] ] }
n612=  unset %aw [ $+ [ $calc(%xy - 1) ] ]
n613=  if ( %xy > %lett2 ) { goto end }
n614=  goto start
n615=  :end
n616=  msg $getread(-s,miscop,trivia.channel)  %clqa %tms  %clqa De antwoorden waren [12 $replace(%kaosans,$chr(32),$chr(32) $+ ][12 $+ $chr(32)) ]
n617=  if (%ch.ans = 0) { msg $getread(-s,miscop,trivia.channel) 4 NIEMAND HAD EEN ANTWOORD JUIST !!! }
n618=  if (%ch.ans >= 1)  { msg $getread(-s,miscop,trivia.channel)   0,12 Totaal aantal juiste antwoorden: 8 %ch.ans van de mogelijke %lett2 ! }
n619=  unset %allans
n620=  unset %trivq | set %hintt false 
n621=  .timer4 1 $getread(-s,miscop,time.between) trivq
n622=  inc %chanq 1 
n623=  if (%chanq >= %stopon) && (%chantxt == $null) { strivia  | unset %chanq | msg $getread(-s,miscop,trivia.channel) 00,01 Trivia AUTO Stopped. To restart Trivia type !start  }
n624=  if %autorest == on $checkauto
n625=}
n626=
n627=;the following scramble code was scripted by sigh_ from www.hawkee.com forum
n628=scramble { 
n629=  if (%jp == $null) { set %rndpoint $calc($calc(%rpvm / 10) * $calc($len(%ansnum) - 2)) }
n630=  var %c 
n631=  while ($calc(1+$numtok(%c,32)) <= $len(%ansnum)) %c = $instok(%c,$mid(%ansnum,$v1,1),$r(0,$v1),32) 
n632=  %questask = UnScramble This Word: %c  
n633=  ;%questask = Abkrabbeln diese wort : %c  
n634=} 
