Picwin Hangman

Platform:  mIRC
Published  Dec 28, 2009
Updated  Dec 28, 2009
I decided it would be fun to make a hangman game with pictures, although it's just a stick figure.
I'm poor of thinking up questions, but I included a feature to create your own, or get friends to make some up for you.

Commands
!hangman <hint>:<answer> - lets other make up riddles for you (hides text)
/hangman - starts a hangman game
/letter <letter> - guess a letter
/guess <string> - guess the entire answer
on *:CLOSE:@hangman:unset %hangman.* | .timerhangman off
on ^*:TEXT:!hangman*:*: {
haltdef
if (!$1) || ($chr(58) !isin $strip($2-)) || (!$GetTok($2-,1,58)) || (!$GetTok($2-,2,58)) { notice $nick SYNTAX ERROR: !hangman <hint>:<answer> | halt }
write hangman.txt $2-
}
alias hangman {
if ($1 == save) { echo -a $2- added. | write hangman.txt $2- }
if ($1 == play) || (!$1) {
if (@hangman) { clear @hangman }
set %hangman.game active
set %hangman.tries 0
set %hangman.mistake 0
set %hangman.correct 0
set %hangman.letters
window -e3p @hangman
drawfill @hangman black black 20 20
set %hangman.line $r(1,$lines(hangman.txt))
drawtext @hangman 07 Tahoma 20 1 1 Hint: $GetTok($read(hangman.txt, %hangman.line),1,58)
hangman.gallow
var %h = 0
while (%h <= $len($GetTok($read(hangman.txt, %hangman.line),2,58))) {
set %hangman.blank %hangman.blank $+ $iif($mid($GetTok($read(hangman.txt, %hangman.line),2,58),%h,1) == $chr(32),$+($chr(32),$chr(124)),$+($chr(32),-))
if ($mid($GetTok($read(hangman.txt, %hangman.line),2,58),%h,1) == $chr(32)) { inc %hangman.correct }
inc %h
}
drawtext @hangman 11 Tahoma 35 -21 50 %hangman.blank
unset %hangman.blank
unset %hangman.game
}
}
alias letter {
if ($len($1) > 1) || (!$1) || ($1 isin $strip(%hangman.letters)) { halt }
inc %hangman.tries 1
set %hangman.letters %hangman.letters $1
var %h = 1
while (%h <= $len($GetTok($read(hangman.txt, %hangman.line),2,58))) {
if ($1 == $mid($GetTok($read(hangman.txt, %hangman.line),2,58),%h,1)) {
set %hangman.match active
drawtext @hangman 04 Tahoma 20 $calc(%h * 25 - $calc(19 + %h))) 40 $upper($1)
inc %hangman.correct
}
inc %h
}
drawtext @hangman 14 Tahoma 20 600 $calc(%hangman.tries * 18) $upper($1)
if (%hangman.match != active) { inc %hangman.mistake | hangman.bodypart }
if (%hangman.mistake >= 6) { drawtext @hangman 04 Tahoma 20 200 530 You Lose! | unset %hangman.* | halt }
if (%hangman.correct == $len($GetTok($read(hangman.txt, %hangman.line),2,58))) { drawtext @hangman 08 Tahoma 20 200 530 You Win! | unset %hangman.* | .timerhangman 1 5 /hangman | halt }
unset %hangman.match
}
alias guess {
if (!$1) { halt }
if ($1- == $GetTok($read(hangman.txt, %hangman.line),2,58)) {
var %h = 1
while (%h <= $len($GetTok($read(hangman.txt, %hangman.line),2,58))) {
drawtext @hangman 04 Tahoma 20 $calc(%h * 25 - $calc(21 + %h))) 40 $upper($iif($mid($GetTok($read(hangman.txt, %hangman.line),2,58),%h,1) == $chr(32),$chr(45),$mid($GetTok($read(hangman.txt, %hangman.line),2,58),%h,1)))
inc %h
}
drawtext @hangman 04 Tahoma 20 200 530 You Win!
unset %hangman.*
.timerhangman 1 5 /hangman
halt
}
else { inc %hangman.mistake | hangman.bodypart }
if (%hangman.mistake >= 6) { drawtext @hangman 04 Tahoma 20 200 530 You Lose! | unset %hangman.* | halt }
}
;Draw Commands
alias -l hangman.gallow {
drawline -r @hangman $rgb(139,69,19) 15 20 600 20 400 100 400
drawline -r @hangman $rgb(139,69,19) 10 20 450 70 400
drawline -r @hangman $rgb(210,180,140) 5 100 400 100 475
}
alias -l hangman.bodypart {
if (%hangman.mistake == 0) { halt }
elseif (%hangman.mistake == 1) { drawdot @hangman 3 20 102 480 }
elseif (%hangman.mistake == 2) { drawline @hangman 3 10 102 480 102 550 }
elseif (%hangman.mistake == 3) { drawline @hangman 3 10 102 500 125 525 }
elseif (%hangman.mistake == 4) { drawline @hangman 3 10 102 500 79 525 }
elseif (%hangman.mistake == 5) { drawline @hangman 3 10 102 550 125 575 }
elseif (%hangman.mistake == 6) { drawline @hangman 3 10 102 550 79 575 }
}

Comments

Sign in to comment.
RagBot   -  Dec 29, 2009
I tried looking for a website to use sockets for, but I can't find any good ones. I'll keep looking though. Good idea!
 Respond  
sunslayer   -  Dec 29, 2009
+ 1 likes
6/10 + like!
7/10 + like too!
lulz some1 is liers
would be nice if there was a socket to somewhere that had some questions/answers
 Respond  
eyiezinc   -  Dec 29, 2009
7/10 + like too!
 Respond  
sercan386   -  Dec 28, 2009
perfect.
 Respond  
Master-Of-Death   -  Dec 28, 2009
6/10 + like!
 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.