Gestionnaire de highlight avancé avec ignore salon ou pseudo

Contenu du snippet

Gestionnaire de HighLight avancé avec la possibilité d'ignorer les HL d'un pseudo particulier ou d'un salon entier.

Les ignores peuvent se faire par le dialog ainsi que par le clic droit sur le salon ou sur le pseudo.

Possibilité de choisir un son .wav ou .mp3 différent pour le hl pv et le hl salon, possibilité d'activé ou de désactivé se son.

Possibilité de personnalisé sa phrase de HL.

Source / Exemple :


on *:start:{
  hmake hl 1000
  hload hl hl.dou
}
on *:exit:{
  hsave -o hl hl.dou
}
ON 1:LOAD:{ hmake hl 1000 }
dialog hl {
  title "HL Avancé"
  size -1 -1 169 189
  option dbu
  box "Liste des pseudos ignorés", 1, 6 3 79 116
  list 2, 9 12 73 103, size
  box "Liste des salons ignorés", 3, 87 3 79 116
  list 4, 89 12 73 103, size
  box "Pseudos", 5, 6 120 79 23
  edit "", 6, 9 129 73 10
  button "Ajouter", 7, 6 146 37 12
  button "Modifier", 8, 67 146 37 12
  button "Supprimer", 9, 128 146 37 12
  box "Salon", 10, 87 120 79 23
  edit "", 11, 89 130 73 10
  check "Son activé", 12, 5 162 50 10
  button "Son Salon", 13, 67 162 37 12
  button "Son Privé", 14, 128 162 37 12
  button "Phrase de HL", 15, 128 176 37 12
}
menu channel,nicklist {
  Hl Avancé
  .Ouvrir Le Dialog:dialog -m hl hl
  .Pseudo
  ..Ajouter $$1:{
    $add.pse($1)
    hsave -o hl hl.dou
  }
  ..Supprimer $$1:{
    $sup.pse($1)
    hsave -o hl hl.dou
  }
  .Salon
  ..Ajouter $active:{
    $add.cha($active)
    hsave -o hl hl.dou
  }
  ..Supprimer $active:{
    $sup.cha($active)
    hsave -o hl hl.dou
  }
}
on *:dialog:hl:*:*: {
  if $devent == init {
    didtok $dname 2 44 $hget(hl,pseudo) 
    didtok $dname 4 44 $hget(hl,salon) 
    if %play.son { did -c $dname 12 }
  }
  if $devent == close {
   $iif($did(12).state,set,unset) %play.son 1 
  }
  if $devent == sclick {
    if $did == 15 { dialog -m phhl phhl }
    if $did == 13 { set %son.cha $sfile(C:\,Choisissez un *.mp3 ou *.wav,Valider) }
    if $did == 14 { set %son.pv $sfile(C:\,Choisissez un *.mp3 ou *.wav,Valider) }
    if $did == 9 {
      if $did(2).sel { hadd -m hl pseudo $remtok($hget(hl,pseudo),$wildtok($hget(hl,pseudo),$did(2).seltext,1,44),1,44) | hsave -o hl hl.dou }
      if $did(4).sel { hadd -m hl salon $remtok($hget(hl,salon),$wildtok($hget(hl,salon),$did(4).seltext,1,44),1,44) | hsave -o hl hl.dou }
      did -r $dname 2,4
      didtok $dname 2 44 $hget(hl,pseudo) 
      didtok $dname 4 44 $hget(hl,salon) 
    }
    if $did == 7 {
      if $did(6) { hadd -m hl pseudo $+($hget(hl,pseudo),$chr(44),$did(6)) | hsave -o hl hl.dou }
      if $did(11) { hadd -m hl salon $+($hget(hl,salon),$chr(44),$did(11)) | hsave -o hl hl.dou }
      did -r $dname 2,4,6,11
      didtok $dname 2 44 $hget(hl,pseudo) 
      didtok $dname 4 44 $hget(hl,salon) 
    }
    if $did == 8 {
      if $did(2).sel && $did(6) {
        hadd -m hl pseudo $reptok($hget(hl,pseudo),$wildtok($hget(hl,pseudo),$did(2).seltext,1,44),$did(6),1,44)
        hsave -o hl hl.dou
      }
      if $did(4).sel && $did(11) {
        hadd -m hl salon $reptok($hget(hl,salon),$wildtok($hget(hl,salon),$did(4).seltext,1,44),$did(11),1,44)
        hsave -o hl hl.dou
      }
      did -r $dname 2,4,6,11
      didtok $dname 2 44 $hget(hl,pseudo) 
      didtok $dname 4 44 $hget(hl,salon) 
    }
  }
}
on *:text:*:*: {
  if $istok($strip($1),$me,32) {
    if $regex($hget(hl,pseudo),$nick) == 0 { 
      if $regex($hget(hl,salon),$chan) == 0 {
        window -kn @HightLight
        if $target == $chan && $chan != $active  {
          //echo -a $th $chr(2) $+($chr(3),%coul.hlpv) $(%phhlpv,2)
          echo @HightLight $th [ $chan ] < $nick > $1- 
          if ($var(%play.son)) .splay %son.cha 
        }
      }
      if $target != $chan && $nick != $active {
        //echo -a $th $chr(2) $+($chr(3),%coul.hlpv) $(%phhlps,2)
        echo @HightLight $th [ PV ] < $nick > $1-
        if ($var(%play.son)) .splay %son.pv
      }
    }
  }
}
on *:input:*:{
  if $1 == !hladd {
    if $2 == chan { hadd -m hl salon $+($hget(hl,salon),$chr(44),$3) | hsave -o hl hl.dou | echo -a 4[HLADD]12 réussi pour $3 }
    if $2 == nick { hadd -m hl pseudo $+($hget(hl,pseudo),$chr(44),$3) | hsave -o hl hl.dou | echo -a 4[HLADD]12 réussi pour $3 }
    else { echo -a 4[ERREUR]12 Syntaxe incorrect : !hlsup <chan ou nick> <Le salon ou le pseudo à mettre en ignore de HL> }
  }
  if $1 == !hlsup {
    if $2 == chan { hadd -m hl salon $remtok($hget(hl,salon),$wildtok($hget(hl,salon),$3,1,44),1,44) | hsave -o hl hl.dou | echo -a 4[HLSUP]12 réussi pour $3 }
    if $2 == nick { hadd -m hl pseudo $remtok($hget(hl,pseudo),$wildtok($hget(hl,pseudo),$3,1,44),1,44) | hsave -o hl hl.dou | echo -a 4[HLSUP]12 réussi pour $3 }
    else { echo -a 4[ERREUR]12 Syntaxe incorrect : !hlsup <chan ou nick> <Le salon ou le pseudo à mettre en ignore de HL> }
  }
}
alias add.pse { hadd -m hl pseudo $+($hget(hl,pseudo),$chr(44),$1) }
alias sup.pse { hadd -m hl pseudo $remtok($hget(hl,pseudo),$wildtok($hget(hl,pseudo),$1,1,44),1,44) }
alias add.cha { hadd -m hl salon $+($hget(hl,salon),$chr(44),$1) }
alias sup.cha { hadd -m hl salon $remtok($hget(hl,salon),$wildtok($hget(hl,salon),$1,1,44),1,44) }

