egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Autovoice help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Tue Aug 26, 2008 10:33 pm    Post subject: Autovoice help Reply with quote

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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Aug 27, 2008 8:40 am    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Aug 27, 2008 8:45 am    Post subject: Reply with quote

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
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Thu Aug 28, 2008 1:11 am    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Aug 28, 2008 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber