All pastes #363218 Raw Edit

goals script

public text v1 · immutable
·published 2007-02-19 08:04 UTC
rendered paste body
on *:TEXT:!setgoal*:#: {
  if ($nick !isreg $chan) {
    if (($2 isnum 1-5) && (!$readini(goals.ini,goals,$nick $+ $2 ) ) ) {
      if (!$readini(goals.ini,goals,$nick $+ $2 ) ) {
        //writeini goals.ini goals $nick $+ $2 $3
        //set %goal $+ $nick $+ $2 $3
        //set %goalitem $+ $2 $4-
        .notice $nick Set goal $3 $4- $+ 's
        .notice $nick Use !incgoal (goalnumber 1-5) (number to increase) to increase or !decgoal (goalnumber 1-5) (number to decrease) to decrease goal. To view, type !vgoal. Enjoy.
      }
    }
    else {
      .notice $nick You either have already set a number $2 goal, or you did not follow format: !setgoal (goalnumber 1-5) (number to set) (goal)
    }
  }
  else {
    .notice $nick You must be voiced to use this command. Sorry.
  }
}

on *:TEXT:!incgoal*:#: {
  if ($nick !isreg $chan) {
    if ($2 isnum 1-5) {
      if ($readini(goals.ini,goals,$nick $+ $2 ) ) {
        //writeini goals.ini goals $nick $+ $2 $calc($readini(goals.ini, goals, $nick $+ $2 ) + $3 )
        .notice $nick New Total: $readini(goals.ini,goals, $nick $+ $2) out of %goal [ $+ [ $nick ] $+ [ $2 ] ] %goalitem [ $+ [ $2 ] ] $+ 's
      }
      else {
        .notice $nick You either have not set a number $2 goal, or you did not follow format: !incgoal (goalnumber 1-5) (number to increase)
      }
    }
    else {
      .notice $nick Please follow format: !incgoal (goalnumber 1-5) (number to increase)
    }
  }
  else {
    .notice $nick You must be voiced to use this command. Sorry.
  }
}


on *:TEXT:!decgoal*:#: {
  if ($nick !isreg $chan) {
    if ($2 isnum 1-5) {
      while ($readini(goals.ini, goals, $nick [ $+ [ $2 ] ] $calc($readini(goals.ini,goals,$nick $+ $2 ) - $3 ) ) > 0) {
        //writeini goals.ini goals $nick $+ $2 $calc(($readini(goals.ini,goals, $nick $+ $2 )) - $3)
        .notice $nick New Total: $readini(goals.ini,goals, $nick $+ $2 ) out of %goal [ $+ [ $nick ] $+ [ $2 ] ] %goalitem [ $+ [ $2 ] ] $+ 's
      }
      else {
        .notice $nick Congratulations on completing your goal of %goal [ $+ [ $nick ] $+ [ $2 ] ] %goalitem [ $+ [ $2 ] ] $+ 's
        //unset %goal $+ $nick $+ $2
        //unset %goalitem $+ $2
        //remini goals.ini goals $nick $+ $2
      }
    }
    else {
      .notice $nick You either have not set a number $2 goal, or you did not follow format. !decgoal (goalnumber 1-5) (number to decrease)
    }
  }
  else {
    .notice $nick You must be voiced to use this command. Sorry.
  }
}


on *:TEXT:!vgoal*:#: {
  if ($nick !isreg $chan) {
    if ($2 isnum 1-5) {
      if ($readini(goals.ini,goals,$nick $+ $2) ) {
        .notice $nick Current Goal Remaining: $readini(goals.ini,goals,$nick $+ $2 ) out of %goal [ $+ [ $nick ] $+ [ $2 ] ] %goalitem [ $+ [ $2 ] ] $+ 's
      }        
      else {
        .notice $nick You either have not set a number $2 goal, or you did not follow format. !setgoal (goalnumber 1-5) (number to set) (goal)
      }
    }
    else {
      .notice $nick Please follow format: !vgoal (goalnumber 1-5)
    }
  }
  else {
    .notice $nick You must be voiced to use this command. Sorry.
  }
}