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.

Request Help plz

Old posts that have not been replied to for several years.
u
up^to^you

Post by up^to^you »

set files(1) "/blah/blah/new"
set files(2) "/blah/blah/file1"
set files(3) "/blah/blah/file2"

proc add_url {nick host hand text} {
global files
set a [open $files(1) r+]
set b [read $a]
set c [open $files(2) r+]
set d [read $c]
set e [open $files(3) r+]
set f [read $e]

if {[string match -nocase "*$text*" $b]||[string match -nocase "*$text*" $d]||[string match -nocase "*$text*" $f]} {
return 0
}
seek $a 0 end
seek $c 0 end
seek $e 0 end
puts $a {text}
catch {close $a}
catch {close $c}
catch {close $e}
}

do you mean like this?
but it still didnt work, my bot even cannot detect if the url is on those files?
think i have already give up and so depert :( , sorry to disturb you guys, but thx for helped me :)
d
darko``
Op
Posts: 121
Joined: Sun Sep 08, 2002 5:33 pm
Location: Malta

Post by darko`` »

1) You need to close those files in the:

f {[string match -nocase "*$text*" $b]||[string match -nocase "*$text*" $d]||[string match -nocase "*$text*" $f]} {
close $a
Close $c
close $e
return
}

2) Did you try: putlog "$b $d $f"
So to check the actuall stuff you read?
Ignorant and lazy people will save 30 minutes by chosing simple config file. Smart ones will save 3000 minutes of *everyone's* time by opting for complete config file.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

hey u didn't follow my code....
yours:

Code: Select all

} 
seek $a 0 end 
seek $c 0 end 
seek $e 0 end 
puts $a {text} 
catch {close $a} 
catch {close $c} 
catch {close $e} 
} 
mine:

Code: Select all

} 
seek $a 0 end 
seek $c 0 end 
seek $e 0 end 
puts $a $text 
catch {close $a} 
catch {close $c} 
catch {close $e}
}
do you see the difference here? Tou are putting only the string "text" in the file... not the variable $text..... so u can type your url as many times as you want, bu tit will still just put "text" in the file
Elen sila lúmenn' omentielvo
u
up^to^you

Post by up^to^you »

i tried that, put $a $text, but the result is still the same, my bot cannot detect either :cry: :cry:

maybe this code cannot detect more than one file, and only work and detect 1 file, though theorical and logically this code should work, but in practice, things dont always match with theory

:-?

i dont know, maybe there's some code I missed, so guys...do you mind to correct this code below or maybe test it, maybe there's something missing on it :roll:

set files(1) "/eggdrop/scripts/newfile"
set files(2) "/eggdrop/scripts/c"
set files(3) "/eggdrop/scripts/b"
set files(4) "/eggdrop/myscripts/a"

proc newz {nick host hand text} {
global files
set a [open $files(1) r+]
set b [read $a]
set c [open $files(2) r+]
set d [read $c]
set e [open $files(3) r+]
set f [read $e]
set g [open $files(4) r+]
set h [read $g]

if {[string match -nocase "*$text*" $b] || [string match -nocase "*$text*" $d] || [string match -nocase "*$text*" $f] || [string match -nocase "*$text*" $h]} {
return 0
}
seek $a 0 end
seek $c 0 end
seek $e 0 end
seek $g 0 end
puts $a $text
catch {close $a}
catch {close $c}
catch {close $e}
catch {close $g}
}

putlog "test.tcl loaded"
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

I tested exactly that script on my bot.. all I changed was ofc the files and I added this:

Code: Select all

if {![file exists files(1)]} { set f [open $files(1) a+]; close $f } 
if {![file exists files(2)]} { set f [open $files(2) a+]; close $f } 
if {![file exists files(3)]} { set f [open $files(3) a+]; close $f } 
if {![file exists files(4)]} { set f [open $files(4) a+]; close $f } 
it worked like a charm...
Elen sila lúmenn' omentielvo
u
up^to^you

Post by up^to^you »

cool... 8) :D thx :wink:
but...i think my bot became quite slow to respon after i add something, dont you think so?
u
up^to^you

error

Post by up^to^you »

i dont understand....if i add more than 4 lines url, seems this error bugging me sometimes, and makes me have to restart my bot:

[23:58] Tcl error [newz]: couldn't open "/blah/blah/file(4)": too many open files

is this bugs :-?
u
up^to^you

this is awfull

Post by up^to^you »

no...not only if i add url in 4 lines by using copy paste, this error also appear even if i add url one by one. It said to many open files:

[00:19] Tcl error [newz]: couldn't open "/blah/blah/file(2)": too many open files
[00:19] Tcl error in script for 'timer7077':
[00:19] couldn't open "/blah/blah/file(3)": too many open files


but

if {![file exists files(1)]} { set f [open $files(1) a+]; close $f }
if {![file exists files(2)]} { set f [open $files(2) a+]; close $f }
if {![file exists files(3)]} { set f [open $files(3) a+]; close $f }
if {![file exists files(4)]} { set f [open $files(4) a+]; close $f }
and

seek $a 0 end
seek $c 0 end
seek $e 0 end
seek $g 0 end
catch {close $a}
catch {close $c}
catch {close $e}
catch {close $g}

should close files that have been opened before Right? :-? :-?
how to prevent this error apear again? arrrrgggg...pls....i need help :cry:
Locked