gooshie commented on a Page, English Slang Definition Checker  -  Apr 16, 2012

Ricko,
I modified the code as shown so i could simply /define [WORD]
and it works so I'm suspecting you have other issues or are trying to
trigger your own 'on text' event which is impossible.

on *:sockopen:ud*:{ 
  tokenize 32 $sock($sockname).mark 
  if ($sockerr) { $5-6 Socket error! | return }
  $2-4 GET $+(/iphone/search/define?term=,$1) HTTP/1.1
  $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) 
  $2-4 Connection: close
}
on *:sockread:ud*:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { $5-6 Socket error! | return } | var %ud | sockread %ud
  if (undefined isin %ud) { $5-6 $qt($replace($1,+,$chr(32))) is $+($v1,!) }
  elseif ($regex(%ud,/"definition":"(.*)/)) { $5-6 $remde($gettok($regml(1),1,34)) }
}
alias define {
  set -l %ud $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud www.urbandictionary.com 80)
  sockmark %ud $replace($strip($1-),$chr(32),+) sockwrite -nt %ud .echo -a 
}
alias remde var %. | noop $regsub($1,/\134r\134n/g,$chr(32),%.) | return %.
 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.