Jethro commented on a Page, Simple Dice Game  -  Aug 30, 2009

Warizardworks, nice work. But instead of using multiple text events, you can use goto loop for your script:

on *:TEXT:!*:#: {
  if ($me == YOURBOT) {
    var %x = $1 | goto %x
    :!dice
    .timer 1 1 mode $chan +m
    .timer 1 2 mode $chan +v $nick
    .timer 1 4 msg $chan Hey $nick $+ . To win !dice, you must roll a 6.
    .timer 1 5 msg $chan Type !roll to begin.
    halt
    :!roll 
    .timer 1 1 describe $chan rolls a dice for $nick $+ ... 
    var %dice = $rand(1,6)
    .timer 1 3 msg $chan You have rolled a %dice  
    if (%dice == 6) {
      .timer 1 4 msg $chan You won! Congrats $nick $+ !
      .timer 1 5 mode $chan -m
      .timer 1 6 mode $chan -v $nick
      .timer 1 7 msg $chan Thanks for playing !dice by Wariopower.
    }
    elseif (%dice != 6) {
      .timer 1 4 msg $chan Sorry $nick $+ , you did not win. Please try again.
      halt
    }
    :!endgame
    .timer 1 1 mode $chan -m
    .timer 1 2 mode $chan -v $nick
    .timer 1 4 msg $chan Thanks for playing !dice by Wariopower.
    halt
    :%x
    msg $chan $1 is not recognized as a command.
  }
}

And you don't need global variable. The local one will work fine.

 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.