dialog phhl {
  title "Phrases de HL"
  size -1 -1 214 190
  option dbu
  box "HL Privé", 1, 109 4 98 118
  edit %txthlpv, 2, 9 87 93 10, autohs center
  box HL Salon, 4, 7 4 98 118
  edit %txthlps, 6, 123 87 73 10, autohs center
  combo 8, 9 24 45 50, size
  combo 9, 57 24 45 50, size
  text "Phrase de HL", 10, 20 77 73 8, center
  text "Texte de décoration", 11, 123 77 73 8, center
  combo 12, 111 24 45 50, size
  combo 13, 159 24 45 50, size
  text "Couleur de texte", 14, 9 14 44 8, center
  text "Couleur de fond", 15, 57 14 45 8, center
  text "Couleur de texte", 16, 111 14 44 8, center
  text "Couleur de fond", 17, 159 14 45 8, center
  box "Aide", 3, 7 123 200 50
  check "Gras", 5, 43 99 50 10
  check "Souligné", 7, 43 110 50 10
  check "Gras", 18, 148 99 50 10
  check "Souligné", 19, 148 110 50 10
  text "1) Le mot $nick désigne la personne qui vous parle", 20, 11 132 186 8
  text "2) Le mot $chan désigne le salon ou on vous parle", 21, 11 142 186 8
  text "3) Le mot $server désigne le serveur ou on vous parle", 22, 11 152 186 8
  text "4) Le mot $asctime([HH:nn:ss]) désigne l'heure à laquelle on vous a parlé", 23, 11 161 186 8
  button "Fermer", 24, 84 175 37 12
}

on *:dialog:phhl:*:*:{
  if $devent == init {
    if %phhlpvgr { did -c $dname 5 }
    if %phhlpvsou { did -c $dname 7 }
    if %phhlpsgr { did -c $dname 18 }
    if %phhlpssou { did -c $dname 19 }
    didtok $dname 8,9,12,13 45 Blanc-Noir-Bleu Foncé-Vert Foncé-Rouge-Brun-Violet-Orange-Jaune-Vert Clair-Vert Anglais-Bleu Clair-Bleu Ciel-Rose-Gris Foncé-Gris Clair
    did -c $dname 8 $calc($gettok(%coul.hlpv,1,44) + 1) | did -c $dname 9 $calc($gettok(%coul.hlpv,2,44) + 1)
    did -c $dname 12 $calc($gettok(%coul.hlps,1,44) + 1) | did -c $dname 13 $calc($gettok(%coul.hlps,2,44) + 1)
  }
  if $devent == sclick {
    if $did == 24 {
      set %txthlpv $did(2)
      set %txthlps $did(6)
      set %coul.hlpv $iif($base($calc($did(9).sel - 1),10,10,2) != 00,$+($base($calc($did(8).sel - 1),10,10,2),$chr(44),$base($calc($did(9).sel - 1),10,10,2)),$base($calc($did(8).sel - 1),10,10,2))
      set %coul.hlps $iif($base($calc($did(13).sel - 1),10,10,2) != 00,$+($base($calc($did(12).sel - 1),10,10,2),$chr(44),$base($calc($did(13).sel - 1),10,10,2)),$base($calc($did(12).sel - 1),10,10,2))
      $iif($did(5).state,set,unset) %phhlpvgr $chr(2)
      $iif($did(18).state,set,unset) %phhlpsgr $chr(2) 
      $iif($did(7).state,set,unset) %phhlpvsou $chr(31)
      $iif($did(19).state,set,unset) %phhlpssou $chr(31) 
      set %phhlpv $+(%phhlpvgr,%phhlpvsou,%txthlpv)
      set %phhlps $+(%phhlpsgr,%phhlpssou,%txthlps)
      dialog -x phhl
    } 
  }
}

Conclusion :


Si vous remarquez des bugs ou des amélioration merci de commenter.

Enjoy =)

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.