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.

creating a check...

Old posts that have not been replied to for several years.
Locked
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

creating a check...

Post by NewzUK »

hi

I'm trying to make a check for this script so the headline posted won't repeat if it's the same the next time it retrieves. I've tried a few things but no luck yet...

proc pub:readaap { nick uhost handle channel arg } {
set url http://www.url.com
set file news/news.txt
exec lynx -preparsed -dump -width=5000 $url > $file
set aapf [open $file r]
set data [read $aapf]
foreach line [split $data \n] {
if {[string match *17\]* $line]} {
set aap [string range $line 7 end]
foreach lines [split $data \n] {
if {[string match *17.* $lines]} {
set aapurl [string range $lines 5 end]
putserv "PRIVMSG #Newsroom :7,7 1,15 [gettime +0]ET $aap - AAP "
putserv "NOTICE #Newsroom2 :$aapurl"
break
}
}
}
}
}

:-?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Have you tried using a global variable to save the headline? Then next time, check the headline against the saved headline and if it's the same, don't print it out.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks will try that - to set that do you replace 'set' with 'global'?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Post by dollar »

NewzBoy wrote:thanks will try that - to set that do you replace 'set' with 'global'?
No. ( :P )
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

what does that mean dollar?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Post by dollar »

NewzBoy wrote:what does that mean dollar?
You don't replace "set" with "global", you set your variables and at the top of each proc you want to use them with add "global <varname without $>". Example:
proc abc {args} {global varname; set varname 123}

proc cba {args} {global varname; do stuff with $varname}
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

hmmm thanks - but in this case the vars I need to check so the headline dosn't repeat are set near the end of the proc operation so not sure how that works...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

It has to download and parse the file before it can check to see if the headline is repeated. Just do the check right before the putserv.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

ok - I've set the global vars at the top and put my check in just before the putserv:

if {$rtrlast != $rtr} {
set rtrlast $rtr

but it's not sending anything to the channel even if the headline is new... :-?
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
Locked