SweetShop Script

By Gavanator on Jul 17, 2011

Basically I got bored with all the other bots that are around on IRC and decided to make this simple but addictive Sweet Shop game. You steal sweets or are given sweets for doing things and you have timers on the things you can do to stop people getting sweets really fast. You may think its a little childish but I don't really care, it works and that's all that matters. You can edit it how you like I don't really mind. If anybody has any questions about it you can message me on here or you can find me on /server -m IRC.SwiftIRC.net -j #Casino my IRC nick is Gav.

This script uses !Mycolors which I have added at the bottom of it.

The rank system is by: Savage_CL, so a big thank you goes to him :D

Ok so how to play:-
!Scommands for all commands

Pretty much speaks for itself.

#####SweetShop Script, Scripted by Gav#####

#####Network: IRC.SwiftIRC.net:6667#####

#####Date: 18/07/2011#####

####Change this for channel bans (The bot won't work in them)####
Alias bannedchans return #channel1 #channel2 etc etc

Alias $nickhalt ANY NICK(s) HERE THAT YOU WANT TO BAN
Alias clearout { if ($input(Are you sure?,wo,SweetShop)) { hdel score $$2 | hdel dtime $$2 | hdel pbtime $$2 | hdel gtime $$2 | hdel rdtime $$2 | hdel mtime $$2 | hdel stime $$2 | hdel rtime $$2 | remini items.ini $$2 | remini warnings.ini cheat $$2 } }

Alias c1 return $+($chr(3),10,$1-,$chr(3))
Alias c2 return $+($chr(3),11,$1-,$chr(3))
Alias c3 return $+($chr(3),14,$1-,$chr(3))

Alias display return $iif($left($1,1) == @,msg #,.notice $nick)

Alias logo2 return $+($mcol1($chr(91)),$chr(32),$mcol2($1-),$chr(32),$mcol1($chr(93)))

Alias price return $+($mcol1($chr(40)),$mcol2($1-),$mcol1($chr(41)))

Alias shorten {
  var %px $floor($remove($1-,$chr(44),$chr(32)))
  var %xp $len(%px)
  if (%xp <= 3) return %px
  if (%xp >= 3) && (%xp <= 6) return $+($round($calc(%px / 1000),2),K)
  if (%xp >= 6) && (%xp <= 9) return $+($round($calc(%px / 1000000),2),M)
  if (%xp >= 9) && (%xp <= 12) return $+($round($calc(%px / 1000000000),2),B)
  if (%xp >= 12) && (%xp <= 15) return $+($round($calc(%px / 1000000000000),2),T)
  if (%xp >= 15) && (%xp <= 18) return $+($round($calc(%px / 1000000000000000),2),QUAD)
  if (%xp >= 18) && (%xp <= 21) return $+($round($calc(%px / 1000000000000000000),2),QUIN)
  if (%xp >= 21) && (%xp <= 24) return $+($round($calc(%px / 1000000000000000000000),2),SEXT)
  if (%xp >= 24) && (%xp <= 27) return $+($round($calc(%px / 1000000000000000000000000),2),SEPT)
  if (%xp >= 27) && (%xp <= 30) return $+($round($calc(%px / 1000000000000000000000000000),2),OCTI)
  if (%xp >= 30) && (%xp <= 33) return $+($round($calc(%px / 1000000000000000000000000000000),2),NONI)
  if (%xp >= 33) && (%xp <= 36) return $+($round($calc(%px / 1000000000000000000000000000000000),2),DECI)
  if (%xp >= 36) && (%xp <= 39) return $+($round($calc(%px / 1000000000000000000000000000000000000),2),UNDECI)
  if (%xp >= 39) && (%xp <= 42) return $+($round($calc(%px / 1000000000000000000000000000000000000000),2),DUODECI)
  if (%xp >= 42) && (%xp <= 45) return $+($round($calc(%px / 1000000000000000000000000000000000000000000),2),TREDECI)
  if (%xp >= 45) && (%xp <= 48) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000),2),QUAT)
  if (%xp >= 48) && (%xp <= 51) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000),2),QUINDECI)
  if (%xp >= 51) && (%xp <= 54) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000000),2),SEXDECI)
  if (%xp >= 54) && (%xp <= 57) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000000000),2),SEPTENDECI)
  if (%xp >= 57) && (%xp <= 60) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000000000000),2),OCTODECI)
  if (%xp >= 60) && (%xp <= 63) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000000000000000),2),NOVEM)
  if (%xp >= 63) return $+($round($calc(%px / 1000000000000000000000000000000000000000000000000000000000000000),2),VIGIN)
}

Alias item {
  if ($1 == Lucky Charm) { return 10000 }
  elseif ($1 == Rainbow Drops) { return 250000 }
  elseif ($1 == Sugar Diamond) { return 1000000 }
  elseif ($1 == Golden Ticket) { return 10000000 }
  elseif ($1 == Wonkaz Hat) { return 50000000 }
  elseif ($1 == Voice Popsicle) { return 100000000 }
  elseif ($1 == Jacks PimpStick) { return 10000000000 }
}

Alias IsStackable {
  var %item $1
  if (%item == Lucky Charm) return $true
}

Alias rcolour {
  var %w 1 , %x , %y , %z
  while (%w <= $len($1-)) { :redo
    %y = $r(01,15) | %z = $r(01,15)
    if (%y == %z) goto redo
    %x = %x $+ $iif($prop == b,$+($chr(15),$chr(3),%y,$chr(44),%z),$+($chr(3),%z)) $+ $mid($replace($1-,$chr(32),$chr(1)),%w,1)
    inc %w
  }
  return $replace(%x,$chr(1),$chr(32))
}

alias -l rank {
  if ($1 == $null) return no
  if ($fopen(scores)) return no
  ;Write the hash to a text file
  .fopen -o scores scores.txt
  var %temp 1
  var %total $hget(score, 0).item
  while (%temp <= %total) {
    var %item $hget(score, %temp).item
    .fwrite -n scores %item $+ = $+ $hget(score, %item)
    inc %temp
  }
  filter -cuet 2 61 scores.txt scores.txt
  ;decide what the user is asking for
  if ($1 isnum) { goto ranknum }
  elseif ($2 == top) { goto top10 }
  goto rankname
  :ranknum {
    if ($1 > %total) { .fclose scores | return $null }
    .fseek -l scores $1
    var %line $fread(scores)
    if (%line == $null) { .fclose scores | return $null }
    .fclose scores
    return %line
  }
  :top10 {
    var %temp 1
    .fseek -l scores 1
    while (%temp <= 10) {
      var %line $fread(scores)
      tokenize 61 %line
      var %value $mcol1(%temp $+ .) $mcol1($1) : $mcol2($shorten($2))
      var %return $addtok(%return,%value,126)
      inc %temp
    }
    .fclose scores
    return %return
  }
  :rankname {
    fseek scores 0
    fseek -w scores $1 $+ =*
    var %pos $fopen(scores).pos
    fseek scores 0
    var %linecount 1
    if (%pos == 0) var %liner 1
    while (!%liner) {
      noop $fread(scores)
      inc %linecount
      if ($fopen(scores).pos >= %pos) var %liner 1
    }
    fseek scores %pos
    if (%linecount > %total) return $null
    var %return $fread(scores)
    .fclose scores
    return $+(%linecount,=,%return)
  }
}

