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.

imdb-1.1.0.tcl help please

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

i cant solve this problem .. i get this error when i try to load that new' Znuff's version into my bot.it says invalid command i cant found whatha ... that cmd is...it wrotes on line 1.. but nuthins wrong on line 1..need help...

Code: Select all

[21:35:11] Tcl error in file 'yum.conf':
[21:35:11] invalid command name ""
    while executing
""
    (file "scripts/imdb.tcl" line 1)
    invoked from within
"source scripts/imdb.tcl"
    (file "yum.conf" line 264)
[21:35:11] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Life iS Just a dReaM oN tHE wAy to DeaTh
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

That is most likely due to your editor adding the UTF-8 "Byte Order Mark" sequence at the beginning of the file. Use a different editor, or check if your current editor has an option to turn BOM off.
NML_375
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

hi nml375
thank you very much for your reply and yep you're r8..my bad..i was edit it with windows notepad yesterday. this time i use notepad++ and i just load it with no problem.. thnx a lot :)
Life iS Just a dReaM oN tHE wAy to DeaTh
User avatar
Anahel
Halfop
Posts: 48
Joined: Fri Jul 03, 2009 6:18 pm
Location: Dom!

Post by Anahel »

i'm using znuff's imdb script and i noticed that sometimes i'm getting this error:

Code: Select all

15:55:34 <nekomimi> [15:55:34] Tcl error [imdb_proc]: missing operand at _@_
15:55:34 <nekomimi> in expression "round(-_@_)"
while using !imdb Apollo 18

here's whole debug from imdb http://pastebin.com/R091n95m

could anyone help me?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Anahel wrote:i'm using znuff's imdb script and i noticed that sometimes i'm getting this error:

Code: Select all

15:55:34 <nekomimi> [15:55:34] Tcl error [imdb_proc]: missing operand at _@_
15:55:34 <nekomimi> in expression "round(-_@_)"
while using !imdb Apollo 18

here's whole debug from imdb http://pastebin.com/R091n95m

could anyone help me?

Code: Select all

set goldstars [expr round($rating)]
set greystars [expr 10 - $goldstars]
Find that part, those 2 lines...

and change it to ... this ... these several lines below. Expr is supposed to be used as a last resort (like regexp/regsub), and in this case it's forgotten to use braces around it's equation which contains variable contents. This is a problem, because not only does this slow the whole thing down. It can be exploited because using no braces within an expr will cause double substitution. There are other ways to "round" without using expr. I'll give a simple example below so it's quite easy to understand how it is rounding. Try the code below:

Code: Select all

# is there a rating?
if {[info exists $rating] && [string length $rating]} {
     # attain gold stars as integer that starts rating.
     set goldstars [lindex [split $rating "."] 0]
     # if decimal remnant of rating is equal to or greater than 0.5 add 1 to goldstars
     if {[join [lrange [split $rating "."] 1 end]] >= 0.5} { incr goldstars }
     # grey stars is out of 10, so subtract gold stars to find amount of grey stars
     # notice the expr below contains braces to make the expression "safe" and "faster"
     set greystars [expr {10 - $goldstars}]
# if there is no rating, gold and grey stars are 0
} else { set goldstars 0 ; set greystars 0 }
Have a fun ;)
User avatar
Anahel
Halfop
Posts: 48
Joined: Fri Jul 03, 2009 6:18 pm
Location: Dom!

Post by Anahel »

thanks speechles, now imdb is working tho there is no rating

Code: Select all

&Nekomimi> Ocena: - (375,523 glosow) []
(ocena means rating, and glosow = votes)

debug:

Code: Select all

<nekomimi> [14:38:39] IMDB_DEBUG rating == - | votes == 375,523 | rating bar == %color14[%color7%color7%color14]%color
d
deathtoll
Voice
Posts: 2
Joined: Fri Sep 23, 2011 9:46 pm

Post by deathtoll »

I am also experiencing this same exact problem, the code snippet that was posted fixes the script but for some reason the script does not show the rating, and I think it may be a problem with the routine to actually fetch the rating from IMDB, as the rating code does display properly except it has nothing to parse to generate the rating bar is what I assume the problem is. Not meaning to bump this topic but I am surprised more people are not having this problem with the new version of the script. Thank you!
g
goalie204
Halfop
Posts: 44
Joined: Thu Apr 28, 2011 7:31 pm

Post by goalie204 »

ditto, rating not showing anymore
l
l1ve
Voice
Posts: 7
Joined: Tue Oct 30, 2007 3:18 pm

Post by l1ve »

NEED Update pls
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Here's my working version with speechles's info/help added:

http://bsdunix.info/eggdrop/scripts/imdb.tcl

