All pastes #293838 Raw Edit

CBlackList Trivia

public text v1 · immutable
#293838 ·published 2006-12-27 22:59 UTC
rendered paste body
--------------- CHAN BLACKLIST ------------------------------------------------

alias cbl {
  dialog -ma cbl cbl
}
alias abl {
  if ($1 == $null) {
    if ($readini(cbl.ini,chans,$chan) == $null) {
      writeini cbl.ini chans $chan $chan
    }
  }
  elseif ( $left($1,1) == $chr(35)) {
    if ($readini(cbl.ini,chans,$1) == $null) {
      writeini cbl.ini chans $1 $1
    }
  }
  else {
    if ($readini(cbl.ini,chans,$chr(35) $+ $1) == $null) {
      writeini cbl.ini chans $chr(35) $+ $1 $chr(35) $+ $1
    }
  }
}
dialog cbl {
  title "BLIST"
  size -1 -1 73 40
  option dbu
  text "AlternativeNick", 1, 130 57 30 5
  check "Add Channels on Kick", 4, 6 3 65 10
  text "Kicks Before Added", 5, 4 14 46 8
  edit "", 6, 54 13 13 10
  button "Close", 7, 43 25 27 12, ok
  button "Channels", 2, 3 25 37 12
}
dialog viewbadchannelsthingy {
  title "BChan"
  size -1 -1 76 90
  option dbu
  list 1, 2 1 71 73, size
  button "Add", 2, 38 75 34 12
  button "Remove", 3, 2 75 34 12
}
on *:DIALOG:cbl:init:*:{
  did -a $dname 6 $readini(cbl.ini,setup,kicklimit)
  if ($readini(cbl.ini,setup,kick) == 1) { did -c $dname 4 }
}
on *:DIALOG:cbl:sclick:2:{
  dialog -ma viewbadchannelsthingy viewbadchannelsthingy
}
on *:DIALOG:cbl:close:*:{
  writeini cbl.ini setup kicklimit $did($dname,6).text
  writeini cbl.ini setup kick $did($dname,4).state
}
on *:DIALOG:viewbadchannelsthingy:init:*:{
  var %i = 0
  while (%i < $ini(cbl.ini,chans,0)) {
    inc %i 1
    did -a $dname 1 $readini(cbl.ini,chans,$ini(cbl.ini,chans,%i))
  }
}
on *:DIALOG:viewbadchannelsthingy:sclick:2:{
  .echo -q $$?="Channel to Add"
  if ( $left($!,1) == $chr(35)) {
    if ($readini(cbl.ini,chans,$!) == $null) {
      writeini cbl.ini chans $! $!
      did -a $dname 1 $!
    }
  }
  else {
    if ($readini(cbl.ini,chans,$chr(35) $+ $!) == $null) {
      writeini cbl.ini chans $chr(35) $+ $! $chr(35) $+ $!
      did -a $dname 1 $chr(35) $+ $!
    }
  }
}
on *:DIALOG:viewbadchannelsthingy:sclick:3:{
  if ($did($dname,1).seltext != $null) {
    var %var = $did(viewbadchannelsthingy,1).seltext
    did -d viewbadchannelsthingy 1 $ini(cbl.ini,chans,%var)
    remini cbl.ini chans %var
  }
}
on *:KICK:#:{
  if ($knick == $me) && ($readini(cbl.ini,setup,kick) == 1) {
    writeini cbl.ini kicks $chan $calc($readini(cbl.ini,kicks,$chan) + 1)
    if ($readini(cbl.ini,kicks,$chan) >= $readini(cbl.ini,setup,kicklimit)) {
      writeini cbl.ini chans $chan $chan
      remini cbl.ini kicks $chan
    }
  }
}
on *:JOIN:#:{
  if ($nick == $me) {
    if ($readini(cbl.ini,chans,$chan) != $null) {
      part $chan 4Channel Blacklisted
      msg #erabot 1|Part|4 Blacklist 1-4 $chan 
      halt
    }
  }
}
on *:INVITE:#:{
  if ($readini(cbl.ini,chans,$chan == $null)) {
    join $chan
  }
  else {
    halt
  }
}
on *:TEXT:!abl *:#:{
  writeini cbl.ini chans $iif($2 == $null,$chan $chan,$chr(35) $+ $remove($2,$chr(35)) $chr(35) $+ $remove($2,$chr(35)))
  remini cbl.ini kicks $iif($2 == $null,$chan,$chr(35) $+ $remove($2,$chr(35))))
} 

--------------------- END CHAN BLACKLIST ----------------------------------------------------------------------------


#################################################################################################################
#################################################################################################################
######################################### The Ultimate Trivia Script ############################################
#################################################################################################################
#################################################################################################################

