Mise en forme de code: pensez à utiliser les balises [ tcl ] et [ /tcl ] (sans les espaces bien sûr) autour de vos codes tcl afin d'avoir un meilleur rendu et une coloration syntaxique. x


recherche d'eggdrop
#55
Bonjour djkenny, CrazyCat,
Merci beaucoup de ton aide :)

Avec le nouveau code que tu ma fourni j'ai cette erreur :)

Quote:[10:19] missing close-brace
while executing
"namespace eval ::av {
variable salons "#Fusion #test"
variable time 10
variable lignes 2


bind time - "* * * * *" av::Vvoice
proc Vv..."
(file "scripts/idle.tcl" line 1)
invoked from within
"source scripts/idle.tcl"
(file "Eggdrop.conf" line 116)

djkenny Wrote:
tcl
namespace eval ::av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
 
 
   bind time - "* * * * *" av::Vvoice
   proc Vvoice {1 2 3 4 5} {
      variable idle
      variable salons
      variable time
      foreach salon [string tolower $salons] {
         if ![validchan $salon] continue
         foreach nick [chanlist $salon] {
            if {[isbotnick $nick] || [isop $nick $salon]} continue
            if {[info exists idle($salon)] && [dict exists $idle($salon) $nick]} {
               set n [dict get $idle($salon) $nick]
               set t1 [lindex $n 1]
               set t [expr [unixtime]-$t1]
               if {$t>[expr $time*60] && [isvoice $nick $salon]} {
                  pushmode $salon -v $nick
               }
               if {$t>300} {
                  dict set idle($salon) $nick [list 0 [unixtime]]
               }
            } else {
               dict set idle($salon) $nick [list 0 [unixtime]]
            }
         }
         flushmode $salon
      }
   }
 
   bind pubm - * av::Pvoice
 
   proc Pvoice {nick host hand chan arg} {
      variable lignes
      variable salons
      variable idle
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         set n [dict get $idle($chan) $nick]
         set i [lindex $n 0]
         dict set idle($chan) $nick [list [incr i] [unixtime]]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set idle($chan) $nick [list 0 [unixtime]]
      }
   }
 
   bind join - * av::joinC
 
   proc joinC {nick host hand chan} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      dict set idle($chan) $nick [list 0 [unixtime]]
   }
 
   bind nick - * av::chgn
 
   proc chgn {nick host hand chan new} {
      variable salons
      set chan [string tolower $chan]
      if {[lsearch -nocase $salons $chan]==-1 || [isbotnick $nick]} return
      variable idle
      if {[info exists idle($chan)] && [dict exists $idle($chan) $nick]} {
         dict set idle($chan) $new [dict get $idle($chan) $nick]
         dict unset idle($chan) $nick
      } else {
         dict set idle($chan) $nick [list 0 [unixtime]]
      }
   }
 
}

J'ai essayer avec celui de CrazyCat aucun souci pour joindre les salons mais il fonctionne pas :$ et aucune ligne d'erreur :)

CrazyCat Wrote:C'est marrant comme vous faites ça, moi j'aurais cherché plus simple:


tcl
namespace eval av {
   variable salons "#salon1 #salon2 #salon3"
   variable time 15
   variable lignes 5
   variable idle
 
   bind time - "* * * * *" av::unvoice
   bind pubm - * av::voice
   bind nick - * av::chgn
 
   proc unvoice {min hour day month year} {
      foreach chan [string tolower $::av::salons] {
         if {![validchan $chan]} continue
         foreach nick [chanlist $chan] {
            if {[isbotnick $nick] || [isop $nick $chan] || ![isvoice $nick $chan]} continue
            if {[getchanidle $nick $chan] >= $time} {
               dict set ::av::idle($chan) $nick 0
               pushmode $chan -v $nick
            }
         }
         flushmode $chan
      }
   }
 
   proc voice {nick uhost handle chan args} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick] || [isop $nick $chan]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         set i [dict get $::av::idle($chan) $nick]
         dict set ::av::idle($chan) $nick [incr i]
         if {$i>=$lignes} {pushmode $chan +v $nick}
      } else {
         dict set ::av::idle($chan) $nick 1
      }
      flushmode $chan
   }
 
   proc chgn {nick host hand chan new} {
      set chan [string tolower $chan]
      if {[lsearch -nocase $::av::salons $chan]==-1 || [isbotnick $nick]} return
      if {[info exists ::av::idle($chan)] && [dict exists $::av::idle($chan) $nick]} {
         dict set ::av::idle($chan) $new [dict get $::av::idle($chan) $nick]
         dict unset ::av::idle($chan) $nick
      } else {
         dict set ::av::idle($chan) $nick 0
      }
   }
}

