Guessing game

By dataprofile on Sep 13, 2007

About: It's pretty much a guess the word game with hints. Put this in your bot's remotes. It voices the nick if they win as a little prize.

Usage:
!neword
Starts a new game. Message your bot using the following format:
; new word (word)
; new hint1 (first hint)
; new hint2 (second hint)

!startgame
Starts the game

!guessword
!guessword (word)

!stopguess
ends the game

Notes:

When loading this into your bot's remotes. Type: /set %owner (etc)

Thank you simplicity for helping me improve my snippet.

; Guess the word game by dataprofile 

on *:TEXT:*:#:{
  if ($1 = !guessword) && ($gettok(%gamestatus,1,32)) {
    if ($2 = %word) {
      set %win on
      msg $chan $nick has won the game!
      if ($nick !isvo $chan) && ($me isop $chan) { mode # +v $nick }
      .timersay off
      halt
    }
  }
  if ($1 = !stopguess) && ($gettok(%gamestatus,1,32) = on) {
    unset %gamestatus
    msg $chan Guessing game has been stopped.
    .timersay off
  }
  if ($1 = !startgame) && (!$gettok(%gamestatus,1,32)) {
    unset %hintstatus
    unset %win
    set %gamestatus on
    msg $chan Guessing game has started.
    .timersay 1 5 msg $chan Hint: %hint1
    if (%win != on) {
      .timersay 1 30 msg $chan Hint: %hint2
      .timersay 1 50 msg $chan Sorry, your time is up! The word was %word $+ .
    }
  }
  if ($1 = !neword) && ($nick iswm %owner) {
    msg $nick Please enter your word and hints.
  }
}

on *:TEXT:*:?:{
  if ($1 = new) {
    if ($2 = word) set %word $3
    if ($2 = hint1) set %hint1 $3
    if ($2 = hint2) set %hint2 $3
  }
}

Comments

Sign in to comment.
simplicity   -  Sep 13, 2007

You have a few errors:

The timers do not turn off when the word is said or the stopguess occurs.

If you do not have halfop or op you will receive an error.

I edited your code a bit. I fixed the timers by adding a .timersay off. Try this:

on *:TEXT:*:#:{ 
  if ($1 = !guessword) && ($gettok(%gamestatus,1,32)) { 
    if ($2 = %word) { 
      set %win on 
      msg $chan $nick has won the game!
      if ($nick !isvo $chan) && ($me isop $chan) { mode # +v $nick }
      .timersay off
      halt
    }
  }
  if ($1 = !stopguess) && ($gettok(%gamestatus,1,32) = on) { 
    unset %gamestatus
    msg $chan Guessing game has been stopped.
    .timersay off
  }
  if ($1 = !startgame) && (!$gettok(%gamestatus,1,32)) { 
    unset %hintstatus
    unset %win
    set %gamestatus on
    msg $chan Guessing game has started.
    .timersay 1 5 msg $chan Hint: %hint1 
    if (%win != on) { 
      .timersay 1 30 msg $chan Hint: %hint2
      .timersay 1 50 msg $chan Sorry, your time is up! The word was %word $+ .
    }
  }
  if ($1 = !neword) && ($nick iswm %owner) { 
    msg $nick Please enter your word and hints.
  }
}

on *:TEXT:*:?:{ 
  if ($1 = new) { 
    if ($2 = word) set %word $3
    if ($2 = hint1) set %hint1 $3
    if ($2 = hint2) set %hint2 $3
  }
}

Otherwise, not bad. I recommend a little more work put into this. Maybe use a text file to read different words or make it into something bigger such as a scramble game.

 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.