;TUTS Information

;Made by Eragonj
;Last Update: Sunday, December 03, 2006
;Lines Long: 161
;Copyright (C) 2006 Eragonj All Rights Reserved
;Do not use without Eragonj's permission!

;Files:
;Staff List: triviastaff.txt
;Question List: tqs.txt

########################################### TUTS BEGIN ##########################################################


------------------------------------------------- Turn On -------------------------------------------------------

on *:text:!triviaon:#:{
  if ($chan != #erabot) { notice $nick 12Error4 Trivia 1-12 Trivia is temporarily disabled - Reason:4 Polishing & Testing | halt
  }
  else {
    if (%trivia.status [ $+ [ $chan ] ] == on) {
      notice $nick 12Trivia 4Error 1-12 Trivia is 4already running12 in4 $chan $+ 12! | halt
    }
    else {
      set %trivia.chan [ $+ [ $chan ] ] $chan
      set %trivia.status [ $+ [ $chan ] ] on
      msg $chan 12Trivia has been turned 4on12 by4 $nick $+ 12! If you want it 4off12 please type4 "!triviaoff"12.
      aliasstrivia
} } }


------------------------------------------------- Turn Off ------------------------------------------------------

on *:text:!triviaoff:#:{
  if (%trivia.chan [ $+ [ $chan ] ] == off || %trivia.chan [ $+ [ $chan ] ] == $null) {
    notice $nick 12Trivia 4Error 1-12 Trivia is already 4off12 in4 $chan $+ 12! | halt
  }
  else {
    msg $chan 12Trivia has been turned 4off12 by4 $nick $+ 12! If you want it 4on12 please type4 "!triviaon"12.
    unset %trivia.status [ $+ [ $chan ] ]
    unset %trivia.chan [ $+ [ $chan ] ]
    unset %trivia.hint.1 [ $+ [ $chan ] ]
    unset %trivia.hint.2 [ $+ [ $chan ] ]
    unset %trivia.hint.3 [ $+ [ $chan ] ]
    timertrivia $+ $chan off
    timertrivia2 $+ $chan off
    timertrivhi $+ $chan off
    timertrivhi2 $+ $chan off
} }

------------------------------------------------- Add Question --------------------------------------------------

on *:text:!atq*:#:{ if ($read(triviastaff.txt,w,$nick)) {
    write tqs.txt $2-
    notice $nick The Question*Answer; $2- ;Has Been Added To The Question List
  }
  else {
    notice $nick 12Trivia 4Error 1-12 You are not a 4Trivia Staff Member12.
} }

-------------------------------------------- Trivia Information -------------------------------------------------

on *:text:!trivinfo:#:{ if (!$read(triviastaff.txt,w,$nick)) {
    notice $nick 12Your staff status is being checked. 4Please hold...
    timer 1 6 notice $nick 12Your staff status has been 4declined12.
  }
  else {
    notice $nick 12Your staff status is being checked. 4Please hold...
    timer 1 6 notice $nick 12Your staff status has been 4approved12. 4Please wait for the list to be retrieved...
    timer 1 10 notice $nick 1| Trivia Information |
    timer 1 10 notice $nick 12Commands:4 !trivcomms
    timer 1 10 notice $nick 12Script:4 Made by Eragonj
    timer 1 10 notice $nick 12Last Updated:4 Tuesday, December 26rd, 2006
    timer 1 10 notice $nick 12 $+ $chr(35) Of Questions:4 $lines(tqs.txt)
    timer 1 10 notice $nick 12 $+ $chr(35) Of Trivia Staff:4 $lines(triviastaff.txt)
} }

------------------------------------------------- Commands List -------------------------------------------------

on *:text:!trivcomms:#:{ if (!$read(triviastaff.txt,w,$nick)) {
    notice $nick 12Your staff status is being checked. 4Please hold...
    timer 1 6 notice $nick 12Your staff status has been 4declined12.
  }
  else {
    notice $nick 12Your staff status is being checked. 4Please hold...
    timer 1 6 notice $nick 12Your staff status has been 4approved12. 4Please wait for the list to be retrieved...
    timer 1 10 notice $nick 1| Trivia Command List |
    timer 1 10 notice $nick 12Add A User:4 !addts Nick 12( Op #EraBot/#TAOMB )
    timer 1 10 notice $nick 12Delete A User:4 !delts Nick 12( Op #EraBot/#TAOMB )
    timer 1 10 notice $nick 12Command Lists:4 !trivcomms
    timer 1 10 notice $nick 12Information:4 !trivinfo
    timer 1 10 notice $nick 12Add Question:4 !atq Question*Answer
} }

--------------------------------------------- Add Staff Member --------------------------------------------------

on *:text:!addts*:#:{
  if ($nick isop #EraBot) {
    if ($read(triviastaff.txt,w,$2)) {
      notice $nick 12Trivia 4Error 1-12 The nickname4 $2 12is already 4in12 the4 Trivia Staff File12.
    }
    else {
      if (!$read(triviastaff.txt,w,$2)) {
        write triviastaff.txt $2
        notice $nick 12The nickname4 $2 12has successfully been 4added12 to the4 Trivia Staff File12.
} } } }