I kinda changed the basic/default "set announce" theme, so don't be surprised if it doesn't look like how you previously had it. Change it back if you don't like it.

EDIT:

The rating was really not working. I thought it was but it would only show the votes. so, they changed the website a little bit.. here's the fix:

find this:

Code: Select all

    if [regexp {<span class="rating-rating"><span class="value">(.*?)</span>} $html rating] {
and replace it with this:

Code: Select all

    if [regexp {<strong><span itemprop="ratingValue">(.*?)</span></strong>} $html rating] {
and you should be done.

The link above is updated too. Enjoy :)
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
d
deathtoll
Voice
Posts: 2
Joined: Fri Sep 23, 2011 9:46 pm

Post by deathtoll »

yay, its fetching the ratings correctly now, but the rating bar is broke :( debug info is below

Code: Select all

rating bar == %color14[%color7%color7%color14]%color
UPDATE: i commented out the new code for generating the rating bar that speechles had contributed

Code: Select all

# is there a rating? 
if {[info exists $rating] && [string length $rating]} { 
     # attain gold stars as integer that starts rating. 
     set goldstars [lindex [split $rating "."] 0] 
     # if decimal remnant of rating is equal to or greater than 0.5 add 1 to goldstars 
     if {[join [lrange [split $rating "."] 1 end]] >= 0.5} { incr goldstars } 
     # grey stars is out of 10, so subtract gold stars to find amount of grey stars 
     # notice the expr below contains braces to make the expression "safe" and "faster" 
     set greystars [expr {10 - $goldstars}] 
# if there is no rating, gold and grey stars are 0 
} else { set goldstars 0 ; set greystars 0 }
and uncommented the code below

Code: Select all

set goldstars [expr round($rating)] 
set greystars [expr 10 - $goldstars]
and the rating bar displays properly now.. but as you had said speechles, expr is to be used as a last resort.. dunno if you want to dive further into it but at least this fixes it momentarily.
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

deathtoll wrote:yay, its fetching the ratings correctly now, but the rating bar is broke :(
yeah, I wasn't using the rating bar personally, but since it breaks for you guys, I removed that entry from the script as well, the link is updated and still the same.

http://bsdunix.info/eggdrop/scripts/imdb.tcl

EDIT: Added some colors to the rating.
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Hey anybody cares to fix the flood-control? It seems like it's malfunctioning...

For example if I set it to 2 requests every 30 seconds and flood it, the script stops working for everyone and just displays the channel message saying that it got flooded blah blah blah...
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

Try this:

Changing the settings part.
Find

Code: Select all

#flood-control
set queue_enabled 1
#max requests
set queue_size 6
#per ? seconds
set queue_time 120
Replace with

Code: Select all

# Delay between command for each channel.
set delay 10
In imdb_proc proc replace global variables for old antiflood with new one.

Find

Code: Select all

queue_size queue_time queue_enabled
Replace with

Code: Select all

delay
After that we delete old antiflood code and add new code. You can modify text in notices for your own.
Find

Code: Select all

    if { $queue_enabled == 1 } {
       #flooded?
       if { $instance >= $queue_size } {
          if {$IMDB_DEBUG == 1} { putlog "IMDB_DEBUG flood detected" }
          if { $warn_msg == 0 } {
             set warn_msg 1
             putquick "$toput :Flood-Control: Request for \"$arg\" from user \"$nick\" will not be answered. Maximum of $queue_size requests every $queue_time seconds."
#             putquick "$toput :Flood-Control: Maximum of $queue_size requests every $queue_time seconds."
             utimer 120 wmsg
          }
          return
       }
       incr instance
       if { $IMDB_DEBUG == 1 } { putlog "IMDB_DEBUG new instance == $instance" }
    }
Replace with

Code: Select all

    if {[info exists imdb(lasttime,$chan)] && [expr $imdb(lasttime,$chan) + $delay] > [clock seconds]} {
        putserv "NOTICE $nick :You can use only 1 command in $delay seconds."
        putserv "NOTICE $nick :Wait [expr $delay - [expr [clock seconds] - $imdb(lasttime,$chan)]] seconds and try again."
        return 0
    }
And now we need to save time when command was used last time.
Find

Code: Select all

    foreach line [split [imdb_decode $output] "\n"] {
        while {$line != ""} {
            puthelp "$toput :[string range $line 0 399]"
            set line [string range $line 400 end]
        } 
    }
Add after

Code: Select all

    set imdb(lasttime,$chan) [clock seconds]
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
User avatar
spithash
Master
Posts: 248
Joined: Thu Jul 12, 2007 9:21 am
Location: Libera
Contact:

Post by spithash »

Thanks man for the help, I don't think it's working though :(
Libera ##rtlsdr & ##re - Nick: spithash
Click here for troll.tcl
Post Reply