[Help] - with timed token allocation

By Aarkin on Jun 23, 2014

I have been modifying a script for a slot game for my irc channel. I would like to add function that adds x amount of points per minute while user is in the channel. I have searched some other snippets and found similar code but am not sure how to implement it into my current code. Any help would be appreciated

on *:text:!spin *:#:{
  set %slotmachinenick $+ $nick $readini(tokens.ini,n,nick,$nick)
  set %bet $2
  if ( %slotmachinenick [ $+ [ $nick ] ] == $null) {
    msg $chan New Player: $nick [Added 50 Tokens] !spin <#> to win!
    writeini -n tokens.ini nick $nick $nick
    writeini -n tokens.ini token $nick 50
  halt }
  else {
    set %slotmachine $readini(tokens.ini,n,token,$nick)
    if ( %slotmachine < %bet) { halt }
    else {
      set %nicktoken $calc( $readini(tokens.ini,n,token,$nick) - %bet )
      writeini -n tokens.ini token $nick %nicktoken
      set %s1 $rand(1,3)
      set %s3 $rand(1,3)
      set %s2 $rand(1,3)
      msg $chan $nick is spinning the slots!
      msg $chan %s1 - %s2 - %s3
    }
    if ( %s1 == %s2 ) && ( %s2 == %s3 ) {
      var %win = %bet * 1.5
      var %tokenwin = $floor(%win)       
      set %nicktoken $calc( $readini(tokens.ini,n,token,$nick) + %tokenwin )
      msg $chan $nick You win %tokenwin Tokens!
      writeini -n tokens.ini token $nick %nicktoken
    }
  }
}
on *:text:!check *:#:{
  if ($nick isop #) {
    if ((%floodcheck) || ($($+(%,floodcheck.,$nick),2))) { return }
    set -u5 %floodcheck On
    set -u30 %floodcheck. $+ $nick On
    set %nicktoken $readini(tokens.ini,n,token,$2-)
    if ( %nicktoken == $null ) { msg $chan $2 - 0 Tokens. | halt }
    else {
      msg $chan $2- - %nicktoken Tokens.
    }
  }
}
on *:text:!tokens:#:{
  if ((%floodtokens) || ($($+(%,floodtokens.,$nick),2))) { return }
  set -u5 %floodtokens On
  set -u30 %floodtokens. $+ $nick On
  set %nicktoken $readini(tokens.ini,n,token,$nick)
  if ( %nicktoken == $null ) { msg $chan $nick - 0 Tokens. | halt }
  else {
    msg $chan $nick - %nicktoken Tokens.
  }
}

Comments

Sign in to comment.
Arigateaux   -  Jun 24, 2014

This isn't the place to ask questions regarding scripting help, however, try using a /timer to globally add points to a user every x seconds.

 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.