This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Support & discussion of released scripts, and announcements of new releases.
FarCry
Voice
Posts: 7 Joined: Wed Jul 11, 2007 2:27 pm
Post
by FarCry » Thu Jul 12, 2007 11:53 am
Please help fix problem with this script !!!
I don't know why he not work .
Sry for my bad english .
Code: Select all
# Allakhazam item info v1.0.0 by Lopo
# based on the imdb info script released by phillie
#
# usage:
#
# !alla [-hl] <itemname>
#
# -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 0
set ALLAversion "1.0.0"
# proxy support. leave empty to disable
set ALLAhost ""
set ALLAport ""
# trigger you want to use
set ALLAtrigger "!alla"
# userflags needed to use this script
set ALLArights "-|-"
# use +imdb chan-mode
set ALLAperm 0
# 0 for response via notice to $nick, 1 for msg to $chan
set pub_or_not 1
#################################################################
setudef flag alla
package require http
bind pub $ALLArights $ALLAtrigger alla_proc
proc htmlcodes {tempfile} {
set mapfile [string map {" ' & & [ ( \ / ] ) { ( } ) £ Ј ¨ Ё © © « « ® ® } $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 permission
if {$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 0
set extended 1
set linkonly 0
if {$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\] <itemname>"
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 commands
if {[lindex $argv 0] == "-l" || [lindex $argv 1] == "-l" || [lindex $argv 2] == "-l" || [lindex $argv 3] == "-l"} {
incr start
incr linkonly
set moviename [lrange $argv $start end]
}
# create moviename using $start
set moviename [lrange $argv $start end]
# initial search
set allaurl "http://wow.allakhazam.com"
set allasearchurl "http://wow.allakhazam.com/search.html?q="
set timeout 20000
set 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 $page
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0" }
upvar 0 $page oldpage
set body $oldpage(body)
set pos [expr [string first ">0 items found.<" $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] > 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 itemid
set itemid [string range $itemid 6 end]
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ItemID == $itemid" }
set pos [expr [string first "name\">" $body] + 6]
set body [string range $body $pos end]
set pos1 [expr [string first < $body] - 1]
set itemname [string range $body 0 $pos1]
set pole($itemid) $itemname
lappend lpole $itemid
set 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 && [llength $lpole] > 1} {
putserv "$toput :[llength $lpole] items found"
foreach i $lpole {
if {[llength $lpole] < 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 $itemid
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 iID == $iid" }
if {$linkonly>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 html
set 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 searches
if {[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 title
if [regexp {<name1>[^<]+} $html iname] {
set pos [expr [string last > $iname] + 1]
set iname [string range $iname $pos end]
set iname [htmlcodes $iname]
}
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG iname == $iname" }
## full desc
set fhtml {}
set beg 0
foreach i $html {
set pos [string first "<display_html>" $i]
if {$pos>-1} {
set fhtml [string range $i $pos end]
set beg 1
continue
}
set pos1 [string first "</display_html>" $i]
if {$pos1>-1} {
append fhtml " "
append fhtml [string range $i 0 $pos1]
break
}
append fhtml " "
append fhtml $i
}
set pos [expr [string first > $fhtml] + 1]
set pos1 [expr [string last < $fhtml] - 1]
set popis [string range $fhtml $pos $pos1]
set phtml [replacevar $popis " " " "]
set phtml [replacevar $phtml "<" "<"]
set phtml [replacevar $phtml ">" ">"]
set phtml [replacevar $phtml """ "\""]
set phtml [replacevar $phtml " <" "<"]
set phtml [replacevar $phtml "> " ">"]
set phtml [replacevar $phtml "<br />" "<br/>"]
set pos [expr [string first "<span class=\"akznotice\">" $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 "<br/>" $dhtml] + 5]
set dhtml [string range $dhtml $pos end]
set dhtml [htmlcodes $dhtml]
set out {}
set len [expr [string length $dhtml]]
while {$len>0} {
set pos [expr [string first < $dhtml]]
if {$pos == -1} {
lappend out $dhtml
break;
}
if {$pos == 0} {
set pos [expr [string first > $dhtml] + 1]
set dhtml [string range $dhtml $pos end]
continue
}
set pos1 [expr [string first < $dhtml] - 1]
set line [string range $dhtml 0 $pos1]
lappend out $line
set 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 ..."
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Thu Jul 12, 2007 7:10 pm
No doubt the website changed.
FarCry
Voice
Posts: 7 Joined: Wed Jul 11, 2007 2:27 pm
Post
by FarCry » Fri Jul 13, 2007 11:06 am
rosc2112 wrote: No doubt the website changed.
can u fix this
FarCry
Voice
Posts: 7 Joined: Wed Jul 11, 2007 2:27 pm
Post
by FarCry » Fri Jul 13, 2007 11:33 am
SCRIPT FIXED SUCCESFULY
Code: Select all
-( 18:50:23 )- <^ThE^> !item The Planar Edge
-( 18:50:45 )- <WoWWiki> Item: The Planar Edge (purple)
-( 18:50:47 )- <WoWWiki> Binds when picked up
-( 18:50:49 )- <WoWWiki> Unique
-( 18:50:51 )- <WoWWiki> Main Hand
-( 18:50:53 )- <WoWWiki> Axe
-( 18:50:55 )- <WoWWiki> 159 - 296 Damage
-( 18:50:57 )- <WoWWiki> Speed 2.70
-( 18:50:59 )- <WoWWiki> (84.3 damage per second)
-( 18:51:01 )- <WoWWiki> Requires Level 70
-( 18:51:03 )- <WoWWiki> Requires: Master Axesmith
-( 18:51:05 )- <WoWWiki> Equip:
-( 18:51:07 )- <WoWWiki> Increases attack power by 42.
-( 18:51:09 )- <WoWWiki> Equip: Improves critical strike rating by 20.
( 18:51:13 )- <WoWWiki> http://wow.allakhazam.com/db/item.html?source=live;witem=28431
Code: Select all
####### 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 <itemname>
#
# -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 0
set ALLAversion "1.0.1"
# proxy support. leave empty to disable
set ALLAhost ""
set ALLAport ""
# trigger you want to use
set ALLAtrigger "!item"
# userflags needed to use this script
set ALLArights "-|-"
# use +imdb chan-mode
set ALLAperm 0
# 0 for response via notice to $nick, 1 for msg to $chan
set pub_or_not 1
#################################################################
####### HTTP/TCL ########
setudef flag alla
package require Tcl 8.2
package require http 2.5.0
####### Public Commands/Rights/Debug
bind pub $ALLArights $ALLAtrigger alla_proc
###### HTML CODES ######
proc htmlcodes {tempfile} {
set mapfile [string map {" ' & & [ ( \ / ] ) { ( } ) £ Ј ¨ Ё © © « « ® ® } $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 permission
if {$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 0
set extended 1
set linkonly 0
if {$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 : <itemname>"
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 commands
if {[lindex $argv 0] == "-l" || [lindex $argv 1] == "-l" || [lindex $argv 2] == "-l" || [lindex $argv 3] == "-l"} {
incr start
incr linkonly
set moviename [lrange $argv $start end]
}
# create moviename using $start
set moviename [lrange $argv $start end]
# initial search
set allaurl "http://wow.allakhazam.com"
set allasearchurl "http://wow.allakhazam.com/search.html?q="
set timeout 20000
set 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 $page
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0" }
upvar 0 $page oldpage
set body $oldpage(body)
set pos [expr [string first ">0 items found.<" $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] > 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 itemid
set itemid [string range $itemid 6 end]
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG ItemID == $itemid" }
set pos [expr [string first "name\">" $body] + 6]
set body [string range $body $pos end]
set pos1 [expr [string first < $body] - 1]
set itemname [string range $body 0 $pos1]
set pole($itemid) $itemname
lappend lpole $itemid
set 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 && [llength $lpole] > 1} {
putserv "$toput :[llength $lpole] items found"
foreach i $lpole {
if {[llength $lpole] < 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 $itemid
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG redirect 0 iID == $iid" }
if {$linkonly>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 html
set 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 searches
if {[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 title
if [regexp {<name1>[^<]+} $html iname] {
set pos [expr [string last > $iname] + 1]
set iname [string range $iname $pos end]
set iname [htmlcodes $iname]
}
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG iname == $iname" }
## full desc
set fhtml {}
set beg 0
foreach i $html {
set pos [string first "<display_html>" $i]
if {$pos>-1} {
set fhtml [string range $i $pos end]
set beg 1
continue
}
set pos1 [string first "</display_html>" $i]
if {$pos1>-1} {
append fhtml " "
append fhtml [string range $i 0 $pos1]
break
}
append fhtml " "
append fhtml $i
}
set pos [expr [string first > $fhtml] + 1]
set pos1 [expr [string last < $fhtml] - 1]
set popis [string range $fhtml $pos $pos1]
set phtml [replacevar $popis " " " "]
set phtml [replacevar $phtml "<" "<"]
set phtml [replacevar $phtml ">" ">"]
set phtml [replacevar $phtml """ "\""]
set phtml [replacevar $phtml " <" "<"]
set phtml [replacevar $phtml "> " ">"]
set phtml [replacevar $phtml "<br />" "<br/>"]
set pos [expr [string first "<span class=\"akznotice\">" $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 "<br/>" $dhtml] + 5]
set dhtml [string range $dhtml $pos end]
set dhtml [htmlcodes $dhtml]
set out {}
set len [expr [string length $dhtml]]
while {$len>0} {
set pos [expr [string first < $dhtml]]
if {$pos == -1} {
lappend out $dhtml
break;
}
if {$pos == 0} {
set pos [expr [string first > $dhtml] + 1]
set dhtml [string range $dhtml $pos end]
continue
}
set pos1 [expr [string first < $dhtml] - 1]
set line [string range $dhtml 0 $pos1]
lappend out $line
set 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 ..."
]
aLca
Voice
Posts: 1 Joined: Sun Oct 07, 2007 4:26 pm
Post
by aLca » Sun Oct 07, 2007 4:29 pm
Hey guys, when im start this command "!item xyz" get im this Error Message on the Partyline.
Code: Select all
Tcl error [alla_proc]: can't read "exact": no such variable
Any Ideas? Sorry for my Bad eng.
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Wed Oct 10, 2007 1:27 pm
aLca wrote: Hey guys, when im start this command "!item xyz" get im this Error Message on the Partyline.
Code: Select all
Tcl error [alla_proc]: can't read "exact": no such variable
Any Ideas? Sorry for my Bad eng.
Code: Select all
while {[string length $body] > 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 && [llength $lpole] > 1} {
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:
if {![info exists exact]} { set exact 0 } just before this line:
if {$DEBUG == 1} { putserv "NOTICE $nick :DEBUG exact == $exact" }
Code: Select all
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
}
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!