This is what I came up with... it works but it doesnt work... that is... it doesnt start the game.... GRRRRRR
menu channel {
***Hangman***
.$iif($group(#hangman) == on,$style(2),$style(0)) On: .enable #hangman | echo -a 0,12Hangman Game ON $+ 0,95 On
.$iif($group(#handman) == off,$style(2),$style(0)) Off: .disable #hangman | echo -a 0,12Hangman Game OFF $+ 0,4 Off
}
#hangman on
;alias hc1 { return 03 }
;alias hc2 { return 12 }
; Remove ; to restore Hangman next two lines
;on *:Text:!hangman*:#:{ do.hang $1- }
on *:Text:!hangman*:#:{ startvote }
on *:Input:#:{ if ((.* iswm $1) || (!* iswm $1)) { do.hang ! $+ $right($1-,-1) } }
; Voting script...... start
on *:TEXT:(y):#: {
if (%voting == on) { yesvote $nick }
}
on *:TEXT:(n):#: {
if (%voting == on) { novote $nick }
}
alias startvote {
if (%voting != on) {
set %voting on
set %starter $1
set %result
msg $chan Voting started. Type (Y) if you want Hangman to start, or type (N) if you don't.
; msg $chan S $asc(1)Tahoma;0 !shang
timer1 1 20 /stopvote
}
}
alias yesvote {
if ($1 isin %votedyes) {
notice $1 Multiple votes will not be counted.
}
else {
set %votedyes %votedyes $1
inc %yesvotes
if ($1 isin %votedno) {
set %votedno $remtok(%votedno,$1,32)
set %novotes $calc( %novotes - 1 )
notice $1 You changed your vote successfully.
}
notice $1 Thanks for voting!
}
}
alias novote {
if ($1 isin %votedno) {
notice $1 Multiple votes will not be counted.
}
else {
set %votedno %votedno $1
inc %novotes
if ($1 isin %votedyes) {
set %votedyes $remtok(%votedyes,$1,32)
set %yesvotes $calc( %yesvotes - 1 )
notice $1 You changed your vote successfully.
}
notice $1 Thanks for voting!
}
}
alias stopvote {
set %voting
if (%yesvotes == 0) && (%novotes == 0) {
set %result 2
set %comment No votes!
}
elseif (%novotes == 0) && (%yesvotes > 0) {
set %result 1
set %comment It's unanimous!
}
elseif (%novotes > 0) && (%yesvotes == 0) {
set %result -1
set %comment People here are trying to chat, %starter $+ !
}
elseif (%yesvotes == $calc( %novotes + 1 ) ) || (%yesvotes == $calc( %novotes - 1 ) ) {
set %comment It's a close one... want a recount?
if (%yesvotes > %novotes) { set %result 1 }
else { set %result -1 }
}
elseif (%yesvotes == %novotes) {
set %result 0
set %comment It's a draw!
}
elseif (%yesvotes > %novotes) {
set %result 1
set %comment
}
else {
set %result -1
set comment
}
ame counts the votes
amsg Ballot Result: (Y) = %yesvotes (N) = %novotes %comment
if (%starter !isin %votedyes) { amsg That was stupid, %starter $+ . You started it and didn't vote "(Y)" yourself! }
if (%result == 1) { do.hang $1- }
if (%result == 0) { amsg Only half want to start hangman - the other half are chatting. I won't start it - sorry! }
if (%result == -1) { amsg The majority don't want hangman. I won't start it - sorry! }
set %yesvotes 0
set %novotes 0
set %votedyes
set %votedno
set %result
}
; Voting script ..... end
alias do.hang {
if (($1 == !hangman) && (!$hget(hangman))) {
hmake hangman 10
hadd hangman word $read(hangman.txt)
hadd hangman chan $chan
hadd hangman man $iif($2 ison $chan, $2, $nick($chan, $rand(1,$nick($chan,0))))
hmsg $msg.hang.start
}
if (!$hget(hangman)) { return }
if ($1 == !shang) {
hmsg $msg.hang.stop
hfree hangman
halt
}
if ($1 == !solve) {
if ($2- == $hget(hangman,word)) Goto MazelTOV
hmsg Oy Vey are you WRONG!!!. Maybe I should just hang poor ol' $hget(hangman,man)
Return
:MazelTOV
hmsg $msg.hang.solve
hang.define
hfree hangman
halt
}
if ($1 == !hang) {
if (($2 !isalpha) || ($len($2) != 1)) {
hmsg Ya Schlemiel!! You gotta pick a letter! Sheesh!!!
return
}
elseif ($hget(hangman,Picked. $+ $2)) {
hmsg Sheesh Putz!!.. Try picking a letter that somebody else hasn't picked. :@
return
}
else {
hadd hangman Picked. $+ $2 1
if ($2 isin $hget(hangman,word)) {
hmsg $msg.hang.right
hang.checkwin
}
else {
var %hang.part = $hang.part
hmsg $msg.hang.wrong(%hang.part)
}
}
}
}
alias hang.part {
hadd hangman wrong $calc($hget(hangman, wrong) + 1)
if ($hang.partname($hget(hangman, wrong)) == hanging) {
hmsg $msg.hang.dead
hfree hangman
halt
}
return $hang.partname($hget(hangman, wrong))
}
alias hang.checkwin {
if ($hang.got != $hget(hangman,word)) { return }
hmsg $msg.hang.save
hang.define
hfree hangman
halt
}
; ****** Defination Starts
alias hang.define {
%dictword = $hget(hangman, word)
%dictlines = $readini %dictname %dictword lines
%dictline = 1
while ( %dictline <= %dictlines ) {
%dicttext = $readini %dictname %dictword %dictline
hmsg $msg.hang.define
inc %dictline
}
}
;******** End of Definations ***********
alias hang.partname { return $gettok(head;neck;torso;right arm;left arm;right hand;left hand;right leg;left leg;right foot;left foot;hanging, $1, $asc(;)) }
alias hang.got {
var %i = 1,%hang.got = $hget(hangman, word)
unset %hang.left
while (%i <= 26) {
if (!$hget(hangman, Picked. $+ $chr($calc(96 + %i)))) {
%hang.got = $replace(%hang.got, $chr($calc(96 + %i)), * )
set -u120 %hang.left %hang.left $+ $chr($calc(96 + %i))
}
inc %i
}
return %hang.got
}
alias hmsg { msg $$hget(hangman,chan) $1- }
alias msg.hang.clue { return Current clue: $hang.got Letters remaining: %hang.left }
alias msg.hang.save { return $hget(hangman,man) is saved! L'Chaim!!
You're the best Chaverim a person could want. Word: $hget(hangman,word) }
alias msg.hang.solve { return Mazel Tov!!!!
$nick $+ , You're guess the correct word, $hget(hangman,man) is saved! L'Chaim!!
Word: $hget(hangman,word) }
alias msg.hang.dead { return $hget(hangman,man) is DEAD, DOA, Rest in Peace! :'( With chaverim like these who needs enemies. Word: $hget(hangman,word) }
alias msg.hang.wrong { return Oy vey zmir!
$hget(hangman, man) $+ , is one step closer to death, the grim reaper. You just got $hget(hangman, man) $+ 's $1 $msg.hang.clue }
alias msg.hang.right { return Mazel Tov!!!!
$nick $+ , You picked a correct letter.
$msg.hang.clue }
alias msg.hang.start { return Get ready for some hangman... We are hanging $hget(hangman,man) $+ , unless you can prevent it. !hang <letter> to guess a letter. To stop hangman - !shang $msg.hang.clue }
alias msg.hang.define { return Meaning: %dicttext }
alias msg.hang.stop { return Game stopped by $nick $+ ,... To play again !hangman (for a random name leave blank, to specify a nick... !hangman <nick>) }
#hangman end