Script requested by Paranoia.
This script will return results from Googlism.com to irc channel/notice.
Getting Started:
Triggers/Syntax:
Example Output::
21:58:11 <!Ford_Lawnmower> @gwho mad max
21:58:13 mad max is an mp3 player for newton messagepads 2000 and 2100< => mad max is a life size training dummy designed and constructed for professional use to improve accurate technics in martial arts< => mad max is the plausability< => mad max is especially notable because it is poised between our industrialized world and total regression to< => mad max is an australian movie made in 1979
Note
Colors/delimiter can be changed in setup. See the top of the screen.
There is also a master on/off switch on the right click menu
;Googlism by Ford_Lawnmower irc.geekshed.net #Script-Help
menu Channel,Status {
.$iif($group(#Googlism) == On,$style(1)) Googlism Trigger
..$iif($group(#Googlism) == On,$style(2)) On: .enable #Googlism
..$iif($group(#Googlism) == Off,$style(2)) Off: .disable #Googlism
}
#Googlism on
On $*:Text:/^(\+|-|!|@)G(ooglism|wh(o|at|en|ere))\s?(.*)/Si:#: {
;;;;;;;;;;;;;;;;;;;;;;;;;Setup Start;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Change %delim if you want a different delimiter
var %delim 09«••09»
;;Change %textcolor to change the text color
var %textcolor 04
;;Change %maxresults for more or less results
var %maxresults 10
;;;;;;;;;;;;;;;;;;;;;;;;;;End Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %action $regml(1), %searchtext $regml(4)
var %searchdir $+($replacex($regml(3),o,/who_is/,at,/what_is/,en,/when_is/,ere,/where_is/),$left($NoIsWas($regml(4)),1),/,$urlencode($NoIsWas($regml(4))),/))
if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
if (%action == +) {
if ($istok(%GooglismChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the Googlism script }
else {
.enable #Googlism
Set %GooglismChanList $addtok(%GooglismChanList,$+($network,$chan),32)
.msg $chan $nick has activated the Googlism script for $chan .
}
}
else {
if (!$istok(%GooglismChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the Googlism script }
else {
Set %GooglismChanList $remtok(%GooglismChanList,$+($network,$chan),1,32)
.msg $chan $nick has deactivated the Googlism script for $chan .
}
}
}
elseif (!$timer($+(Googlism,$network,$nick))) && ($istok(%GooglismChanList,$+($network,$chan),32)) {
.timer $+ $+(Googlism,$network,$nick) 1 6 noop
var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
if (%searchtext) GetGooglism %method %searchdir %delim %textcolor %maxresults 0
else %method %textcolor Please provide some search terms!!
}
}
#Googlism end
alias Googlism { GetGooglism echo -a $1- }
alias -l GetGooglism {
$1-2 Searching........
var %sockname $+(Googlism,$network,$2,$ticks)
sockopen %sockname www.googlism.com 80
sockmark %sockname $1-
}
On *:sockopen:Googlism*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: www.googlism.com
sockwrite -n $sockname User-Agent: Opera 9.6
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:Googlism*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %Googlism | sockread %Googlism
if ($gettok($sock($sockname).mark,7,32) >= $gettok($sock($sockname).mark,6,32) || (</html> isin %Googlism)) {
tokenize 32 $sock($sockname).mark
put $1-2 $5 $iif($8-,$v1,Nothing Found)
sockclose $sockname
return
}
elseif ($regex(%Googlism,/Googlism for:.*<b>(.*)</p>/)) {
$gettok($sock($sockname).mark,1-2,32) $gettok($sock($sockname).mark,5,32) $regml(1)
sockclose $sockname
return
}
elseif ($regex(%Googlism,/Googlism for:.*<br>(.*)<br\s\/>/)) {
tokenize 32 $sock($sockname).mark
sockmark $sockname $1-6 1 $+($5,$replace($regml(1),$chr(9), ,","))
}
elseif ($gettok($sock($sockname).mark,7,32)) {
tokenize 32 $sock($sockname).mark
if (%Googlism == <p>) {
put $1-2 $5 $iif($8-,$v1,Nothing Found)
sockclose $sockname
return
}
else { sockmark $sockname $1-6 $calc($7 + 1) $+($8-,$4,$5,$remove($replace(%Googlism,$chr(9), ,","),<br />)) }
}
}
}
alias -l NoIsWas {
tokenize 32 $strip($1)
return $iif($istok(is was,$1,32),$2-,$1-)
}
alias -l urlencode return $regsubex($replace($1-,$chr(32),_),/([^a-z0-9_])/ig,% $+ $base($asc(\t),10,16,2))
alias -l Put {
if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
tokenize 32 $regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t))
var %tokens $0, %Tstart 4, %Dtimer 1500
if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
dec %tokens
if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
.timer -m 1 %Dtimer $1-3 $($+($,%Tstart,-,%tokens),2))
inc %Dtimer 1500
%Tstart = $calc(%tokens + 1)
%tokens = $0
}
}
.timer -m 1 %Dtimer $1-3 $($+($,%Tstart,-,%tokens),2))
.timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
}
That did the trick... don't get them here any more anyways...
Thanks for the quick "update" @FordLawnmower
Try getting the code from here: http://pastebin.com/1V7RGFjf
It seems that hawkee is replacing the
in the code box so it doesn't get replaced in the actual script.
You can also fix it by replacing line 86:
else { sockmark $sockname $1-6 $calc($7 + 1) $+($8-,$4,$5,$remove($replace(%Googlism,$chr(9), ,","),)) }
With the correct line:
else { sockmark $sockname $1-6 $calc($7 + 1) $+($8-,$4,$5,$remove($replace(%Googlism,$chr(9), ,","),<br />)) }
Edit***** Ignore the code replacement above, as it also removed the
from there.
Please just use the pastebin. http://pastebin.com/1V7RGFjf
Extra
added . This edit is getting ugly ;/
I'm not really clear on the problem here: I'm getting this:
[13:57:28] <@Ford_Lawnmower> @gwho mad max
[13:57:29] Searching........
[13:57:30] mad max is an mp3 player for newton messagepads 2000 and 2100«»mad max is a life size training dummy designed and constructed for professional use to improve accurate technics in martial arts«»mad max is the plausability«»mad max is especially
[13:57:31] notable because it is poised between our industrialized world and total regression to«»mad max is an australian movie made in 1979«»mad max is tremendously exciting«»mad max is a state of the art catamaran«»mad max is just
[13:57:33] sensational«»mad max is a strange film«»mad max is so much more exciting and compelling than the first half