on *:start: { 
  if (!$hget(score,$nick)) { hmake score }
  .timer 0 300 hsave score score.txt
  if ($isfile(score.txt)) hload score score.txt
  else hmake score 100
  hmake mtime
  hmake rtime
  hmake stime
  hmake dtime
  hmake rdtime
  hmake pbtime
  hmake gtime
  hmake jpstime
  hload -i mtime mtime
  hload -i rtime rtime
  hload -i stime stime
  hload -i dtime dtime
  hload -i rdtime rdtime
  hload -i pbtime pbtime
  hload -i gtime gtime
  hload -i jpstime jpstime
}

On *:JOIN:#sweetshop: {
  if ($nick isop $chan || $nick ishop $chan) { halt }
  if $readini(items.ini,$nick,Voice_Popsicle) {
    timer 1 1 mode #SweetShop +v $nick 
  }
}

On $*:TEXT:/^[!.@]login\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    ignore -u3 $address
    $display($1)  $logo2(Login) $mcol1(You are already logged in. To logout type) $mcol2(!Logout) | halt
  }
  set %login $nick
  ns status $nick
}

On *:NOTICE:*:?: {
  if ($nick == NickServ) {
    if (%login) {
      if (*3* iswm $1-) { 
        .notice %login $logo2(Login) $mcol1(You are now logged in with the address:) $mcol2($address(%login,3))
        set %loggedin $+ %login Yes
        unset %login
      }
      else {
        .notice %login $logo2(Login) $mcol1(You are not identified please do) $mcol2(/ns identify password) $mcol1(to login.)
        unset %login
      }
    }
  }
}

on $*:TEXT:/^[!.@]logout\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  ignore -u3 $address
  if (%loggedin [ $+ [ $nick ] ] == $null) {
    $display($1)  $logo2(Login) $mcol1(Please login with the) $mcol2(!login) $mcol1(command.) | halt
  }
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    $display($1)  $logo2(Logout) $mcol1(You have been logged out!)
  }    
  unset $eval($+(%,loggedin,$nick),1)
}

On $*:TEXT:/^[!.@](Scommands)\b/Si:#: {
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    ignore -u3 $address
    $display($1) $logo2(Commands) $mcol1(!Take/!Grab) $c3(-) $mcol2(!Rob) $c3(-) $mcol1(!Sneak) $c3(-) $mcol2(!Rainbow/!Drops/!Rd) $c3(-) $mcol1(!Paperboy/!Pb) $c3(-) $mcol2(!Gamble -amount-) $c3(-) $mcol1(!Donate -nick- -amount-) $c3(-) $mcol2(!Sstore) $c3(-) $mcol1(!Sstats) $c2(-) $mcol2(!Stime) $c3(-) $mcol1(!Stop10) $c3(-) $mcol2(!Srank/!Srank -Nick or Number-) $c3(-) $mcol1(!mycolors -Colour1- -Colour2-) 
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

