TwitchSplit(livesplit in twitch chat)

By acpixel on Feb 13, 2016

So the very first script i ever made was basically a in chat port of livesplit.
It was horribly done and hard coded with a max of 10 splits.
A friend was asking me about it today and i was like, "i should recode it with my new knowledge and make it way better!". so I did.
It is a free bot twitch.tv/twitchsplit you will be able to !join to have it join soonish. but out of the kindness of my heart, i am releasing the crazy bracketed source code. it does require mod status in the chat because i dont want people getting it ip banned because of global banning. But if any one wants to use it or its code, feel free. but if you can, try to credit me! Thanks!

It only goes up to hours and I wouldn't recomend any more than maybe 15 splits. i am working on adding a pb counter but we will have to see if i get there.

on *:CONNECT: {
  join #ac_overdose
  join #acpixel
  /raw CAP REQ :twitch.tv/membership
  /raw CAP REQ :twitch.tv/commands
  /raw CAP REQ :twitch.tv/tags
}

on *:TEXT:!start:#: {
  if (twitchsplit !isop #) && ($chan !isin %oppedchannels) {
    msg $chan You must op me to use me because of twitches global ban system! This can take time to update sometimes.
  }
  else if (twitchsplit isop #) {
    if ($chan !isin %oppedchannels) {
      set %oppedchannels %oppedchannels $chan
    }
  }
  if ($chan isin %oppedchannels) {
    if ($nick isop #) || ($nick == acpixel) || ($nick == ac_overdose) {
      msg $chan started the timer!
      set %timer. [ $+ [ $chan $+ ms ] ] 0
      set %timer. [ $+ [ $chan $+ s ] ] 0
      set %timer. [ $+ [ $chan $+ m ] ] 0
      set %timer. [ $+ [ $chan $+ h ] ] 0
      timer [ $+ [ $chan $+ ms ] ] -mch 0 10 msup $chan
      set %splitnum [ $+ [ $chan ] ] 1
    }
  }
} 

alias msup {
  inc %timer. [ $+ [ $1 $+ ms ] ]
  echo -n %timer. [ $+ [ $1 $+ s ] ]
  if (%timer. [ $+ [ $1 $+ ms ] ] == 100) {
    inc %timer. [ $+ [ $1 $+ s ] ]
    set %timer. [ $+ [ $1 $+ ms ] ] 0
  }
  if (%timer. [ $+ [ $1 $+ s ] ] == 60) {
    inc %timer. [ $+ [ $1 $+ m ] ]
    set %timer. [ $+ [ $1 $+ s ] ] 0
  }
  if (%timer. [ $+ [ $1 $+ m ] ] == 60) {
    inc %timer. [ $+ [ $1 $+ h ] ]
    set %timer. [ $+ [ $1 $+ m ] ] 0
  }
}

on *:TEXT:!s:#: {
  if (twitchsplit !isop #) && ($chan !isin %oppedchannels) {
    msg $chan You must op me to use me because of twitches global ban system! This can take time to update sometimes.
  }
  else if (twitchsplit isop #) {
    if ($chan !isin %oppedchannels) {
      set %oppedchannels %oppedchannels $chan
    }
  }
  if ($chan isin %oppedchannels) {
    if ($nick isop #) || ($nick == acpixel) || ($nick == ac_overdose)  {
      set %split [ $+ [ $chan $+ [ %splitnum [ $+ [ $chan ] ] ] ] ] %timer. [ $+ [ $chan $+ h ] ] $+ : $+ %timer. [ $+ [ $chan $+ m ] ] $+ : $+ %timer. [ $+ [ $chan $+ s ] ] $+ . $+ %timer. [ $+ [ $chan $+ ms ] ]
      msg $chan Split %splitnum [ $+ [ $chan ] ] is %timer. [ $+ [ $chan $+ h ] ] $+ : $+ %timer. [ $+ [ $chan $+ m ] ] $+ : $+ %timer. [ $+ [ $chan $+ s ] ] $+ . $+ %timer. [ $+ [ $chan $+ ms ] ]
      inc %splitnum [ $+ [ $chan ] ]
    }
  }
}

on *:TEXT:!t:#: {
  msg $chan %timer. [ $+ [ $chan $+ h ] ] $+ : $+ %timer. [ $+ [ $chan $+ m ] ] $+ : $+ %timer. [ $+ [ $chan $+ s ] ] $+ . $+ %timer. [ $+ [ $chan $+ ms ] ]
}
on *:TEXT:!e:#: {
  if (twitchsplit !isop #) && ($chan !isin %oppedchannels) {
    msg $chan You must op me to use me because of twitches global ban system! This can take time to update sometimes.
  }
  else if (twitchsplit isop #) {
    if ($chan !isin %oppedchannels) {
      set %oppedchannels %oppedchannels $chan
    }
  }
  if ($chan isin %oppedchannels) {
    if ($nick isop #) || ($nick == acpixel) || ($nick == ac_overdose)  {
      timer [ $+ [ $chan $+ ms ] ] off
      set %splitnumdown [ $+ [ $chan ] ] 1
      while ( %splitnum [ $+ [ $chan ] ] != 1) {
        msg $chan Split %splitnumdown [ $+ [ $chan ] ] was %split [ $+ [ $chan $+ [ %splitnumdown [ $+ [ $chan ] ] ] ] ]
        inc %splitnumdown [ $+ [ $chan ] ]
        dec %splitnum [ $+ [ $chan ] ]
      }
      msg $chan End Time! %timer. [ $+ [ $chan $+ h ] ] $+ : $+ %timer. [ $+ [ $chan $+ m ] ] $+ : $+ %timer. [ $+ [ $chan $+ s ] ] $+ . $+ %timer. [ $+ [ $chan $+ ms ] ]
    }
  }
}

on *:TEXT:!help:#: {
  if (twitchsplit !isop #) && ($chan !isin %oppedchannels) {
    msg $chan You must op me to use me because of twitches global ban system! This can take time to update sometimes.
  }
  else if (twitchsplit isop #) {
    if ($chan !isin %oppedchannels) {
      set %oppedchannels %oppedchannels $chan
    }
  }
  if ($chan isin %oppedchannels) {
    msg $chan The commands for TwitchSplit are: !start to start the timer. !s to split. !t to see the current time. !e to do final split.
  }
}

on *:TEXT:!twitchsplit:#: {
  msg $chan Twitch split can be found here twitch.tv/twitchsplit and the source code can be found here http://hawkee.com/snippet/16661/
}

Comments

Sign in to comment.
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.