Basic Hangman

By tyguy on Jan 06, 2006

The commands are .AddWord, .WordUp and .guess. .AddWord just adds a word to the end of the wordlist, .WordUp just displays the clue, use .guess (letter) to guess a letter. you can get my word list at www.tylerlane.be/wordlist.txt

On *:Text:*:#: { .set %hang $nick
  if ($1 == .WordUp) {
    .set %word $read(wordlist.txt)
    .set %hint $replace(%word ,b,-,c,-,d,-,f,-,g,-,h,-,j,-,k,-,l,-,m,-,n,-,p,-,q,-,r,-,s,-,t,-,u,-,v,-,w,-,x,-,y,-,z,-)
    .msg %chan %hint
  }
  elseif ($1 == .AddWord) {
    .write wordlist.txt $2
    .notice %hang word $2 added to the wordlist
  }
  elseif ($1 == .guess) {
    set %letter $2
    set %pos $pos(%word, %letter, 1)
    if (%pos != $null) {
      alias while {
        var %i 1
        while (%i <= $len(%word)) {
          set %pos $pos(%word, %letter, %i)
          if (%pos != $null) {
            set %hint $left(%hint, $calc(%pos - 1)) $+ %letter $+ $mid(%hint, $calc(%pos + 1))
          }
          inc %i
        }       
      }
      .msg %chan the new hint is %hint 
    }
    else { .msg %chan the letter in not in the word
    }   
  }
  if (%hint == %word) { .msg %chan $hang got the winning letter }  
}

Comments

Sign in to comment.
Dizzlenub   -  Jul 24, 2007

I get error: no such nick/chan \"got\" whenever I type now. So I ain\'t using this one.

 Respond  
CaRe_Taker   -  Feb 02, 2006

.msg %chan %hint?
/msg $chan %hint

 Respond  
CaRe_Taker   -  Feb 02, 2006

umm i added a txt file with ure words list
Still doesnt work

 Respond  
CaRe_Taker   -  Feb 02, 2006

/msg: insufficient parameters (line 5, hang man)

 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.