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.

stopping at one line

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:

stopping at one line

Post by NewzUK »

hi - I'm trying to get this script to only set the variable and a check variable (to make sure it dosn't post the same thing twice) to only read the first line /04 appears in - but it sets the first line /04 is in, then the check says the headline is the same so it reads down to the next one and then back to the first one and so on. Can I get it to just read the first line of /04 and stop - and check if the headline has already been annouced and not announce any lines further down the file...(there are about 15 or so lines in the news page file that have /04 in them)

Code: Select all

proc pub:readmkw { nick uhost handle channel arg } {
global mkw
global mkwlast
set url http://www.url.com
set file news/news.txt
exec lynx -preparsed -nolist -dump -width=5000 $url > $file
set mkwf [open $file r] 
set data [read $mkwf]
foreach line [split $data \n] {
if {[string match */04* $line]} {
set mkw [gettok $line 5- 32]
if {$mkwlast != $mkw} {
set mkwlast $mkw
if {[string match *\]* $mkw]} {
putserv "PRIVMSG #Newsroom :7,7 1,15 [gettime +0]ET $mkw "
break
} else {
putserv "PRIVMSG #Newsroom :4,4 4,15 [gettime +0]ET $mkw "
break
}
}
}
}
}
Last edited by NewzUK on Thu Mar 04, 2004 5:05 pm, edited 1 time in total.
#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 »

You should use the [ code ] and [ /code ] tags.

You should also close your file handle after reading it in.

It's too annoying to go through the code in any more detail without formatting, so I'll take another look when you've reposted with [ code ].
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

is that ok?
#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 »

no :/
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

fine - if anyone else if able to help me with my original problem that would be great. thanks.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

anyone...? I've tried various options but no luck yet...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Format your code properly, and maybe people will show interest...
making the helper do the work to format it just so they can read what you are asking isn't really motivating...
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

I formatted it in the code brackets - do you mean close the file? because it works normally without closing it...
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

format:

Code: Select all

proc name {args} {

    do_something
    if {setting == value} {
        do_something_else
    } else {
        sigh
    }
}
close:
well, you have to close a file when you open it. maybe it works at the beginning but you will be getting errors soon.
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

thanks - will look elsewhere for help from now on.
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

you [censored] moron
photon?
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

lolol hey don't talk about arcane and strikelight like that!

rofl
#Newsroom - Where News & Markets Connect
http://www.inewsroom.net
#Newsroom on irc.othernet.org
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

no comment...
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
Locked