--------------------------------------------- Delete Staff Member -----------------------------------------------

on *:text:!delts*:#:{
  if ($nick isop #EraBot) {
    if (!$read(triviastaff.txt,w,$2)) {
      notice $nick 12Trivia 4Error 1-12 The nickname4 $2 12is already 4not in12 the4 Trivia Staff File12.
    }
    else {
      if ($read(triviastaff.txt,w,$2)) {
        write -dw $+ $2 triviastaff.txt
        notice $nick 12The nickname4 $2 12has successfully been 4added12 from the4 Trivia Staff File12.
} } } }

------------------------------------------------- Random Hint Alias ---------------------------------------------

alias randhint {
  var %x .8 * $len($1),%y $1
  while (.8 < %x) dec %x $regsub(%y,(.{ $+ $r(0,950) $+ })[^_],\1_,%y)
  return %y
}

------------------------------------------ Question & Hint Run-Through ------------------------------------------

alias aliasstrivia {
  :trivs
  set %trivia.chan [ $+ [ $chan ] ] $chan
  .timertrivia $+ $chan 1 110 msg %trivia.chan [ $+ [ $chan ] ] 7Time is up!2 Answer:4 %trivia.qa [ $+ [ $chan ] ]
  set %trivia.q [ $+ [ $chan ] ] $gettok($read(tqs.txt),1,42)
  set %trivia.qa [ $+ [ $chan ] ] $gettok($read(tqs.txt,$readn),2,42)
  set %trivia.hint.1 [ $+ [ $chan ] ] $randhint($gettok($read(tqs.txt,$readn),2,42)) $+ 
  set %trivia.hint.2 [ $+ [ $chan ] ] $randhint($gettok($read(tqs.txt,$readn),2,42)) $+ 
  set %trivia.hint.3 [ $+ [ $chan ] ] $randhint($gettok($read(tqs.txt,$readn),2,42)) $+ 
  msg %trivia.chan [ $+ [ $chan ] ] 4 $+ $readn $+ 7.12 %trivia.q [ $+ [ $chan ] ] $+ 
  msg %trivia.chan [ $+ [ $chan ] ] 12Random Hint:4 %trivia.hint.1 [ $+ [ $chan ] ] $+ 
  .timertrivhi $+ $chan 1 30 msg %trivia.chan [ $+ [ $chan ] ] 12Random Hint:4 %trivia.hint.2 [ $+ [ $chan ] ] $+ 
  .timertrivhi2 $+ $chan 1 60 msg %trivia.chan [ $+ [ $chan ] ] 12Random Hint:4 %trivia.hint.3 [ $+ [ $chan ] ] $+ 
  .timertrivia2 $+ $chan 1 110 goto :trivs
}

.timertrivia $+ $chan 1 110 msg %trivia.chan [ $+ [ $chan ] ] 12Trivia has been turned 4off12 due to 4innactivity12.
.timertrivia2 $+ $chan 1 50 unset %trivia.chan [ $+ [ $chan ] ]
.timertrivia3 $+ $chan 1 50 set %trivia.status [ $+ [ $chan ] ] off
.timertrivia4 $+ $chan 1 50 unset %trivia.hint.1 [ $+ [ $chan ] ]
.timertrivia5 $+ $chan 1 50 unset %trivia.hint.2 [ $+ [ $chan ] ]
.timertrivia6 $+ $chan 1 50 unset %trivia.hint.3 [ $+ [ $chan ] ]

----------------------------------------- Right Checker & Win Tracker -------------------------------------------

on *:text:*:#:{
  if (%trivia.status [ $+ [ $chan ] ] == on) {
    if (%trivia.qa [ $+ [ $chan ] ] iswm $1-) {
      inc %trivia.win [ $+ [ $nick ] ] 1
      msg $chan 1|Winner| 1-12 Nick:4 $nick 1- 12Answer:4 %trivia.qa [ $+ [ $chan ] ] 1-12 $nick $+ 's Wins:4 %trivia.win [ $+ [ $nick ] ] 1-
      .timertrivhi $+ $chan off
      aliasstrivia
} } }

############################################ TUTS ENDS ##########################################################