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.

check from pool

Help for those learning Tcl or writing their own scripts.
Post Reply
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

check from pool

Post by raider2k »

hi everyone ;)

what Im after this time is some kind of pool containing the last 50 news titles I gathered from webpages, ordered by time, including their source website (and so on but those things are only details). so if a new title has been read from a website that it is matched against the last 50 entries of that pool to avoid duplicates on announcement bots in channels.

Im not so sure about how to build such things except for arrays (which are mysteries to me :/) and how to initiate such a list at bot startup etc.

Help and guidance appreciated :)
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

You won't get very far with your Tcl projects without mastering arrays, so I suggest you make an effort to understand them.

The only way you can initialise a list or array on startup is to use a text file to save the data. The data, should any exist, is read on startup and saved after any changes.
I must have had nothing to do
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

would you be so kind to help me out with a small explanation/introduction please? :D
w
willyw
Revered One
Posts: 1204
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

raider2k wrote:would you be so kind to help me out with a small explanation/introduction please? :D
Until arfer replies, here are a few things you might like to read. They'll help to get you started.

Go here:
http://suninet.the-demon.de/
That whole site is very helpful.
But if you wish, you can scroll down to the section titled Variables, and find a sub-section there, - Using Arrays. .. and more.
You'll see, when you get there.

Go here:
http://www.tcl.tk/man/tcl8.5/TclCmd/array.htm
for the tcl array specific commands.
I wouldn't start here. Just have it bookmarked, because you will need it eventually.
You can do a lot with the info stored in arrays, with these commands.

For the part about reading from a file, the basics are here:
http://forum.egghelp.org/viewtopic.php?t=6885
Bear in mind, that the examples there are for reading from a file, into a list. But it is still good reading, and gives you the idea of how it is done.
(If you need to look up some of the commands used, to understand them - go back to: http://www.tcl.tk/man/tcl8.5/TclCmd/contents.htm
as that is the main page there )

I hope this little bit of background info, after you read it, gets you primed, so that you can take right off, with whatever comments arfer returns with.
:)
Post Reply