Simple Dice Game

By #Warizardworks on Aug 30, 2009

Hey guys, it's Wariopower. Now, I know there are tons of dice games on hawkee, but I wanted to see if I could make one, and it worked. :P

How it works: You type !dice to activate it and once the person is voiced they can type !roll to roll the correct number and play until they get it right. There is also a !endgame command.

How to activate it: First, place this script in remote.

Edit: Removed if ($me == YOURBOT) { and made it so you set a bot nick variable. Added an alias if you want to change the %botnick again. Changed the stop game alias to !sdice, rather than !endgame.

That's about it for this script. Hope you enjoy playing !dice. =]
~ Wariopower

~ This script was made by Wariopower at #WarizardWorks on irc.purplesurge.com ~

on *:load: { set %botnick $$?="Botnick?" }
alias changebot { set %botnick $$?="Botnick?" }

on *:TEXT:*:#:{
  if ($1 == !dice) {
    if ($me == %Botnick) {
      .mode # +m | mode $nick +v
      .timer 1 4 msg $chan Hey $nick $+ . To win !dice, you must roll a 6.
      .timer 1 5 msg $chan Type !roll to begin.
    }
  }
  if ($1 == !sdice) {
    if ($me == %Botnick) {
      .timer 1 1 mode $chan -m
      .timer 1 2 mode $chan -v $nick
      .timer 1 4 msg $chan Thanks for playing !dice by Wariopower.
    }
  }
  if ($1 == !roll) {
    if ($me == %Botnick) {
      .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) {
      if ($me == %Botnick) {
        .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) {
      if ($me == %Botnick) {
        .timer 1 4 msg $chan Sorry $nick $+ , you did not win. Please try again.
      }
    }
  }
}

Comments

Sign in to comment.
#Warizardworks   -  Aug 31, 2009

Thanks for your kind words. And cool! I might rescript this game with all of your cool ideas. Thanks guys. =]
~ Wariopower

 Respond  
Jethro   -  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  
Lord-Harlot   -  Aug 30, 2009

on *:text:!dice:#:{ var %d = $r(1,6), %w = $r(1,6) | msg # To win you need to roll a %w $+ . | msg # You rolled a %d $+ . $iif(%d == %w,You won,You lost) }

That is how I did mine

 Respond  
#Warizardworks   -  Aug 30, 2009

Cool, I like your setup. I think I'll explore with more variables next time as well! Glad to see that someone was interested in this script. =]
~ Wariopower

 Respond  
GlobalAnomaly   -  Aug 30, 2009
on *:load: { set %BotNick $$?="Botnick?" }
on *:text:!dice:#: { 
  if ($me == %BotNick) {
    if (!%die.*) {
    set %die.object $r(1,6)
    set %playernick $nick
    .timer 1 1 mode $chan +mv $nick
    .timer 1 2 msg $chan Hey $nick $+ , to win the game you much roll a %die.object $+ . Type !roll to roll the die.
    halt
    }
  }
}
on *:text:!roll:#: {
  if ($nick == %playernick) {
    set %die.player $r(1,6)
    .timer 1 1 msg $chan %playernick rolled a %die.player and....
    if (%die.player == %die.object) { .timer 1 2 msg $chan %playernick won! Congrats. | unset %playernick | unset %die.* | mode $chan -mv $nick | halt }
    else {
      .timer 1 2 msg $chan %playernick lost. Oh well, better luck next time!
      mode $chan -mv $nick
      unset %die.*
      unset %playernick
      halt
    }
  }
}

That's how I did mine >_>

 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.