I've made this a long time ago out of fun :D
please note garfield-991 is one of my other nicks...
This Bot is just meant to host an epic cookie collector game,
first, everyone who wants to participate has to announce himself to the bot
then, once a day a user is permitted to get a cookie for free
the bot saves the data in an ini file, statistics are being hold in variables
more features are atm:
play "guess the number" - and have a chance for an extra cookie once a day
upcoming:
try to steal a cookie from someone if he's online, will be like RPS I think
to use, just load it, join the channel you want the bot in and turn teh script for this channel on via channel menu.
and you have to change %cookie.chef to your nickname for errorhandling
PS: I originally wrote all the output in german, if you want that too, just leave a comment ;)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Cookie Bot Script ;;;
;;; ################# ;;;
;;; ;;;
;;; (C) 2008 - 2009 ;;;
;;; created, mantained and published by ;;;
;;; >>> garfield-991 <<< ;;;
;;; ;;;
;;; thx to Kulimeya for testing ressources :) ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ON *:TEXT:!cookie &:#: {
if (%cookies. [ $+ [ $chan ] ] ) {
if ( $readini(cookies.ini,$nick,Register $+ $chan ) = true ) {
; cookies for all
if $2 = please {
var %cookie.date $time(dd.mm.yy)
if ( %cookie.date = $readini(cookies.ini,$nick,Date $+ $chan)) notice $nick Sorry, only one cookie a day, try again tomorrow ;)
else {
writeini cookies.ini $nick Date $+ $chan $time(dd.mm.yy)
givecookie $nick
}
}
; cookie stats
if $2 = stats {
if ( %flood.s [ $+ [ $chan ] ] = 2 ) notice $nick spam protection active! try again in 5 minutes!
if ( %flood.s [ $+ [ $chan ] ] = 0 ) {
inc %stat.stat [ $+ [ $chan ] ] 1
scriptstats
set %flood.s [ $+ [ $chan ] ] 1
}
}
if ( %flood.s [ $+ [ $chan ] ] = 1 ) {
timerflood1 1 300 set %flood.s [ $+ [ $chan ] ] 0
set %flood.s [ $+ [ $chan ] ] 2
}
; cookie collector stats
if $2 = top3 {
if ( %flood.t [ $+ [ $chan ] ] = 2 ) notice $nick spam protection active! try again in 5 minutes!
if ( %flood.t [ $+ [ $chan ] ] = 0 ) {
inc %stat.t3 [ $+ [ $chan ] ] 1
cookiestats
set %flood.t [ $+ [ $chan ] ] 1
}
}
if ( %flood.t [ $+ [ $chan ] ] = 1 ) {
timerflood2 1 300 set %flood.t [ $+ [ $chan ] ] 0
set %flood.t [ $+ [ $chan ] ] 2
}
; Cookie-Jar
if $2 = jar {
var %cookie.jar = $readini(cookies.ini,$nick,Cookie [ $+ [ $chan ] ] )
var %cookie.1st = $calc( ( %top1c [ $+ [ $chan ] ] - %cookie.jar ) +1 )
var %cookies.gamec = $readini(cookies.ini,$nick,Games_played [ $+ [ $chan ] ] )
if (!$readini(cookies.ini,$nick,Games_won [ $+ [ $chan ] ] )) writeini cookies.ini $nick Games_won [ $+ [ $chan ] ] 0
var %cookies.gamew = $readini(cookies.ini,$nick,Games_won [ $+ [ $chan ] ] )
var %percent = $calc( ( %cookies.gamec / %cookies.gamew ) * 100 )
if ( $nick = %top1n [ $+ [ $chan ] ] ) notice $nick you are the best collector in $chan with %cookie.jar cookies!
elseif ($readini(cookies.ini,$nick,Cookie $+ $chan >= 1) notice $nick you collected %cookie.jar cookies so far. collect %cookie.1st more to get on the first place!
if ( %cookies.gamec >= 1 ) notice $nick you already played a game %cookies.gamec times and won %percent $+ $chr(37) of them.
}
; Win Cookies!
if $2 = game {
set %cookies.game $time(dd:mm:yy)
if ( %cookies.game = $readini(cookies.ini,$nick,Game $+ $chan) ) notice $nick sorry $nick $+ , you can only play once a day!
else {
writeini cookies.ini $nick Games_played [ $+ [ $chan ] ] $calc( $readini(cookies.ini,$nick,Games) + 1)
writeini cookies.ini $nick Game [ $+ [ $chan ] ] %cookies.game
inc %stat.games [ $+ [ $chan ] ] 1
wincookie $nick
}
}
if $2 = steal {
notice $nick coming soon...!
}
}
else {
notice $nick Hey $+( $nick ,!) if you want to participate in collecting cookies here, you have to register
notice $nick to register, just query me with REGISTER $chan $+ , please note that only your current nick will be registered.
}
; Hilfe
if $2 = help {
if ( $readini(cookies.ini,$nick,Register [ $+ [ $chan ] ] ) = true ) {
notice $nick Cookie help comes to query in 5 secs
timer 1 5 msg $nick syntax: !cookie COMMAND
timer 1 6 msg $nick please - write this to get a cookie
timer 1 6 msg $nick top3 - show info about the top3 in $chan
timer 1 7 msg $nick stats - cookie statistics about $chan
timer 1 7 msg $nick jar - your cookie info
timer 1 8 msg $nick game - win a cookie
timer 1 8 msg $nick steal - try to steal someone's cookie
timer 1 9 msg $nick help - this help
timer 1 10 msg $nick if you encounter any problems or if you have some suggestions, write them to cookiebot@mail.3dl.am :-)
timer 1 10 msg $nick (c)2008 - 2009 garfield-991 - %cookie.version
}
}
}
halt
:error
msg %cookie.chef Error: $error
}
ON *:TEXT:!cookie:#:{
if ( $readini(cookies.ini,$nick,Register [ $+ [ $chan ] ] ) != true ) {
notice $nick Hey $+( $nick ,!) if you want to participate in collecting cookies here, you have to register
notice $nick to register, just query me with REGISTER $chan $+ , please note that only your current nick will be registered.
}
else {
notice $nick Hey $nick $+ ! try it with !cookie help ;)
}
halt
:error
msg %cookie.chef Error: $error
}
ON *:TEXT:REGISTER &:?:{
if ( $readini(cookies.ini,$nick,Register [ $+ [ $chan ] ] ) != true ) {
writeini cookies.ini $nick Register $+ $2 true
inc %stat.users [ $+ [ $2 ] ] 1
%stat.newest [ $+ [ $2 ] ] = $nick
msg $nick you're now registered in $2 $+ !
if ( $me isop $2 ) {
mode $2 +v $nick
}
}
else {
msg $nick you are already registered!
}
halt
:error
msg %cookie.chef Error: $error
}
ON *:TEXT:!game &:#: {
if ( %game [ $+ [ $nick ] ] == on ) {
timergame. [ $+ [ $nick ] ] off
if ( $2 = $rand(1,6) ) {
msg $chan Juhuu! $nick wins!
inc %stat.gwon [ $+ [ $chan ] ] 1
givecookie $nick
}
else {
msg $chan Oh no! that was wrong - %wuerfel [ $+ [ $nick ] ] would've been the correct number...
}
}
halt
:error
msg %cookie.chef Error: $error
}
ON *:JOIN:#:{
if ( %cookies. [ $+ [ $chan ] ] ) {
if ( $readini( cookies.ini , $nick , Register [ $+ [ $chan ] ] ) = true ) {
if ( $me isop $chan ) {
mode $chan +v $nick
}
notice $nick Welcome back, $nick $+ !
}
else {
notice $nick Welcome, $nick $+ ! the cookie bakery is open in $chan - for more info just write !cookie help
}
}
halt
:error
msg %cookie.chef Error: $error
}
ON *:OPEN:?:{
timer 1 600 close -m $nick
msg $nick Hey $nick $+ ! I'm a Bot, if you want more information just write in chan !cookie help
halt
:error
msg %cookie.chef Error: $error
}
alias wincookie {
describe $chan throws a 6-sided die...
timer 1 2 msg $chan Go $1 $+, you have 20 secs! guess the number with !game NUMBER
set -u20 %game [ $+ [ $1 ] ] on
timergame. [ $+ [ $nick ] ] 1 20 msg $chan time's up, $1 ! try again!
halt
:error
msg %cookie.chef Error: $error
}
alias cookiestats {
msg $chan Best collectors in $chan $+ :
msg $chan *** 1. %top1n [ $+ [ $chan ] ] collected %top1c [ $+ [ $chan ] ] cookies (best since %top1d [ $+ [ $chan ] ] )
msg $chan ** 2. %top2n [ $+ [ $chan ] ] ( $+ %top2c [ $+ [ $chan ] ] cookies)
msg $chan * 3. %top3n [ $+ [ $chan ] ] ( $+ %top3c [ $+ [ $chan ] ] cookies
halt
:error
msg %cookie.chef Error: $error
}
alias scriptstats {
var %wongames
%wongames = $calc( ( %stat.gwon [ $+ [ $chan ] ] / %stat.games [ $+ [ $chan ] ] ) * 100 )
var %percent
%percent = $round( %wongames , 2 )
var %dauer
%dauer = $duration( $calc( $ctime - %stat.last ) )
msg $chan Statistik für $chan $+ :
msg $chan %stat.users [ $+ [ $chan ] ] users collected %stat.cookies [ $+ [ $chan ] ] cookies, welcome our newest collector: %stat.newest [ $+ [ $chan ] ] $+ !
msg $chan the cookie bakery in $chan has been open for %dauer $+ ! Script version %cookie.version
msg $chan games played: %stat.games [ $+ [ $chan ] ] - %percent $+ $chr(37) won!
msg $chan times the top 3 were requested: %stat.t3 [ $+ [ $chan ] ] - this statistic: %stat.stat [ $+ [ $chan ] ]
halt
:error
msg %cookie.chef Error: $error
}
alias givecookie {
set %cookie.count $calc($readini(cookies.ini,$1,Cookie [ $+ [ $chan ] ] ) +1)
writeini cookies.ini $1 Cookie $+ $chan %cookie.count
inc %stat.cookies [ $+ [ $chan ] ] 1
describe $chan gives $1 a delicious cookie! *yummy*
if ( %cookie.count > %top1c [ $+ [ $chan ] ] ) {
if ( $1 != %top1n [ $+ [ $chan ] ] ) {
%top2n [ $+ [ $chan ] ] = %top1n [ $+ [ $chan ] ]
%top2c [ $+ [ $chan ] ] = %top1c [ $+ [ $chan ] ]
%top1d [ $+ [ $chan ] ] = $time(dd.mm.yy HH:nn)
%top1n [ $+ [ $chan ] ] = $1
msg $chan $1 is now top collector with %cookie.count cookies!!
}
else msg $chan $1 holds the record with %cookie.count cookies!
%top1c [ $+ [ $chan ] ] = %cookie.count
}
elseif ( %cookie.count > %top2c [ $+ [ $chan ] ] ) {
if ( $1 != %top2n [ $+ [ $chan ] ] ) {
msg $chan $1 is now top 2 with %cookie.count cookies!
%top3n [ $+ [ $chan ] ] = %top2n [ $+ [ $chan ] ]
%top3c [ $+ [ $chan ] ] = %top2c [ $+ [ $chan ] ]
%top2n [ $+ [ $chan ] ] = $1
}
else msg $chan $1 is still top 2 with %cookie.count cookies!
%top2c [ $+ [ $chan ] ] = %cookie.count
}
elseif ( %cookie.count > %top3c [ $+ [ $chan ] ] ) {
if ( $1 != %top3n [ $+ [ $chan ] ] ) {
%top3n [ $+ [ $chan ] ] = $1
msg $chan $1 is now top 3 with %cookie.count cookies!
}
else msg $chan $1 is still top 3 with %cookie.count cookies!
%top3c [ $+ [ $chan ] ] = %cookie.count
}
else {
if ( %cookie.count > 1 ) msg $chan $1 has already collected %cookie.count cookies!
else msg $chan $1 got his first cookie!
}
halt
:error
msg %cookie.chef Error: $error
}
on *:load: {
echo -a **********
echo -a Cookie-Bot
echo -a Script by garfield-991
echo -a (c)2008 - 2009 %cookie.version
echo -a **********
}
alias cookierefresh {
set %cookies. [ $+ [ $1 ] ] on
if ( !%top1n [ $+ [ $1 ] ] ) set %top1n [ $+ [ $1 ] ] nobody
if ( !%top1c [ $+ [ $1 ] ] ) set %top1c [ $+ [ $1 ] ] 0
if ( !%top1d [ $+ [ $1 ] ] ) set %top1d [ $+ [ $1 ] ] ever
if ( !%top2n [ $+ [ $1 ] ] ) set %top2n [ $+ [ $1 ] ] nobody
if ( !%top2c [ $+ [ $1 ] ] ) set %top2c [ $+ [ $1 ] ] 0
if ( !%top3n [ $+ [ $1 ] ] ) set %top3n [ $+ [ $1 ] ] nobody
if ( !%top3c [ $+ [ $1 ] ] ) set %top3c [ $+ [ $1 ] ] 0
set %flood.t [ $+ [ $1 ] ] 0
set %flood.s [ $+ [ $1 ] ] 0
inc %stat.start [ $+ [ $1 ] ] 1
set %cookie.chef garfield-991
set %cookie.version 1.9
if ( !%stat.newest [ $+ [ $1 ] ] ) set %stat.neust [ $+ [ $1 ] ] (no collector in $chan $+ !)
if ( !%stat.users [ $+ [ $1 ] ] ) set %stat.users [ $+ [ $1 ] ] 0
if ( !%stat.cookies [ $+ [ $1 ] ] ) set %stat.cookies [ $+ [ $1 ] ] 0
if ( !%stat.games [ $+ [ $1 ] ] ) set %stat.games [ $+ [ $1 ] ] 0
if ( !%stat.gwon [ $+ [ $1 ] ] ) set %stat.gwon [ $+ [ $1 ] ] 0
if ( !%stat.t3 [ $+ [ $1 ] ] ) set %stat.t3 [ $+ [ $1 ] ] 0
if ( !%stat.stat [ $+ [ $1 ] ] ) set %stat.stat [ $+ [ $1 ] ] 0
halt
:error
msg %cookie.chef Error: $error
}
menu channel {
.-
.***Cookie-Script***
. $iif(%cookies. [ $+ [ $chan ] ] ,$style(2)) turn Script in $chan ON:{
cookierefresh $chan
set %stat.last [ $+ [ $1 ] ] $ctime
msg $chan Cookie-time :) write !cookie help for more.
}
. $iif(!%cookies. [ $+ [ $chan ] ] ,$style(2)) turn Script in $chan OFF:{
unset %cookies. [ $+ [ $chan ] ]
msg $chan Cookie-time is over. no cookies for now... :(
}
}