<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13753" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-10-10T13:27:45-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13753</id>

		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2007-10-10T13:27:45-04:00</updated>

		<published>2007-10-10T13:27:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76571#p76571</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76571#p76571"/>
		<title type="html"><![CDATA[Fix script Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76571#p76571"><![CDATA[
<blockquote class="uncited"><div>Hey guys, when im start this command "!item xyz" get im this Error Message on the Partyline. <div class="codebox"><p>Code: </p><pre><code>Tcl error [alla_proc]: can't read "exact": no such variable</code></pre></div>Any Ideas? Sorry for my Bad eng. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"></div></blockquote><div class="codebox"><p>Code: </p><pre><code>while {[string length $body] &gt; 0} {       # .. Snipped irrelevant code ..      set exact [string compare $sname $itemname]      if {$exact == 0} {         break         }      }   if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG lpole == $lpole" }   if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG exact == $exact" }   if {$exact != 0 &amp;&amp; [llength $lpole] &gt; 1} {</code></pre></div>You can see above, if the BODY of the html length is greater than 0, exact will be set inside this while loop.  If you enter some itemname that doesn't exist, it won't set exact correctly because the body of the html length is 0.  It will fail to qualify to process the while loop where exact is set and instead will fall into those 2 conditionals at the very bottom of the code above, which require having exact set.  This is your problem. The easiest fix would be to have something like this:<em class="text-italics"><strong class="text-strong">  if {![info exists exact]} { set exact 0 }</strong></em> just before this line: <strong class="text-strong"><em class="text-italics"> if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG exact == $exact" } </em></strong><div class="codebox"><p>Code: </p><pre><code>proc replacevar {strin what withwhat} {        set output $strin        set replacement $withwhat        set cutpos 0        while { [string first $what $output] != -1 } {                set cutstart [expr [string first $what $output] - 1]                set cutstop  [expr $cutstart + [string length $what] + 1]                set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]        }        return $output} </code></pre></div>This is the most redundant and stupid part of this script, alot of this kludgey bullshit should be removed by whoever next attempts to fix this pile of spaghetti code.  The guy never thought splitting the string into a list and using lreplace would be faster?  Instead he writes kludgey tcl proc to "act like it".. not smart, not fast.. Seems alot of the time that replacevar proc is called as well, a simple string map could've done better. I'm assuming this script was written whilst humans still rode dinosaurs.. YABBA DABBA DOO!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Wed Oct 10, 2007 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[aLca]]></name></author>
		<updated>2007-10-07T16:29:05-04:00</updated>

		<published>2007-10-07T16:29:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=76462#p76462</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=76462#p76462"/>
		<title type="html"><![CDATA[Fix script Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=76462#p76462"><![CDATA[
Hey guys, when im start this command "!item xyz" get im this Error Message on the Partyline. <div class="codebox"><p>Code: </p><pre><code>Tcl error [alla_proc]: can't read "exact": no such variable</code></pre></div>Any Ideas? Sorry for my Bad eng. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9357">aLca</a> — Sun Oct 07, 2007 4:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[FarCry]]></name></author>
		<updated>2007-07-13T11:33:10-04:00</updated>

		<published>2007-07-13T11:33:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74406#p74406</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74406#p74406"/>
		<title type="html"><![CDATA[Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74406#p74406"><![CDATA[
SCRIPT FIXED SUCCESFULY<div class="codebox"><p>Code: </p><pre><code>-( 18:50:23 )- &lt;^ThE^&gt; !item The Planar Edge-( 18:50:45 )- &lt;WoWWiki&gt; Item: The Planar Edge (purple)-( 18:50:47 )- &lt;WoWWiki&gt; Binds when picked up-( 18:50:49 )- &lt;WoWWiki&gt; Unique-( 18:50:51 )- &lt;WoWWiki&gt; Main Hand-( 18:50:53 )- &lt;WoWWiki&gt; Axe-( 18:50:55 )- &lt;WoWWiki&gt; 159 - 296 Damage-( 18:50:57 )- &lt;WoWWiki&gt; Speed 2.70-( 18:50:59 )- &lt;WoWWiki&gt; (84.3 damage per second)-( 18:51:01 )- &lt;WoWWiki&gt; Requires Level 70-( 18:51:03 )- &lt;WoWWiki&gt; Requires: Master Axesmith-( 18:51:05 )- &lt;WoWWiki&gt; Equip:-( 18:51:07 )- &lt;WoWWiki&gt; Increases attack power by 42.-( 18:51:09 )- &lt;WoWWiki&gt; Equip: Improves critical strike rating by 20.( 18:51:13 )- &lt;WoWWiki&gt; http://wow.allakhazam.com/db/item.html?source=live;witem=28431</code></pre></div><div class="codebox"><p>Code: </p><pre><code>####### Developers ######## Allakhazam item info v1.0.0 by Lopo## Allakhazam item info v1.0.1 Modifed by ^ThE^ // irc.lv# Email: serj3@inbox.lv# based on the imdb info script released by phillie########################### Changes:#   1 - Fixed all link to receive item#   2 - Use now http 2.5.0#   3 - TCL version 8.2#   4 - Command !alla rename it to !item#   5 - Fixed some bugs with http connections# Usage:## !item &lt;itemname&gt;## -h show help## cookies for output format:## bold       = %bold# underline  = %uline# colors     = %color#,## new line   = \n## to reset colors, just use %color without any arguments.################################## CONFIG ########## debug mode?set DEBUG 0set ALLAversion "1.0.1"# proxy support. leave empty to disableset ALLAhost ""set ALLAport ""# trigger you want to useset ALLAtrigger "!item"# userflags needed to use this scriptset ALLArights "-|-"# use +imdb chan-modeset ALLAperm 0# 0 for response via notice to $nick, 1 for msg to $chanset pub_or_not 1######################################################################## HTTP/TCL ########setudef flag allapackage require Tcl 8.2package require http 2.5.0####### Public Commands/Rights/Debugbind pub $ALLArights $ALLAtrigger alla_proc###### HTML CODES ######proc htmlcodes {tempfile} {set mapfile [string map {" ' &amp; &amp; [ ( \ / ] ) { ( } ) £ Ј ¨ Ё © © « « ­ ­ ® ® } $tempfile]set mapfile [string map {´ ґ · · ¹ № » » ¼ ј ½ Ѕ ¾ ѕ À А Á Б Â В } $mapfile]set mapfile [string map {Ã Г Ä Д Å Е Æ Ж Ç З È И É Й Ê К Ë Л Ì М Í Н Î О Ï П Ð Р Ñ С Ò Т Ó У Ô Ф Õ Х Ö Ц } $mapfile]set mapfile [string map {× Ч Ø Ш Ù Щ Ú Ъ Û Ы Ü Ь Ý Э Þ Ю ß Я à а á б â в ã г ä д å е æ ж ç з è и é й ê к } $mapfile]set mapfile [string map {ë л ì м í н î о ï п ð р ñ с ò т ó у ô ф õ х ö ц ÷ ч ø ш ù щ ú ъ û ы ü ь ý э þ ю } $mapfile]return $mapfile}###### Channel Check ######proc channel_check { chan } {        foreach setting [channel info $chan] {                if {[regexp -- {^[\+-]} $setting]} {                        if {![string compare "+alla" $setting]} {                                set permission 1                        } else {                                set permission 0                        }                }        }        return $permission}proc replacevar {strin what withwhat} {        set output $strin        set replacement $withwhat        set cutpos 0        while { [string first $what $output] != -1 } {                set cutstart [expr [string first $what $output] - 1]                set cutstop  [expr $cutstart + [string length $what] + 1]                set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]        }        return $output}######################################### Conf ##########################################proc alla_proc { nick uhost handle chan argv } {global DEBUG ALLAtrigger announce pub_or_not ALLAperm allablow        # channel_check permissionif {$ALLAperm == 1} {        set permission_result [channel_check $chan]        if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG permission_result == $permission_result" }        if { $permission_result == 0 } { return }}        if {$pub_or_not == 1 } { set toput "PRIVMSG $chan" } else { set toput "NOTICE $nick" }set start 0set extended 1set linkonly 0if {$argv == ""} {if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG no argv passed, show help notice" }putserv "PRIVMSG $chan :\[\002Allakhazam\002\] try $ALLAtrigger -help"return}if {[lindex $argv 0] == "-help" || [lindex $argv 1] == "-help" || [lindex $argv 2] == "-help" || [lindex $argv 3] == "-help"} {if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG argv == help, show help" }putserv "PRIVMSG $nick :Item info v$ALLAversion"putserv "PRIVMSG $nick :----------------------------------------------------------------"putserv "PRIVMSG $nick :$ALLAtrigger : &lt;itemname&gt;"putserv "PRIVMSG $nick :     "putserv "PRIVMSG $nick :\002options\002:"putserv "PRIVMSG $nick :\002-help\002    show help"putserv "PRIVMSG $nick :\002-l\002    show only http link"return}############################################################################################# check for commandsif {[lindex $argv 0] == "-l" || [lindex $argv 1] == "-l" || [lindex $argv 2] == "-l" || [lindex $argv 3] == "-l"} {incr startincr linkonlyset moviename [lrange $argv $start end]}# create moviename using $startset moviename [lrange $argv $start end]# initial searchset allaurl "http://wow.allakhazam.com"set allasearchurl "http://wow.allakhazam.com/search.html?q="set timeout 20000set searchString [::http::formatQuery $moviename]set searchString [string trimleft $searchString "+"]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG searchString: \"$searchString\"" }set page [::http::config -useragent "MSIE 6.0" -proxyhost $::ALLAhost -proxyport $::ALLAport]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ${allasearchurl}$searchString" }if {[catch {::http::geturl ${allasearchurl}$searchString -timeout $timeout} page]} {putlog "\002ALLA Error\002: $page"} elseif {[http::status $page] == "timeout"} {putlog "\002ALLA Error\002: Timeout after $timeout seconds"}set html [::http::data $page]::http::Finish $pageif {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0" }upvar 0 $page oldpageset body $oldpage(body)set pos [expr [string first "&gt;0 items found.&lt;" $body] + 0]if {$pos != -1} {putserv "$toput :0 items found."return}set pos [expr [string first "items found" $body] + 11]set body [string range $body $pos end]set lpole {}set sname [string tolower [replacevar $searchString "+" " "]]while {[string length $body] &gt; 0} {set pos [expr [string first "/images/icons/" $body]]if {$pos == -1} {break}set body [string range $body $pos end]set pos [expr [string first "/db/item.html?source=live;witem=" $body] + 0]set body [string range $body $pos end]regexp {witem=[0-9]+} $body itemidset itemid [string range $itemid 6 end] if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ItemID == $itemid" }set pos [expr [string first "name\"&gt;" $body] + 6]set body [string range $body $pos end]set pos1 [expr [string first &lt; $body] - 1]set itemname [string range $body 0 $pos1]set pole($itemid) $itemnamelappend lpole $itemidset itemname [string tolower $itemname]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG Itemname == $itemname" }set exact [string compare $sname $itemname]if {$exact == 0} {break}}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG lpole == $lpole" }if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG exact == $exact" }if {$exact != 0 &amp;&amp; [llength $lpole] &gt; 1} {putserv "$toput :[llength $lpole] items found"foreach i $lpole {if {[llength $lpole] &lt; 11} {putserv "$toput :http://wow.allakhazam.com/db/item.html?source=live;witem=$i - $pole($i)"} {putserv "PRIVMSG $nick :http://wow.allakhazam.com/db/item.html?source=live;witem=$i - $pole($i)"}}return}set iid $itemidif {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 iID == $iid" }if {$linkonly&gt;0} {putserv "$toput :http://wow.allakhazam.com/db/item.html?source=live;witem==$iid"return}set newurl "$allaurl/dev/wow/item-xml.pl?source=live;witem=$iid"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 = $newurl" }unset htmlset page [::http::config -useragent "MSIE 6.0" -proxyhost $::ALLAhost -proxyport $::ALLAport]if {[catch {::http::geturl $newurl -timeout $timeout} page]} {putlog "\002ALLA Error\002: $page"} elseif {[http::status $page] == "timeout"} {putlog "\002ALLA Error\002: Timeout after $timeout mseconds"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG Timeout after $timeout mseconds"}return}set html [::http::data $page]::http::Finish $page# for bogus searchesif {[string length $newurl] == 0} {putserv "$toput :No no no! I can't find that!"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG bogus searches" }return}set iname "N/A"; set idesc "N/A"## get titleif [regexp {&lt;name1&gt;[^&lt;]+} $html iname] {set pos [expr [string last &gt; $iname] + 1]set iname [string range $iname $pos end]set iname [htmlcodes $iname]}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG iname == $iname" }## full descset fhtml {}set beg 0foreach i $html {set pos [string first "&lt;display_html&gt;" $i]if {$pos&gt;-1} {set fhtml [string range $i $pos end]set beg 1continue}set pos1 [string first "&lt;/display_html&gt;" $i]if {$pos1&gt;-1} {append fhtml " "append fhtml [string range $i 0 $pos1]break}append fhtml " "append fhtml $i}set pos [expr [string first &gt; $fhtml] + 1]set pos1 [expr [string last &lt; $fhtml] - 1]set popis [string range $fhtml $pos $pos1]set phtml [replacevar $popis "&amp;nbsp;" " "]set phtml [replacevar $phtml "&lt;" "&lt;"]set phtml [replacevar $phtml "&gt;" "&gt;"]set phtml [replacevar $phtml """ "\""]set phtml [replacevar $phtml " &lt;" "&lt;"]set phtml [replacevar $phtml "&gt; " "&gt;"]set phtml [replacevar $phtml "&lt;br /&gt;" "&lt;br/&gt;"]set pos [expr [string first "&lt;span class=\"akznotice\"&gt;" $phtml] -1]set dhtml [string range $phtml 0 $pos]set pos [expr [string first $iname $dhtml] + [string length $iname]]set icname [string range $dhtml 0 $pos]set pos1 [expr [string last "\"" $icname] - 5]set icname [string range $icname 0 $pos1]set pos1 [expr [string last "\"" $icname] + 1]set icname [string range $icname $pos1 end]set dhtml [string range $dhtml $pos end]set pos [expr [string first "&lt;br/&gt;" $dhtml] + 5]set dhtml [string range $dhtml $pos end]set dhtml [htmlcodes $dhtml]set out {}set len [expr [string length $dhtml]]while {$len&gt;0} {set pos [expr [string first &lt; $dhtml]]if {$pos == -1} {lappend out $dhtmlbreak;}if {$pos == 0} {set pos [expr [string first &gt; $dhtml] + 1]set dhtml [string range $dhtml $pos end]continue}set pos1 [expr [string first &lt; $dhtml] - 1]set line [string range $dhtml 0 $pos1]lappend out $lineset dhtml [string range $dhtml $pos end]set len [string length $dhtml]}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG out == $out" }putserv "$toput :Item: $iname  Color: $icname "foreach line $out {putserv "$toput :$line"        }putserv "$toput :Item Link: http://wow.allakhazam.com/db/item.html?source=live;witem=$iid"}putlog "alla info - v$ALLAversion loaded ..."]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9142">FarCry</a> — Fri Jul 13, 2007 11:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[FarCry]]></name></author>
		<updated>2007-07-13T11:06:57-04:00</updated>

		<published>2007-07-13T11:06:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74403#p74403</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74403#p74403"/>
		<title type="html"><![CDATA[Fix script Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74403#p74403"><![CDATA[
<blockquote class="uncited"><div>No doubt the website changed.</div></blockquote>can u fix this <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9142">FarCry</a> — Fri Jul 13, 2007 11:06 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-07-12T19:10:42-04:00</updated>

		<published>2007-07-12T19:10:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74389#p74389</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74389#p74389"/>
		<title type="html"><![CDATA[Fix script Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74389#p74389"><![CDATA[
No doubt the website changed.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Jul 12, 2007 7:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[FarCry]]></name></author>
		<updated>2007-07-12T11:53:02-04:00</updated>

		<published>2007-07-12T11:53:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74382#p74382</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74382#p74382"/>
		<title type="html"><![CDATA[Fix script Allakhazam]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74382#p74382"><![CDATA[
Please help fix problem with this script !!!<br>I don't know why he not work .<br><br>Sry for my bad english .<br><div class="codebox"><p>Code: </p><pre><code># Allakhazam item info v1.0.0 by Lopo# based on the imdb info script released by phillie## usage:## !alla [-hl] &lt;itemname&gt;## -h   show help## cookies for output format:## bold       = %bold# underline  = %uline# colors     = %color#,## new line   = \n## to reset colors, just use %color without any arguments.## config:# -------# debug mode?set DEBUG 0set ALLAversion "1.0.0"# proxy support. leave empty to disableset ALLAhost ""set ALLAport ""# trigger you want to useset ALLAtrigger "!alla"# userflags needed to use this scriptset ALLArights "-|-"# use +imdb chan-modeset ALLAperm 0# 0 for response via notice to $nick, 1 for msg to $chanset pub_or_not 1#################################################################setudef flag allapackage require httpbind pub $ALLArights $ALLAtrigger alla_procproc htmlcodes {tempfile} {set mapfile [string map {" ' &amp; &amp; [ ( \ / ] ) { ( } ) £ Ј ¨ Ё © © « « ­ ­ ® ® } $tempfile]set mapfile [string map {´ ґ · · ¹ № » » ¼ ј ½ Ѕ ¾ ѕ À А Á Б Â В } $mapfile]set mapfile [string map {Ã Г Ä Д Å Е Æ Ж Ç З È И É Й Ê К Ë Л Ì М Í Н Î О Ï П Ð Р Ñ С Ò Т Ó У Ô Ф Õ Х Ö Ц } $mapfile]set mapfile [string map {× Ч Ø Ш Ù Щ Ú Ъ Û Ы Ü Ь Ý Э Þ Ю ß Я à а á б â в ã г ä д å е æ ж ç з è и é й ê к } $mapfile]set mapfile [string map {ë л ì м í н î о ï п ð р ñ с ò т ó у ô ф õ х ö ц ÷ ч ø ш ù щ ú ъ û ы ü ь ý э þ ю } $mapfile]return $mapfile}proc channel_check { chan } {        foreach setting [channel info $chan] {                if {[regexp -- {^[\+-]} $setting]} {                        if {![string compare "+alla" $setting]} {                                set permission 1                        } else {                                set permission 0                        }                }        }        return $permission}proc replacevar {strin what withwhat} {        set output $strin        set replacement $withwhat        set cutpos 0        while { [string first $what $output] != -1 } {                set cutstart [expr [string first $what $output] - 1]                set cutstop  [expr $cutstart + [string length $what] + 1]                set output [string range $output 0 $cutstart]$replacement[string range $output $cutstop end]        }        return $output}proc alla_proc { nick uhost handle chan argv } {global DEBUG ALLAtrigger announce pub_or_not ALLAperm allablow        # channel_check permissionif {$ALLAperm == 1} {        set permission_result [channel_check $chan]        if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG permission_result == $permission_result" }        if { $permission_result == 0 } { return }}        if {$pub_or_not == 1 } { set toput "PRIVMSG $chan" } else { set toput "NOTICE $nick" }set start 0set extended 1set linkonly 0if {$argv == ""} {if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG no argv passed, show help notice" }putserv "PRIVMSG $chan :\[\002Allakhazam\002\] try $ALLAtrigger -h"return}if {[lindex $argv 0] == "-h" || [lindex $argv 1] == "-h" || [lindex $argv 2] == "-h" || [lindex $argv 3] == "-h"} {if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG argv == help, show help" }putserv "PRIVMSG $nick :Allakhazam item info v$ALLAversion by Lopo"putserv "PRIVMSG $nick :----------------------------------------------------------------"putserv "PRIVMSG $nick :$ALLAtrigger \[-hl\] &lt;itemname&gt;"putserv "PRIVMSG $nick :     "putserv "PRIVMSG $nick :\002options\002:"putserv "PRIVMSG $nick :\002-h\002    show help"putserv "PRIVMSG $nick :\002-l\002    show only http link"return}# check for commandsif {[lindex $argv 0] == "-l" || [lindex $argv 1] == "-l" || [lindex $argv 2] == "-l" || [lindex $argv 3] == "-l"} {incr startincr linkonlyset moviename [lrange $argv $start end]}# create moviename using $startset moviename [lrange $argv $start end]# initial searchset allaurl "http://wow.allakhazam.com"set allasearchurl "http://wow.allakhazam.com/search.html?q="set timeout 20000set searchString [::http::formatQuery $moviename]set searchString [string trimleft $searchString "+"]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG searchString: \"$searchString\"" }set page [::http::config -useragent "MSIE 6.0" -proxyhost $::ALLAhost -proxyport $::ALLAport]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ${allasearchurl}$searchString" }if {[catch {::http::geturl ${allasearchurl}$searchString -timeout $timeout} page]} {putlog "\002ALLA Error\002: $page"} elseif {[http::status $page] == "timeout"} {putlog "\002ALLA Error\002: Timeout after $timeout seconds"}set html [::http::data $page]::http::Finish $pageif {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0" }upvar 0 $page oldpageset body $oldpage(body)set pos [expr [string first "&gt;0 items found.&lt;" $body] + 0]if {$pos != -1} {putserv "$toput :0 items found."return}set pos [expr [string first "items found" $body] + 11]set body [string range $body $pos end]set lpole {}set sname [string tolower [replacevar $searchString "+" " "]]while {[string length $body] &gt; 0} {set pos [expr [string first "/images/icons/" $body]]if {$pos == -1} {break}set body [string range $body $pos end]set pos [expr [string first "/db/item.html?witem=" $body] + 0]set body [string range $body $pos end]regexp {witem=[0-9]+} $body itemidset itemid [string range $itemid 6 end] if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ItemID == $itemid" }set pos [expr [string first "name\"&gt;" $body] + 6]set body [string range $body $pos end]set pos1 [expr [string first &lt; $body] - 1]set itemname [string range $body 0 $pos1]set pole($itemid) $itemnamelappend lpole $itemidset itemname [string tolower $itemname]if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG Itemname == $itemname" }set exact [string compare $sname $itemname]if {$exact == 0} {break}}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG lpole == $lpole" }if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG exact == $exact" }if {$exact != 0 &amp;&amp; [llength $lpole] &gt; 1} {putserv "$toput :[llength $lpole] items found"foreach i $lpole {if {[llength $lpole] &lt; 11} {putserv "$toput :http://wow.allakhazam.com/db/item.html?witem=$i - $pole($i)"} {putserv "PRIVMSG $nick :http://wow.allakhazam.com/db/item.html?witem=$i - $pole($i)"}}return}set iid $itemidif {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 iID == $iid" }if {$linkonly&gt;0} {putserv "$toput :http://wow.allakhazam.com/db/item.html?witem=$iid"return}set newurl "$allaurl/dev/wow/item-xml.pl?witem=$iid"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 = $newurl" }unset htmlset page [::http::config -useragent "MSIE 6.0" -proxyhost $::ALLAhost -proxyport $::ALLAport]if {[catch {::http::geturl $newurl -timeout $timeout} page]} {putlog "\002ALLA Error\002: $page"} elseif {[http::status $page] == "timeout"} {putlog "\002ALLA Error\002: Timeout after $timeout mseconds"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG Timeout after $timeout mseconds"}return}set html [::http::data $page]::http::Finish $page# for bogus searchesif {[string length $newurl] == 0} {putserv "$toput :No no no! I can't find that!"if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG bogus searches" }return}set iname "N/A"; set idesc "N/A"## get titleif [regexp {&lt;name1&gt;[^&lt;]+} $html iname] {set pos [expr [string last &gt; $iname] + 1]set iname [string range $iname $pos end]set iname [htmlcodes $iname]}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG iname == $iname" }## full descset fhtml {}set beg 0foreach i $html {set pos [string first "&lt;display_html&gt;" $i]if {$pos&gt;-1} {set fhtml [string range $i $pos end]set beg 1continue}set pos1 [string first "&lt;/display_html&gt;" $i]if {$pos1&gt;-1} {append fhtml " "append fhtml [string range $i 0 $pos1]break}append fhtml " "append fhtml $i}set pos [expr [string first &gt; $fhtml] + 1]set pos1 [expr [string last &lt; $fhtml] - 1]set popis [string range $fhtml $pos $pos1]set phtml [replacevar $popis "&amp;nbsp;" " "]set phtml [replacevar $phtml "&lt;" "&lt;"]set phtml [replacevar $phtml "&gt;" "&gt;"]set phtml [replacevar $phtml """ "\""]set phtml [replacevar $phtml " &lt;" "&lt;"]set phtml [replacevar $phtml "&gt; " "&gt;"]set phtml [replacevar $phtml "&lt;br /&gt;" "&lt;br/&gt;"]set pos [expr [string first "&lt;span class=\"akznotice\"&gt;" $phtml] -1]set dhtml [string range $phtml 0 $pos]set pos [expr [string first $iname $dhtml] + [string length $iname]]set icname [string range $dhtml 0 $pos]set pos1 [expr [string last "\"" $icname] - 5]set icname [string range $icname 0 $pos1]set pos1 [expr [string last "\"" $icname] + 1]set icname [string range $icname $pos1 end]set dhtml [string range $dhtml $pos end]set pos [expr [string first "&lt;br/&gt;" $dhtml] + 5]set dhtml [string range $dhtml $pos end]set dhtml [htmlcodes $dhtml]set out {}set len [expr [string length $dhtml]]while {$len&gt;0} {set pos [expr [string first &lt; $dhtml]]if {$pos == -1} {lappend out $dhtmlbreak;}if {$pos == 0} {set pos [expr [string first &gt; $dhtml] + 1]set dhtml [string range $dhtml $pos end]continue}set pos1 [expr [string first &lt; $dhtml] - 1]set line [string range $dhtml 0 $pos1]lappend out $lineset dhtml [string range $dhtml $pos end]set len [string length $dhtml]}if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG out == $out" }putserv "$toput : Item: $iname ($icname)"foreach line $out {putserv "$toput :$line"        }putserv "$toput :http://wow.allakhazam.com/db/item.html?witem=$iid"}putlog "alla info - v$ALLAversion loaded ..."</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9142">FarCry</a> — Thu Jul 12, 2007 11:53 am</p><hr />
]]></content>
	</entry>
	</feed>
