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.

User in Channel

Old posts that have not been replied to for several years.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

User in Channel

Post by knilch »

Hi folks!

I need a tcl script for my eggdrop, but i do not how to do.
My eggdrop should create a file (php, html or cgi) where the names of users in a specific channel is listed. for each username one line and the name should be in brackets.

for example:

(user1)
(user2)
...


I hope that someone could help me, because i'm not able to do it on my own.

Thanks a lot.

knilch
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

username is the name under he/she is known by the bot?
Once the game is over, the king and the pawn go back in the same box.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

no - ALL user should be displayed - all people who are on the channel
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

use something like:

Code: Select all

foreach line [channel #channel] {
set user [lindex $line 0]
# add $user one by one in your page or whatever
}
nickname, handle, join, idle and uhost is the content of the entire line.
Once the game is over, the king and the pawn go back in the same box.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

hum, i don't understand this.
sorry, i not fit in tcl
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Post by dollar »

caesar wrote:use something like:

Code: Select all

foreach line [channel #channel] {
set user [lindex $line 0]
# add $user one by one in your page or whatever
}
nickname, handle, join, idle and uhost is the content of the entire line.
What about [chanlist #channel]?
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups! :oops: It should be chanlist not channel. I was thinking at the dcc .channel command and in TCL is chanlist and kinda mixed them a bit :)

Here is an basic "export" thing:

Code: Select all

bind dcc o export my:export

proc my:export {hand idx text} {
  set chan [lindex $text 0]
  if {![string match "#*" $chan] || $text == ""} {
    putdcc $idx "Usage: .export #channel"
    return
  }
  set file [open "result.txt" w]
  puts $file "Users in $chan channel:"
  foreach line [chanlist $chan] {
    puts $file [lindex $line 0]
  }
  close $file
  putdcc $idx "Export completed."
}
Once the game is over, the king and the pawn go back in the same box.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

but this version only works if i request it at the partyline, right?
i need this script updating himself
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind time - ?0* my:status
bind time - ?5* my:status

proc my:status {minute hour day month year} {
  set chan "#channel"
  set file [open "result.txt" w] 
  puts $file "Users in $chan channel:" 
  foreach line [chanlist $chan] { 
    puts $file [lindex $line 0] 
  } 
  close $file 
}
This should do a status every 5 minutes.
Once the game is over, the king and the pawn go back in the same box.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

yea, that looks fine, thanks. but the nicknames should be written in brackets like (nickname). is that possible, too?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

knilch wrote:but the nicknames should be written in brackets like (nickname). is that possible, too?
Brackets look like this: [], and yes, it's possible. Try to figure out where to put them yourself (clue: 'puts $file' is the part where content is written to the file)
Have you ever read "The Manual"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

replace:

Code: Select all

puts $file [lindex $line 0]
with:

Code: Select all

puts $file "([lindex $line 0])"
Once the game is over, the king and the pawn go back in the same box.
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

thanks, i'll try it. very kind of you!
k
knilch
Voice
Posts: 11
Joined: Wed Feb 18, 2004 7:52 pm

Post by knilch »

hmm i loaded the script but my result.txt is empty.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Have you changed from #channel to the actual name of your channel? I am talking about the set chan "#channel" line.
Once the game is over, the king and the pawn go back in the same box.
Locked