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.

List Script

Old posts that have not been replied to for several years.
Locked
F
FiskerEnDK
Voice
Posts: 17
Joined: Thu Jan 16, 2003 7:18 am

List Script

Post by FiskerEnDK »

I made this script for listing in a chan..
When i type !list or @list it will show line for line from the text file "list.db"
But its only showed the first line of fine anyone can help me with this?

Best Regards
FiskerEn

<code>

set channel "channel"
set db eggdrop/scripts/list.db

bind pub - @list pub:list
bind pub - !list pub:list

proc pub:list {nick uhost hand chan text} {
global channel db

set fo [open "$db" r]
while { ![eof $fo]} {

set buffer [read $fo]
putserv "NOTICE $nick : $buffer "
}
}

putlog "Script loaded: list"

</code>
m
mortician
Voice
Posts: 37
Joined: Sun Sep 22, 2002 6:35 pm
Location: Tsjakamaka
Contact:

Post by mortician »

I think you don't want to use read to read the lines of your file, but gets

Without an exact number of characters to read that command will read everything until it encounters EOF, gets reads a single line from the specified channel.

Code: Select all

 set fo [open "$db" r]
while { ![eof $fo] } {
  set buffer [gets $fo]
  putserv "NOTICE $nick : $buffer "
} 
close $fo
It is a mistake to think you can solve any major problems just with potatoes.
Locked