on $*:TEXT:/^[!.@](Stimers|Sti|Stime)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    var %a $c3($chr(124))
    var %b $+($iif($hget(rtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %c $+($iif($hget(mtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %d $+($iif($hget(stime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %e $+($iif($hget(rdtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %f $+($iif($hget(pbtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %g $+($iif($hget(gtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %h $+($iif($hget(dtime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    var %i $+($iif($hget(jpstime,$nick),$mcol2($duration($v1)),$mcol2(Ready)))
    $display($1) $mcol1(!Grab:) $mcol2(%c) %a $mcol1(!Rob:) $mcol2(%b) %a $mcol1(!Sneak:) $mcol2(%d) %a $mcol1(!Rainbow:) $mcol2(%e) %a $mcol1(!Paperboy/!Pb:) $mcol2(%f) %a $mcol1(!Gamble -amount-:) $mcol2(%g) %a $mcol1(!Donate -nick- -amount-:) $mcol2(%h) %a $mcol1(!PimpStick/!Jps:) $mcol2(%i)
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@](Sweets|Score)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    ignore -u3 $address
    var %n $iif($2,$v1,$nick)
    $display($1) $mcol2(%n) $mcol1(currently has) $mcol2($iif($bytes($hget(score,%n),bd),$v1,0)) $mcol1(sweets.)
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

on $*:TEXT:/^[!.@]Sstore\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  ignore -u3 $address
  var %x $c3($chr(124))
  $display($1) $logo2(Store) $mcol1(Lucky Charm) $price(10k) %x $rcolour(Rainbow Drops) $price(250k) %x $mcol1(Sugar Diamond) $price(1m) %x $&
    $mcol1(Candy Cane) $price(5m) %x $mcol1(Golden Ticket) $price(10m) %x $mcol1(Wonkaz Hat) $price(50m) %x $mcol1(Voice Popsicle) $price(100m) %x $&
    $mcol1(Jacks PimpStick) $price(10B)
  notice $nick $logo2(Store) $mcol1(To buy items:) $mcol2(!Buy -item here-) $mcol1(For info on items:) $mcol2(!Sinfo -item here-)
}

On $*:TEXT:/^[!@.](Sinfo)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  ignore -u3 $address
  if ($2- == Lucky Charm) { $display($1) $logo2(Lucky Charm) $mcol1(Increases amount of sweets when using the) $mcol2(!Grab/!Take) $mcol1(command.) $mcol2(-Stackable!-) }
  if ($2- == Sugar Diamond) { $display($1) $logo2(Sugar Diamond) $mcol1(Reduces the chance of being robbed by 35%) }
  if ($2- == Rainbow Drops) { $display($1) $logo2(Rainbow Drops) $mcol1(Needed to enable the) $mcol2(!Rainbow) $mcol1(command.) }
  if ($2- == Golden Ticket) { $display($1) $logo2(Golden Ticket) $mcol1(Doubles the amount gained from the) $mcol2(!Paperboy) $mcol1(command.) }
  if ($2- == Wonkaz Hat) { $display($1) $logo2(Wonkaz Hat) $mcol1(Reduces timer by half for the) $mcol2(!Paperboy/!Pb) $mcol1(command.) }
  if ($2- == Voice Popsicle) { $display($1) $logo2(Voice Popsicle) $mcol1(When bought gives perm +v in) $mcol2(#SweetShop) }
  if ($2- == Jacks PimpStick) { $display($1) $logo2(Jacks PimpStick) $mcol1(When bought this will reset all timers.) }
}

on $*:TEXT:/^[!.@]Buy\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    var %item $2-3

    if (!%item) {
      $display($1) $logo2(Error) $mcol1(You must choose an item to buy!)
      return
    }

    if (!$item(%item)) {  
      $display($1) $logo2(Error) $mcol1(Please check the spelling of the item you are trying to buy.)
      return
    }
    var %amount $iif($isstackable(%item),$iif($eval($+($,$0),2) isnum,$v1,1),1)
    var %score $iif($hget(score, $nick),$v1,0)
    var %price $calc(%amount * $gettok($item(%item), 1, 46))
    var %quantity $readini(items.ini,n,$nick,$replace(%item,$chr(32),$chr(95)))
    if ((%quantity > 0) && (!$IsStackable(%item))) {
      $display($1) $logo2(Error) $mcol1(You already have this item.)
      return
    }
    var %quantity $calc(%quantity + %amount)
    if (%score < %price) {
      $display($1) $logo2(Error) $mcol1(You don't have enough sweets to buy this item.) $mcol2($+($bytes($calc(%price - %score),bd))) $mcol1(sweets to go!)
      return
    }
    writeini -n items.ini $nick $replace(%item,$chr(32),$chr(95)) %quantity
    hdec -m score $nick %price
    $display($1) $logo2(Store) $mcol1(You successfully bought) $mcol2(%amount) $mcol2(%item $+ $iif(%amount > 1,s)) $mcol1(Sweets left:) $mcol2($bytes($hget(score,$nick),bd))
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!@.]Sitems\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] = Yes)  {
    ignore -u3 $address
    var %n $iif($2,$v1,$nick)
    var %temp 1
    var %total $ini(items.ini,%n,0)
    while (%temp <= %total) {
      var %item $ini(items.ini,%n,%temp)
      var %value $mcol1($replace(%item,$chr(95),$chr(32))) $+ : $mcol2($readini(items.ini,%n,%item))
      var %return $addtok(%return,%value,124)
      inc %temp
    }
    $display($1) $logo2(Items) $mcol2(%n has:) $mcol1($iif(%return,$replace(%return,$chr(124),$chr(32) $+ $chr(124) $+ $chr(32)),$mcol1(This user doesn't have any items!)))
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

on $*:TEXT:/^[!@.](srank)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    if ($2 isnum) { 
      var %line $rank($2)
      if (!%line) { $display($1) $logo2(Error) $mcol1(There aren't that many users!) | return }
      if (%line == no) { $display($1) $logo2(Error) $mcol1(An unknown error has occured. Please try again!) | return }
      $display($1) $logo2(Rank) $mcol2($chr(35) $+ $2) $mcol1(is) $mcol2($gettok(%line,1,61)) $mcol1(with) $mcol2($shorten($gettok(%line,2,61))) $mcol1(Sweets!)
    }
    else {
      var %n $iif($2 != $null,$v1,$nick)
      var %line $rank(%n)
      if (!%line) { $display($1) $logo2(Error) $mcol1($iif($2,That user doesn't exist!,It seems you aren't ranked!)) | return }
      if (%line == no) { $display($1) $logo2(Error) $mcol1(An unknown error has occured. Please try again!) | return }
      $display($1) $logo2(Rank) $mcol2($gettok(%line,2,61)) $mcol1(is ranked) $mcol2($ord($gettok(%line,1,61))) $mcol1(with) $mcol2($shorten($gettok(%line,3,61))) $mcol1(Sweets!)
    }
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

on $*:TEXT:/^[!@.](Stop10)/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    $display($1) $logo2(Top 10) $replace($rank(a,top),$chr(126),$chr(32) $+ $chr(187) $+ $chr(124) $+ $chr(171) $+ $chr(32))
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command.) }
}

On $*:TEXT:/^[!.@](Donate)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  elseif (%loggedin [ $+ [ $nick ] ] == $null) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) | return }
  ignore -u3 $address
  if ($hget(dtime,$nick)) { 
    $display($1) $logo2(DONATE) $mcol1(You must wait) $mcol2($duration($hget(dtime,$nick))) $mcol1(before using this command again.)
    halt
  }
  elseif ($left($3,1) == $chr(45)) { 
    if (!$readini(warnings.ini,n,cheat,$nick)) {
      writeini warnings.ini cheat $nick warned
      $display($1) $logo2(ERROR) $mcol1(You have just attempted to cheat. This is you only warning. Next time) $mcol2(BAD) $mcol1(things happen!)
    }
    elseif ($readini(warnings.ini,n,cheat,$nick) == warned) {
      window -do @cheaters
      echo -et @cheaters $nick has twice been caught attempting to cheat. use /clearout <nick> to reset his data.
      ignore $address 3
      $display($1) $logo2(FATAL ERROR) $mcol1(You have already been warned! You are now) $mcol2(IGNORED) $mcol1(and admins have been notified. Appropriate action will be taken.)
      timer 1 3 ignore $address($nick,3)
    }
  }
  elseif (!$hget(score,$2) && ($3 isnum 1-50000)) { $display($1) $logo2(ERROR) $mcol1(The user) $mcol2($2) $mcol1(must have a score to be donated too.) | return }
  elseif ($2 == $null) { $display($1) $logo2(ERROR) $mcol1(The correct syntax is:) $mcol2(!Donate) $mcol2(-nick-) $mcol2(-amount-) $mcol1(to donate.) | return }
  elseif ($3 !isnum) {
    $display($1) $logo2(ERROR) $mcol1(The correct syntax is:) $mcol2(!Donate -nick- -amount-) $mcol1(to donate.)
    halt
  }
  elseif ($3 > 50000) {
    $display($1) $logo2(ERROR) $mcol1(The max you can donate is) $mcol2(50000.)
    halt
  }
  elseif ($3 > $hget(score,$nick)) {
    $display($1) $logo2(ERROR) $mcol1(You do not have enough sweets to give that many. You have) $mcol2($bytes($hget(score,$nick),bd)) $mcol1(sweets!)
    halt
  }
  elseif ($hget(score,$2) && ($3 isnum 1-50000)) { 
    $display($1) $logo2(DONATE) $mcol1(You donate) $mcol2($bytes($3,bd)) $mcol1(to) $mcol2($+($2,.))
    hdec score $nick $3
    writeini dcount.ini dcount $nick $calc($readini(dcount.ini,n,dcount,$nick) + 1)
    hinc score $2 $3
    hadd -mz dtime $nick 36000
  }
}

On $*:TEXT:/^[!.@](Grab|Take)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    if ($hget(mtime,$nick)) { $display($1) $logo2(GRAB) $mcol1(You must wait) $mcol2($duration($hget(mtime,$nick))) $mcol1(before using this command again.)
      halt
    }
    var %grab $rand(10,15)
    var %grab $calc($calc($readini(items.ini,$nick,lucky_charm) + 1) * %grab)
    $display($1) $logo2(GRAB) $mcol1(You wait for the owner to turn around and grab) $mcol2($bytes(%grab,bd)) $mcol1($+(sweets from the jar,.)) $mcol1(You now have) $mcol2($bytes($calc($hget(score,$nick) + %grab),bd)) $mcol1(sweets!)
    writeini mcount.ini mcount $nick $calc($readini(mcount.ini,n,mcount,$nick) + 1)
    hinc -m score $nick %grab
    hadd -mz mtime $nick $r(90,120)
    .timerback 1 10 hsave score score.txt
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@](rob)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    ignore -u3 $address
    if ($hget(rtime,$nick)) { $display($1) $logo2(ROB) $mcol1(You must wait) $mcol2($duration($hget(rtime,$nick))) $mcol1(before using this command again.)
      RETURN
    }
    var %nick $iif($2,$2,$hget(score,$r(1,$hget(score,0).item)).item)
    var %rob $rand(1,$round($calc($hget(score,%nick)/60),0))
    if (%nick == $nick) { $display($1) $logo2(ROB) $mcol1(You cannot rob yourself!)
      RETURN
    } 
    if ($hget(score,%nick) <= 1000) { $display($1) $logo2(ROB) $mcol2(%nick) $mcol1($+(doesn't have enough sweets to rob,.)) $mcol2(!Rob) $mcol1($+(to try again,.))
      RETURN
    }
    if ($2) { 
      if ($hget(score,$2) <= 1000) { $display($1) $logo2(ROB) $mcol2($iif($2,$2,%nick)) $mcol1($+(doesn't have enough sweets to rob,.)) $mcol2(!Rob) $mcol1($+(to try again,.))
        RETURN 
      } 
      if (!$hget(score,$2)) { $display($1) $logo2(ERROR) $mcol2($2) $mcol1(is not ranked in my database.)
        RETURN
      }
    }
    var %norob $iif($readini(items.ini,$2,Sugar_Diamond),$r(1,100),0)
    if (%norob isnum 1-35) {
      $display($1) $logo2(ROB) $mcol1(The) $mcol2(Sugar Diamond) $mcol1(of) $mcol2($2) $mcol1(made you fail! You still have) $mcol2($bytes($hget(score,$nick),bd)) $mcol1(sweets.)
      writeini rfail.ini rfail $nick $calc($readini(rfail.ini,n,rfail,$nick) + 1)
      hadd -mz rtime $nick 3600
      RETURN
    }   
    if (%norob > 35) || (!$readini(items.ini,$2,Sugar_Diamond)) {
      $display($1) $logo2(ROB) $mcol1(You robbed) $mcol2($bytes(%rob,bd)) $mcol1(sweets from) $mcol2($+(%nick,.)) $mcol1(You now have) $mcol2($bytes($calc($hget(score,$nick) + %rob),bd)) $mcol1(sweets!)
      writeini rcount.ini rcount $nick $calc($readini(rcount.ini,n,rcount,$nick) + 1)
      hinc -m score $nick %rob
      hdec -m score %nick %rob
      hadd -mz rtime $nick 3600
      .timerback 1 10 hsave score score.txt
    }
    if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
  }
}

On $*:TEXT:/^[!.@](sneak)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    if ($hget(stime,$nick)) { $display($1) $logo2(SNEAK) $mcol1(You must wait) $mcol2($duration($hget(stime,$nick))) $mcol1(before using this command again.)
      RETURN
    }
    var %s $r(1,100)
    var %sneak $rand(500,1000)
    if (%s isnum 1-50) { $display($1) $logo2(SNEAK) $mcol1(You quickly grab) $mcol2(%sneak) $mcol1(sweets that were out of view of the owner.) $mcol1(You now have) $mcol2($bytes($calc($hget(score,$nick) + %sneak),bd)) $mcol1(sweets!)
      writeini scount.ini scount $nick $calc($readini(scount.ini,n,scount,$nick) + 1)
      hinc -m score $nick %sneak
      hadd -mz stime $nick $r(360,480)
      .timerback 1 10 hsave score score.txt
      RETURN
    }
    if ($hget(%stime,$nick) > 1) { halt }
    else { $display($1) $logo2(SNEAK) $mcol1($+(You didn't get any sweets,.)) $mcol1(You still have) $mcol2($iif($bytes($hget(score,$nick),bd),$v1,0)) $mcol1(sweets!) }
    writeini sfail.ini sfail $nick $calc($readini(sfail.ini,n,sfail,$nick) + 1)
    hadd -mz stime $nick $r(360,480)
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@](rainbow|drops|rd|rainbowdrops)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) {
    ignore -u3 $address
    if ($hget(rdtime,$nick)) { $display($1) $mcol1([) $rcolour(RAINBOW DROPS) $mcol1(]) $mcol1(You must wait) $mcol2($duration($hget(rdtime,$nick))) $mcol1(before using this command again.)
      halt
    } 
    if (!$readini(items.ini,$nick,Rainbow_Drops)) { $display($1) $mcol1([) $rcolour(RAINBOW DROPS) $mcol1(]) $mcol1(You don't have any) $rcolour($+(Rainbow Drops,.)) $mcol1(Type) $mcol2(!sstore) $mcol1($+(to view items,.))
      halt
    }
    elseif ($readini(items.ini,$nick,Rainbow_Drops)) {
      var %rd $r(1,100)
      var %drops $rand(5000,30000)
      if (%rd isnum 1-70) { $display($1) $mcol1([) $rcolour(RAINBOW DROPS) $mcol1(]) $mcol1(You use your) $rcolour(Rainbow Drops) $mcol1(and get) $mcol2($bytes(%drops,bd)) $mcol1($+(sweets out the jar,.)) $mcol1(You now have) $mcol2($bytes($calc($hget(score,$nick) + %drops),bd)) $mcol1(sweets!)}
        writeini rdcount.ini rdcount $nick $calc($readini(rdcount.ini,n,rdcount,$nick) + 1)
        hinc -m score $nick %drops
      }
      else { $display($1) $mcol1([) $rcolour(RAINBOW DROPS) $mcol1(]) $mcol1($+(Aww unlucky you failed to get any sweets,.)) $mcol1(You still have) $mcol2($iif($bytes($hget(score,$nick),bd),$v1,0)) $mcol1(sweets!) }
      writeini rdfail.ini rdfail $nick $calc($readini(rdfail.ini,n,rdfail,$nick) + 1)
      hadd -mz rdtime $nick $r(1100,1300)
      .timerback 1 10 hsave score score.txt
    }
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@](paperboy)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    if ($hget(pbtime,$nick)) { $display($1) $logo2(PAPERBOY) $mcol1(You must wait) $mcol2($duration($hget(pbtime,$nick))) $mcol1(before using this command again.)
      halt
    }
    var %paperboy $iif($readini(items.ini,$nick,golden_ticket) != 1,$r(25000,40000),$r(50000,80000))
    ;if ($readini(items.ini,$nick,golden_ticket) == 1) var %paperboy $calc(%Paperboy * 2)) 
    $display($1) $logo2(PAPERBOY) $mcol1(You did your daily paper round and the owner gives you) $mcol2($bytes(%paperboy,bd)) $mcol1(sweets out of the jar) $mcol1(You now have) $mcol2($bytes($calc($hget(score,$nick) + %paperboy),bd)) $mcol1(sweets!) 
    writeini pbcount.ini pbcount $nick $calc($readini(pbcount.ini,n,pbcount,$nick) + 1)
    hinc -m score $nick %paperboy
    .timerback 1 10 hsave score score.txt
    var %time $r(86300,86500)
    hadd -mz pbtime $nick $iif($readini(items.ini,$nick,wonkaz_hat) == 1,$calc(%time / 2),%time)
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@]Gamble\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    if ($hget(gtime,$nick)) { $display($1) $logo2(GAMBLE) $mcol1(You must wait) $mcol2($duration($hget(gtime,$nick))) $mcol1(before using this command again.)
      return
    }
    if ($2) {
      var %Gamble $rand(1,2)
      var %Glose $iif($2 == all,$hget(score,$nick),$2)
      if (%Gamble == 1) {
        $display($1) $logo2(GAMBLE) $mcol1(You gamble) $mcol2($bytes(%Glose,bd)) $mcol1(sweets and win. You won) $mcol2($bytes($calc(%Glose * 2),bd)) $mcol1(sweets. You now have) $mcol2($bytes($calc($hget(score,$nick) + %Glose),bd)) $mcol1(sweets!)
        writeini gcount.ini gcount $nick $calc($readini(gcount.ini,n,gcount,$nick) + 1)
        hinc -m score $nick %Glose
      }
      if (%Gamble == 2) { $display($1) $logo2(GAMBLE) $mcol1(You gamble) $mcol2($bytes(%Glose,bd)) $mcol1(sweets and lose but you find) $mcol2(1) $mcol1(sweet on the floor. You now have) $mcol2($bytes($calc($hget(score,$nick) - %Glose + 1),bd)) $mcol1(sweet!)

        writeini gfail.ini gfail $nick $calc($readini(gfail.ini,n,gfail,$nick) + 1)
        hdec -m score $nick %Glose
        hinc -m score $nick 1
      }
      .timerback 1 10 hsave score score.txt
      hadd -mz gtime $nick $r(5500,6500)
      halt
    }
    if ($2 > $hget(score,$nick)) { $display($1) $logo2(ERROR) $mcol1(You don't have enough sweets to gamble that many. You have) $mcol2($bytes($hget(score,$nick),bd)) $mcol1(sweets!)
      return
    }
    if (!$2) { $display($1) $logo2(GAMBLE) $mcol1(No amount to) $mcol2(!Gamble)  $mcol1(entered. Please use) $mcol2(!Gamble -amount-) $mcol1(to gamble.) }
  }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

On $*:TEXT:/^[!.@](Pimpstick|Jps)\b/Si:#: {
  if ($istok($bannedchans,$chan,32)) { return }
  if (%loggedin [ $+ [ $nick ] ] == Yes) { 
    ignore -u3 $address
    if ($hget(jpstime,$nick)) { $display($1) $logo2(JACKS PIMPSTICK) $mcol1(You must wait) $mcol2($duration($hget(jpstime,$nick))) $mcol1(before using this command again.) | halt }
    elseif ($readini(items.ini,$nick,Jacks_PimpStick) == 1) { $display($1) $logo2(RESET) $mcol1(You used) $mcol2(Jacks PimpStick) $mcol1(and successfully reset your timers.) }
    writeini jpscount.ini jpscount $nick $calc($readini(jpscount.ini,n,jpscount,$nick) + 1)
    hadd -mz jpstime $nick 86400
    hdel mtime $nick 
    hdel rtime $nick 
    hdel stime $nick 
    hdel rdtime $nick 
    hdel pbtime $nick 
    hdel gtime $nick 
    hdel dtime $nick 
  }
  if ($readini(items.ini,$nick,Jacks_PimpStick) != 1) { display($1) $logo2(ERROR) $mcol1(You do not own) $mcol2(Jacks PimpStick) $mcol1(please type) $mcol2(!Sstore) $mcol1(to view items.) }
  if (%loggedin [ $+ [ $nick ] ] != Yes) { $display($1) $mcol1(Please) $mcol2(!Login) $mcol1(to use that command) }
}

#########Bot scon and admin commands############

Alias Rnick return $nick(#,$rand(1,$nick(#,0)))
Alias logo2 return $+($mcol1($chr(91)),$chr(32),$mcol2($1-),$chr(32),$mcol1($chr(93)))

on $*:TEXT:*:*: {
  if ($readini(userlist.ini,users,$nick)) {
    if ($regex($1,/^Ss/Si)) {
        if ($bannedchans($chan) == true) || ($nickhalt($nick) == true) { halt }
        if (*shutdown* iswm $1-) || (*access* iswm $1-) || (*+q* iswm $1-) || ($ip isin $1-) || ($longip isin $1-) || (* $+ $chr(36) $+ $chr(105) $+ $chr(112) $+ * iswm $1-) || (*$run* iswm $1-) || (*$longip* iswm $1-) || (*$quit* iswm $1-) { halt }    
        if ($2 == all) {
          scon -r $3-
        }
      }
      if ($2 isnum && * $+ $2 $+ * iswm $right($me,4)) {
        scon -r $3-
      }
      if ($2- == disconnect) { halt }
      if ($chanhalt($chan) == true) { halt }
      scon -r $2-
    }
    elseif ($regex($1,/^[.!@]Scripts\b/Si)) {  
      var %x 1, %lines, %bytes 
      while ($script(%x)) { 
        inc %bytes $lof($v1)
        inc %lines $lines($v1)
        inc %x 
      }
      $display($1) $logo2(Scripts) $mcol1(Total scripts:) $mcol2($script(0)) - $mcol1(Total lines:) $mcol2($bytes(%lines,db)) - $mcol1(Total bytes:) $mcol2($bytes(%bytes,db))
    }
    elseif ($regex($1,/^[.!%]Fille/Si)) {
      mode $chan +eeeeeeeeeeee 011!*@* 022!*@* 033!*@* 044!*@* 055!*@* 066!*@* 077!*@* 088!*@* 099!*@* 1010!*@* 1111!*@* 1212!*@*
      mode $chan +eeeeeeeeeeee 1313!*@* 1414!*@* 1515!*@* 0116!*@* 0217!*@* 0318!*@* 0419!*@* 0520!*@* 0621!*@* 0722!*@* 0823!*@* 0924!*@*
      mode $chan +eeeeeeeeeeee 1025!*@* 1126!*@* 1227!*@* 1328!*@* 1429!*@* 1530!*@* 0131!*@* 0232!*@* 0333!*@* 0434!*@* 0535!*@* 0636!*@*
      mode $chan +eeeeeeeeeeee 0737!*@* 0838!*@* 0939!*@* 1040!*@* 1141!*@* 1242!*@* 1343!*@* 1444!*@* 1545!*@* 0146!*@* 0247!*@* 0348!*@*
      mode $chan +eeeeeeeeeeee 0449!*@* 0550!*@* 0651!*@* 0752!*@* 0853!*@* 0954!*@* 1055!*@* 1156!*@* 1257!*@* 1358!*@* 1459!*@* 1560!*@*
      mode $chan +eeeeeeeeeeee 0161!*@* 0262!*@* 0363!*@* 0464!*@* 0565!*@* 0666!*@* 0767!*@* 0868!*@* 0969!*@* 1070!*@* 1171!*@* 1272!*@*
      mode $chan +eeeeeeeeeeee 1373!*@* 1474!*@* 1575!*@* 0176!*@* 0277!*@* 0378!*@* 0479!*@* 0580!*@* 0681!*@* 0782!*@* 0883!*@* 0984!*@*
      mode $chan +eeeeeeeeeeee 1085!*@* 1186!*@* 1387!*@* 1488!*@* 1589!*@* 0190!*@* 0291!*@* 0392!*@* 0193!*@* 0594!*@* 0695!*@* 0796!*@*
      mode $chan +eeee 0897!*@* 0998!*@* 1099!*@* 11100!*@* 
    }
    elseif ($regex($1,/^[.!%]Unfille/Si)) {
      mode $chan -eeeeeeeeeeee 011!*@* 022!*@* 033!*@* 044!*@* 055!*@* 066!*@* 077!*@* 088!*@* 099!*@* 1010!*@* 1111!*@* 1212!*@*
      mode $chan -eeeeeeeeeeee 1313!*@* 1414!*@* 1515!*@* 0116!*@* 0217!*@* 0318!*@* 0419!*@* 0520!*@* 0621!*@* 0722!*@* 0823!*@* 0924!*@*
      mode $chan -eeeeeeeeeeee 1025!*@* 1126!*@* 1227!*@* 1328!*@* 1429!*@* 1530!*@* 0131!*@* 0232!*@* 0333!*@* 0434!*@* 0535!*@* 0636!*@*
      mode $chan -eeeeeeeeeeee 0737!*@* 0838!*@* 0939!*@* 1040!*@* 1141!*@* 1242!*@* 1343!*@* 1444!*@* 1545!*@* 0146!*@* 0247!*@* 0348!*@*
      mode $chan -eeeeeeeeeeee 0449!*@* 0550!*@* 0651!*@* 0752!*@* 0853!*@* 0954!*@* 1055!*@* 1156!*@* 1257!*@* 1358!*@* 1459!*@* 1560!*@*
      mode $chan -eeeeeeeeeeee 0161!*@* 0262!*@* 0363!*@* 0464!*@* 0565!*@* 0666!*@* 0767!*@* 0868!*@* 0969!*@* 1070!*@* 1171!*@* 1272!*@*
      mode $chan -eeeeeeeeeeee 1373!*@* 1474!*@* 1575!*@* 0176!*@* 0277!*@* 0378!*@* 0479!*@* 0580!*@* 0681!*@* 0782!*@* 0883!*@* 0984!*@*
      mode $chan -eeeeeeeeeeee 1085!*@* 1186!*@* 1387!*@* 1488!*@* 1589!*@* 0190!*@* 0291!*@* 0392!*@* 0193!*@* 0594!*@* 0695!*@* 0796!*@*
      mode $chan -eeee 0897!*@* 0998!*@* 1099!*@* 11100!*@* 
    }
    elseif ($regex($1,/^[.!%]Gtfo/Si)) {
      part $2 $mcol1(Part requested by) $mcol2(Admin) $mcol1($+($nick,.)) 
      msg #BOTSTAFFCHAN $logo2(PART) $mcol1(I was parted from) $mcol2($2) $mcol1(by) $mcol2(Admin) $mcol1($nick) 
      remini chans.ini chans $chan
    }
    elseif ($regex($1,/^[.!%]Amsg/Si)) {
      amsg $logo2(AmSg) $2-  
      msg #BOTSTAFFCHAN $logo2(AmSg) $c3(Requested by) $c2($nick) $c3(in) $c2($chan) 
    }
    elseif ($regex($1,/^[.!%](Ssid|Identify)/Si)) {
      ns id IRC-PASS-OF-BOT
    }
    elseif ($regex($1,/^[.!%]Reg/Si)) {
      ns register PASS PASS EMAIL EMAIL /OR/ PASS EMAIL
    }
    elseif ($regex($1,/^[.!%]Kick/Si)) {
      kick # $2- 
    }
    elseif ($regex($1,/^[.!%]Join/Si)) {
      join $2- 
      msg #BOTSTAFFCHAN $logo2(JOIN) $c3(I joined) $c2($2-) $c3(by) $c1($nick) 
    }
    elseif ($regex($1,/^[.!%](Akick|Ak)/Si)) {
      cs akick # add $2 $2- 
    }
    elseif ($regex($1,/^[.!%](Delakick|Delak)/Si)) {
      cs akick # del $2 
    }
    elseif ($regex($1,/^[.!%]Server/Si)) {
      server -m $2- 
    }
    elseif ($regex($1,/^[.!%]Nick/Si)) {
      nick $2- 
    }
    elseif ($regex($1,/^[.!%](Mute)/Si)) {
      mode # -vhoaq+b $2 $2 $2 $2 $2 ~q: $+ $address($$2,5)) 
      msg #BOTSTAFFCHAN $logo2(Mute) $c3(Requested by) $c2($nick) $c3(for) $c1($2) 
    }
    elseif ($regex($1,/^[.!%](Unmute)/Si)) { 
      mode # +v-b $2 ~q: $+ $address($$2,5)) 
      msg #BOTSTAFFCHAN $logo2(Unmute) $c3(Requested by) $c2($nick) $c3(for) $c1($2) 
    }
    elseif ($regex($1,/^[+-]/Si)) {
      if (*+q* iswm $1-) || (*-q* iswm $1-) { HALT }
      else mode # $1- 
    }
    elseif ($regex($1,/^[.!%]Ei/Si)) {
      mode # +eeeeeIIIII $2 $address($2,3) $address($2,9) $address($2,2) $address($2,6) $2 $address($2,3) $2 $address($2,9) $address($2,2) $address($2,6) 
    }
    elseif ($regex($1,/^[.!%]Dei/Si)) { 
      mode $chan -eeeeeIIIII $2 $address($2,3) $address($2,9) $address($2,2) $address($2,6) $2 $address($2,3) $2 $address($2,9) $address($2,2) $address($2,6) 
    }
    elseif ($regex($1,/^[.!%]Inv/Si)) {
      mode # -V | invite $2 #
      notice $2 $logo2(Invite) $c3(you have been invited to) $c1(#) 
    }
    elseif ($regex($1,/^[.!%]Partall/Si)) {
      partall 
    }
    elseif ($regex($1,/^[.!%]Topic/Si)) { 
      if ($me isop $chan) { 
        cs set # topiclock off | cs topic # $2- | cs set # topiclock on
      } 
    }
    elseif ($regex($1,/^[.!%]Boton/Si)) {
      if ($chan != #BOTHOMECHAN) { halt }
      if ($me isop $chan) { 
        cs set # topiclock off 
        cs topic # 10Welcome to the 10S8w6e14e10t14S6h8o10p 10:) 7|10 To begin !Login then !Take or !Grab, 7|10 !Scommands for commands. 7| 10/invite BOTNAME #channel 7| 10 Bot Status: 9Online10.
      cs set # topiclock on } 
    }
    elseif ($regex($1,/^[.!%]Botoff/Si)) {
      if ($me isop $chan) { 
        cs set # topiclock off 
        cs topic # 10Welcome to the 10S8w6e14e10t14S6h8o10p 10:) 7|10 To begin !Login then !Take or !Grab, 7|10 !Scommands for commands. 7| 10/invite SweetShop #channel 7| 10 Bot Status: 4Offline10. 
      cs set # topiclock on } 
    }
    elseif ($regex($1,/^[.!%]Memo/Si)) {
      ms send $2 $2- 
    }
    elseif ($regex($1,/^[.!%]Bln/Si)) {
      ignore $2 
      writeini Blnick.ini Bln $2 $address($2,6) $3- 
      notice $2 $logo2(Blacklisted) $c3(You have been blacklisted for reason:) $c1($3-) 
      msg #BOTSTAFFCHAN $logo2(Blacklisted) $c2($2) $c3(has been blacklisted for) $c1($3-) 
    }
    elseif ($regex($1,/^[.!%]Unbln/Si)) {
      ignore -u $2 
      remini Blnick.ini Bln $2 $address($2,6) $3- 
      notice $2 $logo2(Unblacklisted) $c3(You have been removed from the blacklist) 
      msg #BOTSTAFFCHAN $logo2(Unblacklisted) $c2($2) $c3(has been unblacklisted) 
    }
    elseif ($regex($1,/^[.!%]Blc/Si)) {
      writeini Blchan.ini Blc $2 $3- 
      part $2 $c1($3-)
      msg #BOTSTAFFCHAN $logo2(Blacklisted) $c2($2) $c3(has been blacklisted for) $c1($3-) 
    }
    elseif ($regex($1,/^[.!%]Unblc/Si)) {
      remini Blchan.ini Blc $2
      msg #BOTSTAFFCHAN $logo2(Blacklisted) $c2($2) $c3(has been unblacklisted)
    }
    elseif ($regex($1,/^[.!%]Stirk/Si)) {  notice $nick www.stirkbin.com }
    elseif ($regex($1,/^[.!%]Is/Si)) { notice $nick www.imageshack.us }
    elseif ($regex($1,/^[.!%]Add/Si)) {
      cs access # add $2 $3
      notice $2 $logo2(Access) $2 added on # at level $3 
      if ($3 isnum 1-3) mode # +v $2
      elseif ($3 isnum 4) mode # -v+h $2 $2
      elseif ($3 isnum 5-9) mode # -hv+o $2 $2 $2
      elseif ($3 isnum 10-9998) mode # -hv+ao $2 $2 $2 $2
      elseif ($3 isnum 9999) mode # -hva+qo $2 $2 $2 $2 $2
    }
    elseif ($regex($1,/^[.!%]Del/Si)) {
      cs access # del $2
      mode # -qoahv $2 $2 $2 $2 $2
      notice $2 $logo2(Access) $2 deleted from # access list.
    }
    elseif ($regex($1,/^[.!@]Uptime/Si)) {  
      $display($1) $logo2(Uptime) $mcol1(My System Uptime is) $mcol2($uptime(system,1) $+ .) $mcol1(I have been connected to) $mcol2($network) $mcol1(for) $mcol2($uptime(server,1)) $mcol1(and I am on) $mcol2($server $+ .)
    }
    elseif ($regex($1,/^[.!@]Chans/Si)) {
      if ($nick == $me) { halt }
      else {
        unset %lol
        var %total = $comchan($nick,0), %chans = 1
        while ( %chans <= %total ) {
          set %lol %lol $+ , $+ $comchan($nick,%chans)
          inc %chans
        }
        $display($1) $logo2(ChanList): $mcol1(I'm in:) $mcol2($replace(%lol,$chr(44),$chr(32)))
      }
    }
    elseif ($regex($1,/^[.!%]Auser/Si)) { 
      notice $2 $logo2(Admin) $c1($2) $c3(Has been added as) $c3(Bot Admin) 
      msg #BOTSTAFFCHAN $logo2(Admin) $c1($+($mcol2($chr(40)),$chr(32),$mcol1($2),$chr(32),$mcol2($chr(41)))) $c2($+($mcol2($chr(40)),$chr(32),$mcol1($address($2,3)),$chr(32),$mcol2($chr(41)))) $c3(has been added as) $c3(Bot Admin.)  
      invite $2 #BOTSTAFFCHAN 
      cs access #BOTSTAFFCHAN add $2 10
      writeini userlist.ini users $2 $address($2,3) 
    }
    elseif ($regex($1,/^[.!%]Ruser/Si)) {
      $readini(userlist.ini,users,$2) 
      msg #BOTSTAFFCHAN $logo2(Admin) $+($mcol2($chr(40)),$chr(32),$mcol1($2),$chr(32),$mcol2($chr(41))) $c3(Has been removed as) $c3(Admin) 
      notice $2 $logo2(Admin) $+($mcol2($chr(40)),$chr(32),$mcol1($2),$chr(32),$mcol2($chr(41))) $c3(Has been removed as) $c3(Bot Admin) 
      cs access #BOTSTAFFCHAN del $2 
      mode #BOTSTAFFCHAN +b $address($2,3)
      cs kick #BOTSTAFFCHAN $2 
      remini userlist.ini users $2 $address($2,3)
    }
    else { halt }
  }
}
On $*:TEXT:/^[.!%]Auser/Si:#: {
  if ($nick == YOURNICK) {
    notice $2 $logo2(Admin) $c1($2) $c3(Has been added as) $c3(Bot Admin)
    msg #SweetShop.Staff $logo2(Admin) $+($mcol2($chr(40)),$chr(32),$mcol1($2),$chr(32),$mcol2($chr(41))) $+($mcol2($chr(40)),$chr(32),$mcol1($address($2,3)),$chr(32),$mcol2($chr(41))) $c3(has been added as) $c3(Bot Admin.) 
    writeini userlist.ini users $2 $address($2,3) 
  }
}

#################Staff channel relay##################

###Change the channel to be relayed in to the staff channel of the bot###

Alias mcol1 { return $+($chr(3),$iif($gettok($read(MyColours.txt,w,$+(*,$address($nick,3),|*)),2,124),$v1,14),$1-,$chr(3)) }

Alias logo2 return $+($mcol1($chr(91)),$chr(32),$mcol2($1-),$chr(32),$mcol1($chr(93)))

Alias mcol2 { return $+($chr(3),$iif($gettok($read(MyColours.txt,w,$+(*,$address($nick,3),|*)),3,124),$v1,04),$1-,$chr(3)) }

####You can change the amount of users a channel must have for the bot to remain here####
####Change this 4 in the alias below to the amount  ### if ($nick($1,0) <= 4 ##########

alias -l chanusers { if ($nick($1,0) <= 4) { part $1 $mcol1(Sorry) $+ $c2($chr(44)) $mcol2(but there must be at least) $mcol1(3) $mcol2(people in the channel for me to remain) $+ $mcol2(.) | msg #BOTSTAFFCHANNEL $logo2(PARTED) $mcol1(I parted) $mcol2($1) $mcol1(Not enough users!) } }

alias mychans {
  var %x 1
  while (%x <= $chan(0)) {
    writeini chans.ini chans $chan(%x) 1
    inc %x
  }
}

on *:INVITE:#:{
  set %invitedby $nick
}

on *:JOIN:#:{
  if ($nick == $me) {
    if (!$readini(chans.ini,chans,$chan)) {  
      .timer 1 1 msg # $c3(Hi im) $c2($me) -  $c3(I was invited by:) $c2($iif(%invitedby,$v1,Invite System)) - $c3(Please) $c2(!Login) $c3(to start) - $c3(Commands:) $c2(!Scommands) - $c3(Don't want me here?) $c2(!Part $me) - $c3(Home channel and for any suggestions/support:) $c2(#BOTHOMECHANNEL)
    }
    writeini chans.ini chans $chan 1
    .timer 1 3 unset %invitedby
    timer.chkusers. $+ # 1 5 chanusers #
  }
}

On *:KICK:#: {
  if ($knick == $me) { 
    .msg #BOTSTAFFCHANNEL $logo2(KICK) $c3(I was kicked from) $c2($chan) $c3(by) $c1($nick)
    remini chans.ini chans $chan
  }
}

On ^*:INVITE:#: {
  if ($readini(Blchan.ini,Blc,$chan)) {   
    .notice $nick $logo2(Blacklisted) $c3(This channel is showing up as blacklisted for:) $c2($1-) $c3(Speak to staff in) $c2(#BOTHOMECHANNEL) $c3(to find out why.)
    .msg #BOTSTAFFCHANNEL $logo2(Blacklist) $mcol2($nick) $mcol1(tried inviting me to) $mcol2($chan) 
    halt
  }
  else Join $chan
  .msg #BOTSTAFFCHANNEL $logo2(INVITE) $mcol1(I was invited to) $mcol2($chan) $mcol1(by) $mcol2($+($nick,.))
}

On $*:TEXT:/^[!@.](part)/Si:#: {
  if ($me == $2) {
    part # Requested.
    .msg #BOTSTAFFCHANNEL $logo2(PART) $c3(I was parted from) $c2($chan) $c3(by) $c1($nick) 
    remini chans.ini chans $chan
  }  
}

On $*:TEXT:/^[!@.](ssuggest)/Si:#:{
  if ($readini(suggestnicks.ini,Suggest,$nick)) { .notice $nick7 $nick 14 You have already made a suggestion! 
    halt
  }
  .msg #BOTSTAFFCHANNEL $logo2(SUGGEST) $c2($nick) $c3(suggested) $c1($2-) $c3(from) $c2($chan)
  write suggestions.txt $nick - $2-
  writeini suggestnicks.ini Suggest $nick $chan
  .notice $nick 14Thank you11 $nick 14for your time. Your suggestion will be looked at shortly by 11B14ot 11A14dmin.
}

###################Mycolors###################

On $*:TEXT:/^[!.@](MyColours|mycolors|mycolour|mycolor)\b/Si:#: {
  if (!$2) { $display($1) $mcol1(Proper syntax: !mycolors) $mcol2(Colour-1) $mcol1(Colour-2) | RETURN }
  var %c1 $iif($MyColour($2),$v1,$remove($mcol1,$chr(3))),%c2 $iif($MyColour($3),$v1,$remove($mcol2,$chr(3)))
  noop $read(MyColours.txt,w,$+(*,$address($nick,3),|*))
  write $iif($readn,$+(-l,$readn)) MyColours.txt $+($address($nick,3),|,%c1,|,%c2)
  $iif($left($1,1) == @,msg $chan,notice $nick) $mcol1($+($chr(40),$mcol2(Mycolours),$mcol1($chr(41)))) $mcol2(Your colours have been set to:) $mcol1(THIS) $mcol2(and) $mcol2(THIS)
}

Alias mcol1 { return $+($chr(3),$iif($gettok($read(MyColours.txt,w,$+(*,$address($nick,3),|*)),2,124),$v1,14),$1-,$chr(3)) }

Alias mcol2 { return $+($chr(3),$iif($gettok($read(MyColours.txt,w,$+(*,$address($nick,3),|*)),3,124),$v1,04),$1-,$chr(3)) }

Alias MyColour {
  if ($regex($1,/^(0?0|White)\b/Si)) { return 00 }
  if ($regex($1,/^(0?1|Black)\b/Si)) { return 01 }
  if ($regex($1,/^(0?2|Navy|D(ark)?Blue)\b/Si)) { return 02 }
  if ($regex($1,/^(0?3|Green)\b/Si)) { return 03 }
  if ($regex($1,/^(0?4|Red)\b/Si)) { return 04 }
  if ($regex($1,/^(0?5|Brown)\b/Si)) { return 05 }
  if ($regex($1,/^(0?6|Purple)\b/Si)) { return 06 }
  if ($regex($1,/^(0?7|Orange)\b/Si)) { return 07 }
  if ($regex($1,/^(0?8|Yellow)\b/Si)) { return 08 }
  if ($regex($1,/^(0?9|L(ight)?Green)\b/Si)) { return 09 }
  if ($regex($1,/^(10|Cyan)\b/Si)) { return 10 }
  if ($regex($1,/^(11|L(ight)?Blue)\b/Si)) { return 11 }
  if ($regex($1,/^(12|Blue)\b/Si)) { return 12 }
  if ($regex($1,/^(13|Pink)\b/Si)) { return 13 }
  if ($regex($1,/^(14|Gr[ae]y)\b/Si)) { return 14 }
  if ($regex($1,/^(15|L(ight)?Gr[ae]y|Silver)\b/Si)) { return 15 }
}

Comments

Sign in to comment.
CrazyDriver   -  Aug 12, 2016

Could someone probably fix this script as I used to have it and it used to work but now for some reason, it won't identify me when I do !login it just keeps telling me to /ns identify....

 Respond  
Gavanator   -  Sep 01, 2011

Added a shoutout for ya matey :D

 Respond  
Savage_CL   -  Aug 07, 2011

Great script. I would put it in scripts if I were you, but meh...
Where is my shoutout? I wrote the rank system :P

 Respond  
Gavanator   -  Jul 18, 2011

I'm glad you have it working, I can go to bed with peace of mind now. You know where I am if you need me. :)

 Respond  
PyThOn   -  Jul 18, 2011

Ahh ok
Awesome.
Well done + like

 Respond  
PyThOn   -  Jul 18, 2011

going over it again.

 Respond  
Gavanator   -  Jul 18, 2011

Have you been through the whole of the script and changed everything that needed to be changed?

 Respond  
Gavanator   -  Jul 18, 2011

That isn't an extra bracket, it ends the command before to start the new ON TEXT

 Respond  
PyThOn   -  Jul 18, 2011

}
}
On $*:TEXT:/^[.!%]Auser/Si:#: {
if ($nick == YOURNICK) {
notice $2 $logo2(Admin) $c1($2) $c3(Has been added as) $c3(Bot Admin)
msg #SweetShop.Staff $logo2(Admin) $+($mcol2($chr(40)),$chr(32),$mcol1($2),$chr(32),$mcol2($chr(41))) $+($mcol2($chr(40)),$chr(32),$mcol1($address($2,3)),$chr(32),$mcol2($chr(41))) $c3(has been added as) $c3(Bot Admin.)
writeini userlist.ini users $2 $address($2,3)
You have an extra bracket

!Scommands - Private from Black_Tip- 14Please 04!Login 14to use that command !Login ------------------------------------------- <----Nothing said from the bot
 Respond  
Gavanator   -  Jul 18, 2011

Yea my bad, that part I forgot to re-add the $c1 $c2 and $c3 but I will edit now, thanks for pointing it out. :)

 Respond  
_Dean_   -  Jul 17, 2011
On *:JOIN:#sweetshop: {
  if ($nick isop $chan || $nick ishop $chan) { halt }

it will not work, since all nicks on join is regular

on $*:TEXT:*:*: {

The $ prefix

Indicates that the matchtext section of a definition contains a regular expression.

alias $chanhalt $nickhalt $c3 $c1 and $c2 is missed

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.