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.
Old posts that have not been replied to for several years.
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Thu Mar 04, 2004 8:53 am
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.
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Thu Mar 04, 2004 10:21 am
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 ].
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Fri Mar 05, 2004 12:30 am
is that ok?
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Fri Mar 05, 2004 3:16 am
no :/
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Fri Mar 05, 2004 6:24 am
fine - if anyone else if able to help me with my original problem that would be great. thanks.
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Wed Mar 10, 2004 12:43 am
anyone...? I've tried various options but no luck yet...
strikelight
Owner
Posts: 708 Joined: Mon Oct 07, 2002 10:39 am
Contact:
Post
by strikelight » Wed Mar 10, 2004 12:51 am
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...
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Wed Mar 10, 2004 1:07 am
I formatted it in the code brackets - do you mean close the file? because it works normally without closing it...
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Wed Mar 10, 2004 3:30 pm
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.
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Wed Mar 10, 2004 6:18 pm
thanks - will look elsewhere for help from now on.
spock
Master
Posts: 319 Joined: Thu Dec 12, 2002 8:40 pm
Post
by spock » Wed Mar 10, 2004 8:38 pm
you [censored] moron
photon?
NewzUK
Master
Posts: 200 Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:
Post
by NewzUK » Thu Mar 11, 2004 12:14 am
lolol hey don't talk about arcane and strikelight like that!
rofl
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Thu Mar 11, 2004 1:28 pm
no comment...