It will give people cookies onpon entry and they can ask for cookies by saying "cookie 1-1000"
and you can aslo steal other peoples cookies by typing "!take 1-100"
it also has a top 3 cookie monster thingy type "!topcookie"
there a 5000 cookie a day limit so everybody won't take all of them in one day :)
Enjoy! :D
I updated it o:
it now has a dialog for easy usage...
and it now inserts commas within the numbers automaticly thanks to \ :)
and fixed a minor bug :)
;###############################
;## Pickle's Cookie Jar v1.5 ##
;###############################
;<----aliases---->
alias insertcomma {
;<--Thanks to \ for helping to make the auto comma inserting thingy ;o-->
var %number $1-
var %length = $len($1)
if (%length < 4) {
return %number
}
while (%length > 3) {
dec %length 3
%number = $left(%number,%length) $+ $chr(44) $+ $mid(%number,$calc(%length + 1))
}
return %number
}
alias check.file {
set %temp $lines(cookie.ini)
while (%temp != 0) {
:back
inc %temp2 1
set %temp3 $read(cookie.ini,%temp2)
if (%temp3 == [cookies]) { dec %temp 1 | goto back }
if (%temp3 == [data] || %temp3 == [limit]) { break }
var %name $remove(%temp3,1,2,3,4,5,6,7,8,9,0,=)
var %cookie $readini(cookie.ini,cookies,%name)
if (%top.1 < %cookie || %top.1 == $null) {
set %top.1 %cookie | set %top1 %name $+ : $insertcomma(%cookie)
dec %temp 1 | goto back
}
if (%top.2 < %cookie || %top.2 == $null) {
set %top.2 %cookie | set %top2 %name $+ : $insertcomma(%cookie)
dec %temp 1 | goto back
}
if (%top.3 < %cookie || %top.3 == $null) {
set %top.3 %cookie | set %top3 %name $+ : $insertcomma(%cookie)
dec %temp 1 | goto back
}
if (%top.4 < %cookie || %top.4 == $null) {
set %top.4 %cookie | set %top4 %name $+ : $insertcomma(%cookie)
dec %temp 1 | goto back
}
if (%top.5 < %cookie || %top.5 == $null) {
set %top.5 %cookie | set %top5 %name $+ : $insertcomma(%cookie)
dec %temp 1 | goto back
}
dec %temp 1
}
echo #1: %top1 #2: %top2 #3: %top3 #4: %top4 #5: %top5
unset %temp* %top.*
}
;<----Events---->
on *:join:%chan:{
if ($readini(cookie.ini,data,switch) == on) {
writeini -n cookie.ini cookies $nick $calc($readini(cookie.ini,cookies,$nick) + 1) | describe $chan Gives $nick a Cookie. Number of cookies given to $nick $+ : $insertcomma($readini(cookie.ini,cookies,$nick))
}
}
alias check.time {
if ($readini(cookie.ini,data,date) != $date) { echo cookie reset! | writeini cookie.ini data date $date | remini cookie.ini limit | remini cookie.ini kick | remini cookie.ini takelimit }
}
on *:text:cookie*:%chan:{
if ($readini(cookie.ini,data,switch) == on) {
check.time
if (- isin $$2 && $remove($$2,-) isnum 1-1000) { writeini -n cookie.ini cookies $nick $calc($readini(cookie.ini,cookies,$nick) $$2) | describe $chan eats $nick $remove($$2,-) Cookies. Number of cookies lefted for $nick $+ : $insertcomma($readini(cookie.ini,cookies,$nick)) | halt }
if ($$2 isnum 1-1000) {
if ($readini(cookie.ini,limit,$nick) > $readini(cookie.ini,data,limit)) {
if ($me isop $chan) {
writeini -n cookie.ini kick $nick $calc($readini(cookie.ini,kick,$nick) + 1)
if ($readini(cookie.ini,kick,$nick) isnum 3-5) {
if ($left($nick($chan,$nick).pnick,1) == &) { cs deprotect $chan $nick }
kick $chan $nick Shut up no more cookies don't make me ban you. | halt
}
if ($readini(cookie.ini,kick,$nick) > 5) {
if ($left($nick($chan,$nick).pnick,1) == &) { cs deprotect $chan $nick }
kick $chan $nick banned for trying to take all the cookies... | mode $chan +b $nick | timerban 1 30 mode $chan -b $nick | halt
}
}
msg $chan you already got your limit for today now stop asking or you'll be kicked | halt
}
writeini -n cookie.ini limit $nick $calc($readini(cookie.ini,limit,$nick) + $$2) | writeini -n cookie.ini cookies $nick $calc($readini(cookie.ini,cookies,$nick) + $$2) | describe $chan Gives $nick $insertcomma($$2) Cookies. Number of cookies given to $nick $+ : $insertcomma($readini(cookie.ini,cookies,$nick)) | halt
}
else {
writeini -n cookie.ini limit $nick $calc($readini(cookie.ini,limit,$nick) + 1) | writeini -n cookie.ini cookies $nick $calc($readini(cookie.ini,cookies,$nick) + 1) | describe $chan Gives $nick a Cookie. Number of cookies given to $nick $+ : $insertcomma($readini(cookie.ini,cookies,$nick))
}
}
}
on *:text:!take*:%chan:{
if ($readini(cookie.ini,data,switch) == on) {
check.time
if ($$2 !ison $chan) { msg $chan stealing from the blind huh? you should be ashamed of yourself :( | halt }
if ($$2 ison $chan && $$3 isnum 1-1000) {
var %temp $calc($readini(cookie.ini,cookies,$$2) - $$2)
if (%temp <= 0) { msg $chan you can't take that many, $$2 doesn't have that many :( | halt }
writeini -n cookie.ini takelimit $nick $calc($readini(cookie.ini,takelimit,$nick) + 1)
if ($readini(cookie.ini,takelimit,$nick) isnum 3-5) { msg $chan stop trying to take $$2 $+ 's cookies you will be kicked.. | halt }
if ($readini(cookie.ini,takelimit,$nick) > 5) {
if ($left($nick($chan,$nick).pnick,1) == &) { cs deprotect $chan $nick }
kick $chan $nick stop trying to take $$2 $+ 's | halt
}
writeini -n cookie.ini cookies $$2 $calc($readini(cookie.ini,cookies,$$2) - $$3)
writeini -n cookie.ini cookies $nick $calc($readini(cookie.ini,cookies,$nick) + $$3)
msg $chan $nick steals $insertcomma($$3) cookies from $$2 $+ . D: cookies left: $insertcomma($readini(cookie.ini,cookies,$$2))
}
}
}
on *:text:!topcookie*:#:{
check.time | check.file | msg $chan Top Five Cookie Monsters:
msg $chan #1: %top1 | msg $chan #2: %top2 | msg $chan #3: %top3 | msg $chan #4: %top4 | msg $chan #5: %top5
unset %top*
}
menu status,channel,nicklist {
cookie jar : { dialog -m cookie cookie }
}
dialog cookie {
size -1 -1 150 100
title "Cookie jar v1.1"
option dbu
text "Pickle's Cookie jar v1.1:",100, 25 5 60 12
text "Enter channels to allow to have cookies.",101, 25 17 100 12
edit "#channel",1, 15 37 70 12
button "Save",2, 95 37 20 12
text "Enter daily limit amount.",103, 25 50 100 12
edit "",9, 15 62 70 12
button "Save",10, 92 62 20 12
text "click to turn off",104, 5 25 70 12
check "off",11, 55 25 50 12
}
on *:dialog:cookie:init:0:{
if ($readini(cookie.ini,data,switch) == on) { did -ra cookie 104 click to turn on | did -ra cookie 11 on | did -c cookie 11 }
if (%chan != $null) { did -ra cookie 1 %chan }
if ($readini(cookie.ini,data,baned) != $null) { did -ra cookie 5 $readini(cookie.ini,data,baned) }
if ($readini(cookie.ini,data,limit) != $null) { did -ra cookie 9 $readini(cookie.ini,data,limit) }
}
on *:dialog:cookie:sclick:*:{
if ($did == 11) {
if ($readini(cookie.ini,data,switch) == on) { did -ra cookie 104 click to turn off | did -ra cookie 11 off | writeini cookie.ini data switch off | halt }
if ($readini(cookie.ini,data,switch) == off) { did -ra cookie 104 click to turn on | did -ra cookie 11 on | writeini cookie.ini data switch on | halt }
}
if ($did == 2) { set %chan $did(1) }
if ($did == 10) { writeini cookie.ini data limit $did(9) }
}
on *:load:{
writeini cookie.ini cookies $me 0 | writeini cookie.ini data switch off | writeini cookie.ini data limit 5000
}