Cordialement Stephane
hésitez pas de visité http://www.tchat-fusion.org/
ou part irc /server -m irc.tchat-fusion.org


Messages In This Thread
recherche d'eggdrop - by Darfus - 06/06/2011, 18:15
RE: recherche d'eggdrop - by aliasangelius - 07/06/2011, 16:00
RE: recherche d'eggdrop - by djdu32 - 07/06/2011, 19:58
RE: recherche d'eggdrop - by Darfus - 09/06/2011, 19:24
RE: recherche d'eggdrop - by CrazyCat - 09/06/2011, 22:11
RE: recherche d'eggdrop - by fedora - 09/06/2011, 19:27
RE: recherche d'eggdrop - by Darfus - 10/06/2011, 00:12
RE: recherche d'eggdrop - by Darfus - 10/06/2011, 10:54
RE: recherche d'eggdrop - by CrazyCat - 10/06/2011, 14:16
RE: recherche d'eggdrop - by Darfus - 11/06/2011, 18:07
RE: recherche d'eggdrop - by aliasangelius - 10/06/2011, 14:52
RE: recherche d'eggdrop - by djkenny - 11/06/2011, 18:56
RE: recherche d'eggdrop - by aliasangelius - 11/06/2011, 23:45
RE: recherche d'eggdrop - by Darfus - 12/06/2011, 14:58
RE: recherche d'eggdrop - by lesny - 12/06/2011, 15:06
RE: recherche d'eggdrop - by Ixion - 12/06/2011, 17:29
RE: recherche d'eggdrop - by Darfus - 12/06/2011, 17:18
RE: recherche d'eggdrop - by Darfus - 12/06/2011, 19:02
RE: recherche d'eggdrop - by Ixion - 12/06/2011, 20:45
RE: recherche d'eggdrop - by lesny - 12/06/2011, 20:53
RE: recherche d'eggdrop - by Ixion - 12/06/2011, 21:47
RE: recherche d'eggdrop - by lesny - 12/06/2011, 22:33
RE: recherche d'eggdrop - by Darfus - 12/06/2011, 22:54
RE: recherche d'eggdrop - by Ixion - 13/06/2011, 00:38
RE: recherche d'eggdrop - by aliasangelius - 13/06/2011, 11:19
RE: recherche d'eggdrop - by aliasangelius - 13/06/2011, 11:26
RE: recherche d'eggdrop - by pheeric - 11/10/2011, 14:54
RE: recherche d'eggdrop - by aliasangelius - 11/10/2011, 15:14
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 15:42
RE: recherche d'eggdrop - by CrazyCat - 10/11/2011, 15:48
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 16:14
RE: recherche d'eggdrop - by CrazyCat - 10/11/2011, 16:25
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 16:46
RE: recherche d'eggdrop - by aliasangelius - 10/11/2011, 16:43
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 17:18
RE: recherche d'eggdrop - by aliasangelius - 10/11/2011, 17:41
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 18:31
RE: recherche d'eggdrop - by aliasangelius - 10/11/2011, 19:40
RE: recherche d'eggdrop - by djkenny - 10/11/2011, 21:12
RE: recherche d'eggdrop - by aliasangelius - 10/11/2011, 21:43
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 21:51
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 00:28
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 11:18
RE: recherche d'eggdrop - by DnS - 10/11/2011, 21:57
RE: recherche d'eggdrop - by snip74 - 10/11/2011, 22:27
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 00:31
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 00:44
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 01:26
RE: recherche d'eggdrop - by DnS - 11/11/2011, 07:24
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 09:08
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 10:04
RE: recherche d'eggdrop - by aliasangelius - 11/11/2011, 10:08
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 10:45
RE: recherche d'eggdrop - by CrazyCat - 11/11/2011, 11:12
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 11:31
RE: recherche d'eggdrop - by CrazyCat - 11/11/2011, 11:31
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 11:36
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 11:51
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 12:01
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 12:34
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 14:51
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 19:08
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 20:07
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 20:32
RE: recherche d'eggdrop - by djkenny - 11/11/2011, 21:00
RE: recherche d'eggdrop - by snip74 - 11/11/2011, 21:35

Possibly Related Threads…
Thread Author Replies Views Last Post
  Recherche uno pour eggdrop MRVOLKANO 2 4,436 03/12/2010, 23:45
Last Post: Mrvolks

Forum Jump:


Users browsing this thread: 1 Guest(s)