Guessing Game

By Cage on Apr 12, 2006

Paste the script into the remote section of your mIRC. Then make the list of words put them into a text file in your mIRC directory called wordguess.txt. Note that each word needs to be on a seperate line.




Commands are as follows:


!guess.start - Starts the game


!guess.stop - Stops the game


!guess wordhere - Your guess of the designated word


!guess.hint - Recieves a hint


!guess.stats - Provides game statistics


!guess.score - Tells you your score. If you don't have a score yet, it will inform you of that as well.


!guess.giveup - It gives you the answer and you will no longer be able to guess for that round.




Have fun!

on *:TEXT:*:#: {
  if ($1 == !guess.stats) {
    msg # Game is currently: $+(,%game,)
    msg # Total words: $+(,$lines(wordguess.txt),)
    msg # Last person to win: $+(,%winner,) - Score: $+(,%score. [ $+ [ %winner ] ],)
    halt
  }
  if ($1- == !guess.start) && (%game == started) {
    msg # The game has already been started by %starter $+ .
    halt
  }
  else if ($1- == !guess.start) {
    set %game started
    set %word $read(wordguess.txt)
    set %starter $nick
    msg # Guessing game has been started by $+(,$nick,) $+ .
    msg # Type !guess <word> to guess the word! Type !hint to recieve a hint from me!
    timer 1 1 msg # The word is set. It has $len(%word) characters and begins with the letter $+(,$upper($left(%word,1)),) $+ . Start guessing!
    set %hint 2
  }
  else if ($1- == !guess.stop) && (%game != started) {
    msg # There is no game in progress. Type !guess.start to begin a game.
    halt
  }
  else if ($1- == !guess.stop) && ($nick == %starter) {
    msg # Guessing game ended by $nick $+ . Type !guess.start to start anew.
    unset %starter
    unset %hint
    unset %word
    set %game stopped
  }
  else if ($1- == !guess.stop) && ($nick != %starter) {
    msg $chan Only %starter can end this game $nick $+ .
    halt
  }
  else if ($1- == !guess.giveup) && ($nick == %starter) && (%word != $null) {
    msg # $nick gave up. The answer was $+(,%word,) $+ . This round was ended because $nick was the starter. Type !guess.start to start anew.
    unset %starter
    unset %hint
    unset %word
    set %game stopped
  }
  else if ($1- == !guess.giveup) && ($nick != %starter) && (%word != $null) {
    notice $nick You gave up. The answer was $+(,%word,) $+ . But the game is not over for the other players, so don't tell!
    set %giveup. [ $+ [ $nick ] ] $nick
    halt
  }
  if ($1- == !guess.hint) && (%hint >= $len(%word)) { msg # No more hints. | halt }
  else if ($1 == !guess.hint) && (%hint == 2) { inc %hint 1 | msg # Hint #1: First 2 Characters: $left(%word,2) }
  else if ($1 == !guess.hint) && (%hint == 3) { inc %hint 1 | msg # Hint #2: First 3 Characters: $left(%word,3) }
  else if ($1 == !guess.hint) && (%hint == 4) { inc %hint 1 | msg # Hint #3: First 4 Characters: $left(%word,4) }
  else if ($1 == !guess.hint) && (%hint == 5) { inc %hint 1 | msg # Hint #4: First 5 Characters: $left(%word,5) }
  else if ($1 == !guess.hint) && (%hint == 6) { inc %hint 1 | msg # Hint #5: First 6 Characters: $left(%word,6) }
  else if ($1 == !guess.hint) && (%hint == 7) { inc %hint 1 | msg # Hint #6: First 7 Characters: $left(%word,7) }
  else if ($1 == !guess.hint) && (%hint == 8) { inc %hint 1 | msg # Hint #7: First 8 Characters: $left(%word,8) }
  else if ($1 == !guess.hint) && (%hint == 9) { inc %hint 1 | msg # Hint #8: First 9 Characters: $left(%word,9) }
  else if ($1 == !guess.hint) && (%hint == 10) { inc %hint 1 | msg # Hint #9: First 10 Characters: $left(%word,10) }
  else if ($1- == !guess.hint) && (%hint > 10) { msg # No more hints. | halt }
  else if ($1 == !guess.score) && (%score. [ $+ [ $nick ] ] != $null) && ($2 == $null) {
    msg # Your current score is %score. [ $+ [ $nick ] ] $nick $+ .
    halt
  }
  else if ($1 == !guess.score) && (%score. [ $+ [ $2 ] ] != $null) && ($2 != $null) {
    msg # $2's current score is %score. [ $+ [ $2 ] ] $+ .
    halt
  }
  else if ($1 == !guess.score) && ($2 != $null) && (%score. [ $+ [ $2 ] ] == $null) { msg # $2 doesn't have a score for this game yet $nick $+ . | halt }
  else if ($1 == !guess.score) { msg # You don't have a score for this game yet $nick $+ . }
  else if ($1 == !guess) && ($2 != %word) {
    msg # That's not the word $nick $+ . Try again!
    halt
  }
  else if ($1 == !guess) && ($2 == $2) && ($nick == %giveup. [ $+ [ $nick ] ]) {
    msg $chan You cannot guess anymore $nick $+ . You already gave up.
    halt
  }
  else if ($1 == !guess) && ($2 == %word) {
    msg $chan $nick got the word correct and is awarded 1 point! Type !guess.start to start anew.
    unset %starter
    unset %word
    unset %hint
    set %game stopped
    set %winner $nick
    inc %score. [ $+ [ $nick ] ] 1
  }
}

Comments

Sign in to comment.
Death_first   -  Jan 28, 2007

i cant get wordguess.txt to work, it wont read the text document

(\_/)
(O_o)
(U U)

 Respond  
Skye   -  Jul 20, 2006

Everything seems to be worknig fine for me BUT I cant get the wordguess.txt to work x_x

 Respond  
Kiddie Scripter   -  Apr 30, 2006

Another Suggestion: Try making it so that it\'ll punish the person if they get the wrong answer(Ex. Put them on Quiet Status for 10 sec or kick them out of the channel)

 Respond  
xDaeMoN   -  Apr 25, 2006

Suggestion: Will ask another word to guess after guessing the correct word. Kinda like a trivia script.

 Respond  
Cage   -  Apr 25, 2006

I\'d really appreciate some feedback for this. Any ideas for improvement?

 Respond  
Cage   -  Apr 23, 2006

Updated again.

 Respond  
Cage   -  Apr 13, 2006

Okay, I recently updated the code again. There is now a score keeping process. Have fun. And leave comments!

 Respond  
Cage   -  Apr 12, 2006

I just finished re-editing the code and I think I\'ve eliminated all the bugs. If you find any, please let me know.

 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.