This is a tcl script for eggdrop. Not for mIRC!
Loading:
##############################################################################################
## ## Advanced Google.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help ## ##
##############################################################################################
## ## To use this script you must set channel flag +google (ie .chanset #chan +google) ## ##
##############################################################################################
##############################################################################################
## ## Start Setup. ## ##
##############################################################################################
## Change the character between the "" below to change the command character/trigger. ##
set googlecmdchar "!"
proc google {nick host hand chan type search} {
if {[lsearch -exact [channel info $chan] +google] != -1} {
## Change the country code between the "" below to change the language of your results. ##
set googlectry "en"
## Change the number between the "" below to change the number of results returned. ##
set googlemax "3"
## Change the characters between the "" below to change the logo shown with each result. ##
set googlelogo "\002\0032g\0034o\0038o\00314g\0039l\0034e\002\003"
## Change the format codes between the "" below to change the color/state of the text. ##
set textf "\0034"
## Change the format codes between the "" below to change the color/state of the links. ##
set linkf "\003\037"
##############################################################################################
## ## End Setup. ## ##
##############################################################################################
set googlesite ajax.googleapis.com
set googleurl /ajax/services/search/${type}?v=1.0&rsz=large&q=${search}&ql=${googlectry}&lr=lang_${googlectry}
if {[catch {set googlesock [socket -async $googlesite 80]} sockerr]} {
putlog "$googlesite $googleurl $sockerr error"
return 0
} else {
puts $googlesock "GET $googleurl HTTP/1.0"
puts $googlesock "Host: $googlesite"
puts $googlesock "User-Agent: Opera 9.6"
puts $googlesock ""
flush $googlesock
while {![eof $googlesock]} {
set googlevar " [gets $googlesock] "
set googlelink [regexp -all -nocase -inline {\"url\":\"([^\"]*)\"} $googlevar]
set googledesc [regexp -all -nocase -inline {\"title\":\"([^\"]*)\"} $googlevar]
if {$googledesc != "" && $googlelink != ""} {
for {set x 1} {$x <= [expr 2 * $googlemax]} {incr x 2} {
if {[lindex $googledesc $x] != "" && [lindex $googlelink $x] != ""} {
putserv "PRIVMSG $chan :$googlelogo $textf[dehex [lindex $googledesc $x]] $linkf[dehex [lindex $googlelink $x]]"
}
}
}
}
close $googlesock
return 0
}
}
}
proc asc {chr} {
scan $chr %c asc
return $asc
}
proc chr {asc} { return [format %c $asc] }
proc hex {decimal} { return [format %x $decimal] }
proc decimal {hex} { return [expr 0x$hex] }
proc dehex {string} {
set string [subst [regsub -nocase -all {\\u([a-f0-9]{4})} [noeval $string] {[format %c [decimal \1]]}]]
set string [subst [regsub -nocase -all {\%([a-f0-9]{2})} [noeval $string] {[format %c [decimal \1]]}]]
set string [subst [regsub -nocase -all {\&#([0-9]{2});} [noeval $string] {[format %c \1]}]]
set string [string map {" \" · · & & <b> \002 </b> \002} $string]
return $string
}
proc noeval {string} {
return [string map {[ \\[ ] \\] $ \\$ ( \\( ) \\)} $string]
}
proc urlencode {string} {
regsub -all {^\{|\}$} $string "" string
return [subst [regsub -nocase -all {([^a-z0-9])} $string {%[format %x [scan "\\&" %c]]}]]
}
proc googleweb {nick host hand chan args} { google $nick $host $hand $chan "web" [urlencode $args] }
proc googlelocal {nick host hand chan args} { google $nick $host $hand $chan "local" [urlencode $args] }
proc googlevideo {nick host hand chan args} { google $nick $host $hand $chan "video" [urlencode $args] }
proc googlenews {nick host hand chan args} { google $nick $host $hand $chan "news" [urlencode $args] }
proc googlebook {nick host hand chan args} { google $nick $host $hand $chan "books" [urlencode $args] }
proc googleimage {nick host hand chan args} { google $nick $host $hand $chan "images" [urlencode $args] }
proc googlepatent {nick host hand chan args} { google $nick $host $hand $chan "patent" [urlencode $args] }
bind pub - ${googlecmdchar}google googleweb
bind pub - ${googlecmdchar}glocal googlelocal
bind pub - ${googlecmdchar}gvideo googlevideo
bind pub - ${googlecmdchar}gnews googlenews
bind pub - ${googlecmdchar}gbook googlebook
bind pub - ${googlecmdchar}gimage googleimage
bind pub - ${googlecmdchar}gpatent googlepatent
setudef flag google
@Nashman aside from editing the colors in the setup at the top of the script, you will need to change line 64 of the script from:
set string [string map {" \" · · & & <b> \002 </b> \002} $string]
to:
set string [string map {" \" · · & & <b> "" </b> ""} $string]
The colors in the setup will also need to be changed to ""
And the logo to just plain "Youtube"
@FordLawnmower I removed the script, restarted the bot and then added the script again. Didn't work. I reset the chanmode file, didn't work. Then i completely redid the bot and now it's working again... i dunno what sorcery this is but ye.. it's working again.
Thanks for your reply tho! :)
Edit: it appears that the +c chanmode had some influence in that aswell (no bold/colored text). I've removed the colored google links before but the bold part is still there. Could you point me to how i can remove the bold highlight part of the displayed link?
@Nashman I can't find any problems with this script. I just loaded it from here to a new bot with no issues.
Can you explain your problem a little.
@Dramakus Sure. Just change line 12 from:
if {[lsearch -exact [channel info $chan] +google] != -1} {
To:
if {[lsearch -exact [channel info $chan] +google] != -1 && [isvoice $nick $chan]} {
Keep in mind that this method uses the irc module which keeps track of voiced users by recording mode changes.
In other words, if the bot didn't see a user get voiced it will not recognize him/her as a voiced user.
@GravitaZ The "unmatched open quote" error should be resolved in all scripts now.
Hawkee fixed it yesterday. Please try copying the code for twitter search again and let me know if you have any problems. This was just a simple matter of " being converted to " inside the code box, causing a unmatched quote in a call to "string map" . It should be fine now :)
Thanks for noticing this GravitaZ.
Due to a parsing issue , the code at the top is broken.
For now just use this code please: http://pastebin.com/46NsLDJG
I get these upon entry to that link:> Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 114
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 474
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 488
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 503
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 522
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 545
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 583
Deprecated: Call-time pass-by-reference has been deprecated in E:\Inetpub\wwwroot\mIRC\engine.php on line 589
@Ford: It was made by FleshTH and Wiz126 on SwiftIRC. Link: http://fleshth.no-ip.org/mIRC/
@darkc0de a conversion script from mIRC to tcl would be a monster task as tcl has very few built in functions. It could be done but you would have to have nothing but time on your hands.
I have seen some routines for mIRC re-written in perl and php. If you look around you can find them. I have also heard about a full mSL interpreter written in php, but I've never seen it myself.
I'm pretty decent at converting them but it would have to be a script that would be used by a large number of people before I would consider it.
what is Console ?