Words Generator

By Kiddo96 on Sep 25, 2011

Well I think this will be the last one (for today atleast).
This one gets the words that can be made out of a string/word.
Syntax is either !words string|word or /words string|word
For example /words odd i know > A total of 49 words can be made out of "odd i know":
1 did 2 dido 3 din 4 dink 5 dino 6 do 7 dodo 8 don 9 dow 10 down 11 id 12 ikon 13 in 14 indow 15 ink 16 inkwood 17 ion 18 ki 19 kid 20 kiddo 21 kin 22 kind 23 kino 24 know 25 koi 26 no 27 nod 28 nodi 29 noo 30 nook 31 now 32 od 33 odd 34 oi 35 oink 36 on 37 ono 38 ow 39 own 40 win 41 wind 42 wink 43 wino 44 wo 45 wok 46 won 47 wonk 48 woo 49 wood
I'd like to thank Jethro for explaining how to combine the on text event with the alias. He understood what I meant with constructive criticism :) It's ofcourse welcome here too.

on *:text:!words *:#,?:{
  words $2-
}
alias words {
  if $sock(scrabble) || $sock($+(scrabble,$nick)) {
    sockclose $v1
  }
  sockopen $iif($event == text,$+(scrabble,$nick),scrabble) www.wordplays.com 80
  sockmark $iif($event == text,$+(scrabble,$nick) msg $nick,scrabble echo -a) $1-
}
on *:sockopen:scrabble*:{
  tokenize 32 $sock($sockname).mark
  var %data $+(MinLength=1&Word=,$3-,&subsets=Show+Words)
  sockwrite -nt $sockname POST /fcgi-bin/jumble.pl HTTP/1.1
  sockwrite -nt $sockname HOST: www.wordplays.com
  sockwrite -nt $sockname Connection: close
  sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
  sockwrite -nt $sockname Content-Length: $len(%data)
  sockwrite -nt $sockname $crlf $+ %data
}
on *:sockread:scrabble*:{
  tokenize 32 $sock($sockname).mark 
  var %scrabblereader
  sockread %scrabblereader
  if (*no word*could be* iswm %scrabblereader) {
    $1-2 No words could be made out of $qt($3-) $+ .
    sockclose $sockname
  } 
  if $regex(scrabbleresults,%scrabblereader,/TR><TD.+<P>The following <B>(\d+)<\/B> word.+in <STRONG>.+<\/STRONG>\:<p/) {
    set %scrabbleresultsfound $regml(scrabbleresults,1)
  }
  if $regex(scrabble,%scrabblereader,/TD class=word align=right>(\d+).&nbsp;<\/TD><TD align="left"><B><A HREF=\/fcgi\-bin\/dict\.pl\?word=(.+)& cla.+\/TD/) {
    set %scrabbleresults $addtok(%scrabbleresults,$+($chr(2),$regml(scrabble,1),) $regml(scrabble,2),32)
  }
}
on *:sockclose:scrabble*:{
  if %scrabbleresults {
    tokenize 32 $sock($sockname).mark
    $1-2 A total of %scrabbleresultsfound words can be made out of $qt($3-) $+ :
    $1-2 %scrabbleresults
  }
  unset %scrabble*
}

Comments

Sign in to comment.
BiSoN   -  Oct 02, 2012

missing

 Respond  
Kiddo96   -  Sep 25, 2011

Good one Jethro, gone more updating lol.

 Respond  
Jethro   -  Sep 25, 2011

You only need a single $1- :

$iif($event == text,msg $nick,echo -a) $1-
 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.