| View previous topic :: View next topic |
| Author |
Message |
sdays Halfop
Joined: 21 Oct 2006 Posts: 98
|
Posted: Tue Aug 26, 2008 10:33 pm Post subject: Autovoice help |
|
|
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: | 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: |
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"
}
}
}
}
|
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Aug 27, 2008 8:40 am Post subject: |
|
|
| Code: | 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
} |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Aug 27, 2008 8:45 am Post subject: |
|
|
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: | 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]]
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Thu Aug 28, 2008 9:20 am; edited 1 time in total |
|
| Back to top |
|
 |
sdays Halfop
Joined: 21 Oct 2006 Posts: 98
|
Posted: Thu Aug 28, 2008 1:11 am Post subject: |
|
|
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: |
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]]
}
} |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 28, 2008 9:20 am Post subject: |
|
|
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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|