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.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jan 15, 2003 6:08 am
# binds
bind pub n .files files:list
# stuff
set ls(dir) "files"
set ls(pattern) "*.txt"
# files list
proc files:list {nick host hand chan arg} {
global ls
catch { glob $ls(dir)/$ls(pattern) } files
if {[lrange "$files" 0 4] == "no files matched glob pattern"} {
putserv "PRIVMSG $chan :Can't find any files ($ls(pattern)) in \"$ls(dir)\" dir."
return }
foreach script $files {
putserv "PRIVMSG $chan :[string range $script [expr [string length $ls(dir)]+1] end]"
}
}
How to make it look in all the dirs from the $ls(dir)? The dir files/ has a tmp/ dir in it and in the tmp/ dir is an txt file and shoud be found.
Once the game is over, the king and the pawn go back in the same box.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jan 15, 2003 6:30 am
Or an alternative to that is to read all the dirs name then to lookin each dir for the files. Any sugestions?
Once the game is over, the king and the pawn go back in the same box.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jan 15, 2003 9:13 am
# binds
bind pub n .dirs dirs:list
# dirs list
proc dirs:list {nick host hand chan arg} {
global ls
catch { glob ls/* } dirs
putserv "PRIVMSG $chan :$dirs"
}
And seems to be working. the only thing I must figure out now is how to separate the files from the dirs.
Any tips, advices or something that can help me out a bit are welcomed, very apreciated and mostly needed.
Once the game is over, the king and the pawn go back in the same box.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jan 15, 2003 9:42 am
With: "catch { glob -directory files/ * } dirs" I still get the files among the dirs. Tryed some alternatives but same thing.. Now I'm a bit stuck and confused.
Once the game is over, the king and the pawn go back in the same box.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Wed Jan 15, 2003 10:04 am
Pfff.. seems that I've figured out after reading more carefuly the page you've gave me. Thanks!
bind pub n .dirs dirs:list
# dirs list
proc dirs:list {nick host hand chan arg} {
global ls
catch { glob -type d files/* } dirs
foreach dr $dirs {
putserv "PRIVMSG $chan :[string range $dr [expr [string length files]+1] end]"
}
}
Once the game is over, the king and the pawn go back in the same box.