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.
Help for those learning Tcl or writing their own scripts.
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Tue Aug 26, 2008 10:33 pm
Hi.
I'm trying to make this script do +vvvv then just one voice per line i want it to do 4 heres what it does:
Code: Select all
03[09:24:56] * Fearless sets mode: +v Ps2
03[09:24:59] * Fearless sets mode: +v CIA-0
03[09:25:01] * Fearless sets mode: +v grass
03[09:25:02] * Fearless sets mode: +v gta4^0
03[09:25:05] * Fearless sets mode: +v bush`
03[09:25:07] * Fearless sets mode: +v Billgates
And i want it to do: fearless sets mode: +vvvv nick1 nick2 nick3 nick4
and they all joined at once..
Code: Select all
setudef flag allvoice
bind join - * *join:allvoice
proc *join:allvoice {nick uhost hand chan} {
if {[isbotnick $nick] || ![botisop $chan]} {
return 0
}
foreach setting [channel info $chan] {
if {[regexp -- {^[\+-]} $setting]} {
if {![string compare "+allvoice" $setting]} {
putserv "mode $chan +v $nicks"
}
}
}
}
speechles
Revered One
Posts: 1398 Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)
Post
by speechles » Wed Aug 27, 2008 8:40 am
Code: Select all
setudef flag allvoice
bind join - * join:allvoice
proc join:allvoice {nick uhost hand chan} {
if {[isbotnick $nick] || ![botisop $chan]} || ![channel get $chan allvoice]} {
return 0
}
pushmode $chan +v $nick
}
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Wed Aug 27, 2008 8:45 am
Unfortunately, flushmode is called implicitly as the event-trigger ends, so you would still end up with one voice at a time. This would require a separate queue of modes (voicing) to be done, with a timer/utimer or time bind event to do the actual voicing.
Edit:
Had some time to implement a delayed version that should work with pushmode/flushmode. This script depends on the alltools.tcl script included with eggdrop. The voicing will be delayed 10 seconds from the first join; and subsequent joins the following 10 seconds will be grouped for voicing.
Code: Select all
proc pushdelaymode {args} {
global delaymodequeue
if {[llength $args] > 3 || [llength $args] < 2} {
error {wrong # of args: should be "pushdelaymode channel mode ?arg?"}
}
lappend delaymodequeue [lrange $args 0 2]
}
proc flushdelaymode {channel} {
global delaymodequeue
if {![info exists delaymodequeue]} {
return 0
}
for {set i 0} {$i < [llength $delaymodequeue]} {} {
set item [lindex $delaymodequeue $i]
if {[string match -nocase $channel [lindex $item 0]]} {
eval [linsert $item 0 "pushmode"]
set delaymodequeue [lreplace $delaymodequeue $i $i]
} {
incr i
}
}
}
setudef flag allvoice
bind join - * join:allvoice
proc join:allvoice {nick uhost hand chan} {
if {[isbotnick $nick] || ![botisop $chan]} || ![channel get $chan allvoice]} {
return 0
}
pushdelaymode $chan +v $nick
if {[utimerexists [list flushdelaymode [string tolower $chan]]] == ""} {
utimer 10 [list flushdelaymode [string tolower $chan]]
}
}
Last edited by
nml375 on Thu Aug 28, 2008 9:20 am, edited 1 time in total.
NML_375
sdays
Halfop
Posts: 98 Joined: Sat Oct 21, 2006 4:46 am
Post
by sdays » Thu Aug 28, 2008 1:11 am
Ok i fixed the if it had a } at the end of: ![botisop $chan] now i get the error: [22:02] Tcl error [join:allvoice]: can't use empty string as operand of "!" and it won't voice for nothing
Code: Select all
bind join - * join:allvoice
proc join:allvoice {nick uhost hand chan} {
if {[isbotnick $nick] || ![botisop $chan] || ![channel get $chan allvoice]} {
return 0
}
pushdelaymode $chan +v $nick
if {![utimerexists [list flushdelaymode [string tolower $chan]]]} {
utimer 10 [list flushdelaymode [string tolower $chan]]
}
}
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Thu Aug 28, 2008 9:20 am
Ahh, should've read the docs on alltools.tcl a bit more throughout..
utimerexists returns a timer-id or empty string, not boolean apparently; updating my previous post to take care of that matter..
NML_375