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.
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Mon Feb 21, 2005 1:27 pm
Code: Select all
puts $thewritefile "[chanlist $chan]"
Ok that writes all the current users in the channel to $mywritefile, there are 2 problems though..
1. For people using [ ] in there name, it will output { } around there name..
Example..
[Clan]Name
Turns to..
{[Clan]Name}
2. How would I go about putting a comma after each name.
Now for counting Ops i'm guessing it's going to use the 3 bits of code below, but I don't know how I would do it.
Code: Select all
if {[isop $nick $chan]}
[llength [chanlist #clantemplates]]
foreach nick [chanlist $chan]
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Mon Feb 21, 2005 1:37 pm
This should take care of both problems
Code: Select all
puts $thewritefile "[join [chanlist $chan] {, }]"
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Mon Feb 21, 2005 3:01 pm
Mmmm.... indeed that does, but whats the join there for?
Does that mean I don't need the bind join / proc?
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Mon Feb 21, 2005 3:17 pm
No,
join only put together several list elements into a single string.
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Mon Feb 21, 2005 4:22 pm
What would I use for for the same script but binded with sign and part?
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Feb 21, 2005 5:11 pm
in your proc, replace:
Code: Select all
puts $thewritefile "[chanlist $chan]"
with
Code: Select all
puts $thewritefile "[join [chanlist $chan] {, }]"
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Mon Feb 21, 2005 5:13 pm
Yeah I already done that, I was asking can I just use that for sign/part procs/binds aswell..
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Mon Feb 21, 2005 5:18 pm
Longbow wrote: Yeah I already done that, I was asking can I just use that for sign/part procs/binds aswell..
Try it, do you see any reason not to ?
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Mon Feb 21, 2005 8:47 pm
For counting the ops you can simply use:
Code: Select all
set count 0
foreach user [chanlist $chan] {
if {[isop $user $chan]} {
incr count
}
}
putserv "PRIVMSG $chan :Total number of ops: $count"
You can do the same for voices and etc.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Mon Feb 21, 2005 10:57 pm
Thanks.
Ok, this is my whole script..
Code: Select all
########## Total/Op/Voice/Users ##########
bind join - * join:all
proc join:all {nick uhost hand chan} {
set mychan "#longbow"
set wtotal [open total.php w]
set wop [open op.php w]
set wvoice [open voice.php w]
set wusers [open users.php w]
puts $wtotal "[llength [chanlist $mychan]]"
set opcount 0
foreach user [chanlist $mychan] {
if {[isop $user $mychan]} {
incr opcount
}
}
puts $wop "$opcount"
set voicecount 0
foreach user [chanlist $mychan] {
if {[isvoice $user $mychan]} {
incr voicecount
}
}
puts $wvoice "$voicecount"
puts $wusers "[join [chanlist $mychan] {, }]"
close $mychan
close $wtotal
close $wop
close $wvoice
close $wusers
}
########## Most Users ##########
bind join - * join:most
proc join:most {nick uhost hand chan} {
set mychan "#longbow"
set rmost [open most.php r]
set wmost [open most.php w]
set wmostdate [open mostdate.php w]
gets $rmost line
if {[llength [chanlist $mychan]] > $line} {
set systemTime [clock seconds]
puts $wmost "[llength [chanlist $mychan]]"
puts $wmostdate "[clock format $systemTime -format {%b %d %Y}]"
}
close $mychan
close $rmost
close $wmost
close $wmostdate
close $line
}
But I get the following error:
Tcl error [join:all]: can not find channel named "#longbow"
Tcl error [join:most]: can not find channel named "#longbow"
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Tue Feb 22, 2005 12:15 pm
Ah woops, I found what was wrong.
Still getting loads of problems though...
Code: Select all
########## Join - Total/Op/Voice/Users ##########
bind join - * join:all
proc join:all {nick uhost hand chan} {
set mychan #longbow
set wtotal [open total.php w]
set wop [open op.php w]
set wvoice [open voice.php w]
set wusers [open users.php w]
puts $wtotal "[llength [chanlist $mychan]]"
set opcount 0
foreach user [chanlist $mychan] {
if {[isop $user $mychan]} {
incr opcount
}
}
puts $wop "$opcount"
set voicecount 0
foreach user [chanlist $mychan] {
if {[isvoice $user $mychan]} {
incr voicecount
}
}
puts $wvoice "$voicecount"
puts $wusers "[join [chanlist $mychan] {, }]"
close $wtotal
close $wop
close $wvoice
close $wusers
}
########## Part - Total/Op/Voice/Users ##########
bind sign - * part:all
proc part:all {nick uhost hand chan msg} {
set mychan #longbow
set wtotal [open total.php w]
set wop [open op.php w]
set wvoice [open voice.php w]
set wusers [open users.php w]
puts $wtotal "[llength [chanlist $mychan]]"
set opcount 0
foreach user [chanlist $mychan] {
if {[isop $user $mychan]} {
incr opcount
}
}
puts $wop "$opcount"
set voicecount 0
foreach user [chanlist $mychan] {
if {[isvoice $user $mychan]} {
incr voicecount
}
}
puts $wvoice "$voicecount"
puts $wusers "[join [chanlist $mychan] {, }]"
close $wtotal
close $wop
close $wvoice
close $wusers
}
########## Sign - Total/Op/Voice/Users ##########
bind sign - * sign:all
proc sign:all {nick uhost hand chan reason} {
set mychan #longbow
set wtotal [open total.php w]
set wop [open op.php w]
set wvoice [open voice.php w]
set wusers [open users.php w]
puts $wtotal "[llength [chanlist $mychan]]"
set opcount 0
foreach user [chanlist $mychan] {
if {[isop $user $mychan]} {
incr opcount
}
}
puts $wop "$opcount"
set voicecount 0
foreach user [chanlist $mychan] {
if {[isvoice $user $mychan]} {
incr voicecount
}
}
puts $wvoice "$voicecount"
puts $wusers "[join [chanlist $mychan] {, }]"
close $wtotal
close $wop
close $wvoice
close $wusers
}
########## Most Users ##########
bind join - * join:most
proc join:most {nick uhost hand chan} {
set mychan #longbow
set rmost [open most.php r]
set wmost [open most.php w]
set wmostdate [open mostdate.php w]
gets $rmost line
if {[llength [chanlist $mychan]] > $line} {
set systemTime [clock seconds]
puts $wmost "[llength [chanlist $mychan]]"
puts $wmostdate "[clock format $systemTime -format {%b %d %Y}]"
}
close $rmost
close $wmost
close $wmostdate
}
Most Users doesn't work, it seems to work the same as current users. So when the channel users goes down, so does most users.
Also the part/sign bit isn't working.
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Tue Feb 22, 2005 8:49 pm
Try opening one file at a time, save your value in it, close it and then go for the next one.
Plus I don't understand why don't you save them in an array rather than writing all different files? Or just write all vaues into one file. Surely it will cut down your long code and will make the bot more efficient and probobaly more faster in replying.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Longbow
Voice
Posts: 29 Joined: Thu Jan 13, 2005 9:24 am
Post
by Longbow » Wed Feb 23, 2005 7:35 pm
Ah, I got it all sorted, thanks.