tomekk wrote:file:
Code: Select all
User1 Message1
User2 Message2a
User3 Message1
User2 Message2b
User3 Message3
tcl:
Code: Select all
set myfile [open "file.txt" r]
set whole_data [read $myfile]
close $myfile
set lines [split $whole_data "\n"]
# we are looking for User2
set user_name "User2"
foreach line $lines {
if {$line != ""} {
set split_words [split $line]
set u_nick [lindex $split_words 0]
set u_msg [lrange $split_words 1 end]
if {[string match *$user_name* $line]} {
puts $u_msg
}
}
}
output:
Code: Select all
[tomekk@zonk]:/home# ./test.tcl
Message2a
Message2b
Format it as yourself.
And better make a bind something like this !user <username> will be easier for you than !user2 !user3 etc.
cheers
perfect!!! P-E-R-F-E-C-T!!! Thanks a lot
Everything's fine by now, but I have one last problem which I didn't remember that could occur. The userlist is getting bigger and bigger, and when I type !userlist, the list is so big that it exceeds the maximum /notice command characters allowed.
Eg.: !userlist
[Fri-05:43:16pm] -@RoBotX- #cyber-world users list:
[Fri-05:43:17pm] -@RoBotX- <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> <user> AND FINISHED (the rest of them aren't showed because the notice is too big)
So my idea was to split the list in notices of 50 users maximum, I mean, the first notice with the first 50 users, 2nd notice with the other 50, etc, etc, till the listing ends. This seems very compilcated to me, I don't see what can I do to solve this :S