Here is my WHOLE bot code. Probably A LOT of errors in there, but here it is.


Code:
alias -l add.pts {
  if (%point.off) return
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}


alias -l lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,%topic,Points)
  return %points
}

alias doaddpoints {
  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points %points
  echo -a Added points for %topic
}

alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}


on *:TEXT:!calc*:#: {
  if ($3 == $null) /msg $chan $nick  $2 = $calc( $2 )
  if ($3 != $null) /msg $chan 7Please dont use the space bar for the !calc7 trigger. Do it like this:  5+5 7for example.
}
on *:TEXT:!c:#: {
  /msg $chan To use this channel calculator, you should know this:
  /msg $chan The Calculator Buttons Are: [+] [-] [^] [*]
  ] [/]
  /msg $chan Here are some examples: 
  /msg $chan 3^2 = 9
  /msg $chan 3*2 = 6
  /msg $chan 3/2 = 1,5
  /msg $chan 3+2 = 5
  /msg $chan 3-2 = 1
}




on *:text:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $iif($readini(Points.ini,n,$+(#,.,$nick),Points),$v1,0) total points.
}

on $*:text:/!points (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    msg $chan $3 now has $readini(Points.ini,n,$+(#,.,$3),Points) total points.
  }
  else { msg $chan This command is only available to the owner of this channel. }
}

on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

on *:text:!points reset:#:{
  if ($nick isop #) {
    msg $chan All points are now erased
    write -c points.ini
  }
  else { msg $chan This command is only available to moderators. }
}










on $*:text:/^!points (on|off)/:#:{
  if $nick !isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.
  }
}







on *:text:!startuptime:#: {
  msg # Starting uptime.
  set -e %uptime. [ $+ [ # ] ] $ctime
}

on *:text:!uptime:#: { msg # I have been online for $duration($calc($ctime - %uptime. [ $+ [ # ] ] )) }

on *:text:!stopuptime:#: { 
  msg # Stopping uptime.
  unset %uptime. [ $+ [ # ] ] 
}




on *:TEXT:!giveaway enter:#:{
  if (%giveaway == on) {
    if (!$read(giveaway.txt,nw,$nick)) {
      write giveaway.txt $nick
      msg $chan $nick - you have been entered into the giveaway! 
    }
  }
  elseif (%giveaway == off) {
    msg $chan There is no active giveaway
  }
}

on *:TEXT:!giveaway start:#:{
  if ($nick isop #) {
    set -e %giveaway on
    msg $chan giveaway started. please do "!giveaway enter" to enter. To clear all names, please do "!giveaway done" 
  }
  else { msg $chan This command is only available to moderators. }
}


on *:TEXT:!giveaway end:#:{

  set -e %giveaway off
  { msg $chan Giveaway has ended. please do !draw to pick a winner!" }
}
on *:text:!giveaway done:#:{

  -e %giveaway = off
  { msg $chan giveaway is complete. erasing all names from the giveaway }
  write -c giveaway.txt.
}
on *:text:!draw:#:{ 

  if (%giveaway == off) { msg $chan The winner is $read(giveaway.txt) $+ !! If you would like to pick another winner draw again. }
  elseif (%giveaway == on) { msg $chan The giveaway is still on! please do "!giveaway end" }
}




on *:text:!pointcheck *:#:{
  if ((%floodcheck) || ($($+(%,floodcheck.,$2),2))) { return }
  set -u1 %floodcheck On
  set -u5 %floodcheck. $+ $nick On 
  msg # $2 has $readini(Points.ini,$+(#,.,$2),Points) total points. 
}





on *:text:!winner:#:{
  var %nick1 = $nick(#,$rand(1,$nick(#,0)))
  while (%nick1 == $me) { %nick1 = $nick(#,$r(1,$nick(#,0))) }
  msg # Randomly selected winner is %nick1 $+ ! Congratulations %nick1 you win... $eval($+(%,prize.,$network,.,#),2)
}





on *:TEXT:!top10:#:{
  if $nick == robpsychobob { top10 # } 
  else { msg # You are not allowed to use !top10. }
}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.
}










on *:text:!tickets:#:{
  if ($hget($+(tickets.,#),$nick)) { msg # $nick You already have a ticket! | return }
  var %topic = $+(#,.,$nick)
  ; Check if enough points
  if ($readini(Points.ini,%topic,Points) >= 1) {
    ; Deduct the points
    var %a = $v1 - 1
    writeini Points.ini %topic Points %a
    ; Add the user to tickets.#channel hash table, creating the table if it doesn't exist
    hadd -m $+(tickets.,#) $nick 1
    msg # $nick You bought a ticket, you now have %a points.
  }
  else msg # $nick --- Sorry you only have $iif($readini(Points.ini,n,$+(#,.,$nick),Points),$v1,0) total points!
}
on *:text:!ticket roll:#:{
  if ($nick == forgottenheroes) {
    if ($hget($+(tickets.,#))) {
      var %i = $r(1,$hget($+(tickets.,#),0).item)
      msg # The winner is $hget($+(tickets.,#),%i).item
      ; The next line frees the table (all data in it is gone)
      hfree $+(tickets.,#)
    }
    else msg # Sorry $nick there is no entries at the moment. 
  }
  else msg # $nick Only Mods can use that command.
}









on $*:text:/^!addcom !?(\S+)/iS:#:{
  if ($nick !isop #) return
  writeini commands.ini commands $regml(1) $$3-
  msg # $nick > The command $2 has been created
}

on $*:text:/^!delcom !?(\S+)/iS:#:{
  if ($nick !isop #) return
  remini commands.ini commands $regml(1)
  msg # $nick > The command $2 has been removed from the database.
}

on $*:text:/^!(\S+)/:#:{
  if ($nick !isop #) return
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}



I would LOVE for !points on & !points off to burn the bot on and off so he either starts collecting points while I'm streaming or stops collecting points when I quit streaming.

I would LOVE for the bot to be able to add 1 point to new users, but not allow them to quit and re-join to keep farming 1 point over and over.

I would LOVE a raffle to be added to the bot that makes it so the players can spend ever how many points they want and be entered that many times into the raffle. Then when the raffle stops it picks a random winning ticket. Even tho someone bought 100 tickets and someone else only bought 10 I stil want that person who bought 10 to have a chance at winning but a lower chance.

Last edited by Echosyp; 24/05/14 05:18 AM.