Bonsoir djkenny,
merci encore de ton aide
Effectivement je suis entrain de testé sur un plus gros salon et y a pas se souci
j'ai mis plus de minute et sur plusieurs phrase et donc c'est niquel
Citation :variable time 15
variable lignes 20
djkenny a écrit :
Citation :Donc plus aucun souci mis a par si tu veut améliorer pour toi ou un autre ou même pour moi sans abusé de ta sympathie quand la personne se fait devoicé et se re mais a parler de suite après le devoice sa le re voice directe.
Regarde bien les secondes dans mon exemple pour comprendre
en fait c est normal, le temps de mise a zéro du nombre de lignes est de 5 minutes donc forcement si tu mets une minutes pour le dévoice ça ne peut pas fonctionner correctement
mais.. pourquoi ouvrir le tcl pour rajouter un salon ?
sa serait pas mieu d'utilisé le setudef flag ?
Avec deux bind pub pour ajouté/retiré un salon non ?
parce-que je l'ai codé sur tcl-bot et que je n'ai pas encore ajouté le setudef.
de toute manière ce n'est pas le genre de commande que tu modifies tous les jours donc bon j'vois pas l’intérêt de polluer ton fichier chan pour pas grand chose
alias_angelius a écrit :j'aurais plus utilisé getchanidle pour utilisé ce genre de système moi perso.
Et lors de cette utilisation tu évite d'utilisé un bind join
en fait non car le getchanidle prend en compte la moindre action qui est effectué même le changement de pseudo, j'ai testé comme ça mais ça fonctionnait vraiment très mal
@DnS: merci pour la correction, erreur d'inattention
à l'époque ou j ai codé ce tcl j'avais pensé à getchanidle mais comme je l'ai déjà dit ça ne fonctionnait pas biensans compter que appeler un variable par son namespace complet (::av::idle($chan)) est plus long que de la charger puis de l appeler simplement
Code :
% namespace eval truc { time {set test} 1000 }
0.795 microseconds per iteration
% namespace eval truc { time {set ::truc::test} 1000 }
1.207 microseconds per iteration
Bonjour djkenny, CrazyCat,
Merci beaucoup de ton aide
Avec le nouveau code que tu ma fourni j'ai cette erreur
Citation :[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 a écrit :
tcl
namespaceeval ::av{variable salons "#salon1 #salon2 #salon3"variabletime15variable lignes 5
bind time - "* * * * *" av::Vvoiceproc Vvoice {12345}{variable idle
variable salons
variabletimeforeach salon [string tolower $salons]{if![validchan $salon]continueforeach nick [chanlist $salon]{if{[isbotnick $nick] || [isop $nick$salon]}continueif{[info exists idle($salon)]&&[dict exists $idle($salon)$nick]}{set n [dict get $idle($salon)$nick]set t1 [lindex$n1]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[list0[unixtime]]}}else{
dict set idle($salon)$nick[list0[unixtime]]}}
flushmode $salon}}
bind pubm - * av::Pvoiceproc 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]}returnif{[info exists idle($chan)]&&[dict exists $idle($chan)$nick]}{set n [dict get $idle($chan)$nick]set i [lindex$n0]
dict set idle($chan)$nick[list[incr i][unixtime]]if{$i>=$lignes}{pushmode $chan +v $nick}}else{
dict set idle($chan)$nick[list0[unixtime]]}}
bind join - * av::joinCproc joinC {nick host hand chan}{variable salons
set chan [string tolower $chan]if{[lsearch -nocase $salons$chan]==-1 || [isbotnick $nick]}returnvariable idle
dict set idle($chan)$nick[list0[unixtime]]}
bind nick - * av::chgnproc chgn {nick host hand chan new}{variable salons
set chan [string tolower $chan]if{[lsearch -nocase $salons$chan]==-1 || [isbotnick $nick]}returnvariable 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[list0[unixtime]]}}}
J'ai essayer avec celui de CrazyCat aucun souci pour joindre les salons mais il fonctionne pas :$ et aucune ligne d'erreur
CrazyCat a écrit :C'est marrant comme vous faites ça, moi j'aurais cherché plus simple:
tcl
namespaceeval av {variable salons "#salon1 #salon2 #salon3"variabletime15variable lignes 5variable idle
bind time - "* * * * *" av::unvoice
bind pubm - * av::voice
bind nick - * av::chgnproc unvoice {min hour day month year}{foreach chan [string tolower $::av::salons]{if{![validchan $chan]}continueforeach nick [chanlist $chan]{if{[isbotnick $nick] || [isop $nick$chan] || ![isvoice $nick$chan]}continueif{[getchanidle $nick$chan]>= $time}{
dict set ::av::idle($chan)$nick0
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]}returnif{[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)$nick1}
flushmode $chan}proc chgn {nick host hand chan new}{set chan [string tolower $chan]if{[lsearch -nocase $::av::salons$chan]==-1 || [isbotnick $nick]}returnif{[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)$nick0}}}