Highlight configurable

Contenu du snippet

Voila mon premier script==>Highlight en dialog qui permet de choisir la facon d'être highlighté. Je sais que c'est du revu mais je veux avoir vos avis et être guidé si optimisation possible.Merci.

Source / Exemple :


menu menubar,status,channel {
  systeme highlight: dialog -m hl hl
}

dialog hl {
  title "highlight"
  size -1 -1 132 103
  option dbu
  button "Général", 1, 0 0 41 16
  button "Options", 2, 41 0 41 16
  button "Infos", 3, 82 0 41 16
  text "Ajouter un mot", 6, 1 24 40 8, disable
  text "liste des mots", 7, 1 37 36 8, disable
  list 5, 2 47 84 49, size
  edit "", 4, 49 23 50 10, limit 900
  button "ok", 8, 102 23 10 10
  button "effacer", 9, 87 46 29 9
  text "Selectionner le mot que vous voulez effacer dans la liste", 10, 89 57 42 28, disable
  button "terminer", 11, 89 89 37 12, ok
  radio "echo", 12, 6 34 50 10, left
  radio "Fenêtre", 13, 6 44 50 10, left
  text "Choisissez ici le type de Highlight désiré", 14, 3 20 109 12, disable
  box "tele", 15, 6 56 102 31
  text "choisir", 16, 13 75 25 8
  edit "", 17, 44 74 50 10
  radio "activer", 18, 13 63 43 8, left
}

dialog aidehl {
  title "Informations"
  size -1 -1 114 70
  option dbu
  box "", 1, 2 3 104 51, disable
  button "fermer", 2, 69 55 37 12,  ok
  text "Concernant l'option du son , vous devez précisez le nom du fichier que vous voulez ecouter lors du highligt. Ce fichier doit se trouver dans le dossier sounds a la racine de votre script.", 3, 6 10 94 41, disable center
}

on 1:dialog:hl:*:*: {
  if $devent == init {
    if !$file(hl.txt) { write -c hl.txt }
    did -h $dname 11,12,13,14,15,16,17,18
    if !$hget(hl) { hmake hl | hload hl hl.txt } | else { hload hl hl.txt } 
    var %x 1 | while $hget(hl,$calc(%x + 1)) { did -a $dname 5 $hget(hl,%x) | inc %x }
    if ($hget(hl,radio) == 1) { did -c $dname 12 }
    if ($hget(hl,radio) == 2) { did -c $dname 13 }
    if ($hget(hl,radio) == 3) { did -c $dname 18 } 
  }
  if $devent == edit {
    if ($did == 4) { hadd hl mot $did($dname,4) } 
    if ($did == 17) { hadd hl son $did($dname,17) }
  }
  if $devent == sclick {
    if ($did == 1) { did -h $dname 12,13,14,15,16,17,18 | did -v $dname 1,2,3,4,5,6,7,8,9,10,11 }  
    if ($did == 2) { did -v $dname 1,2,3,11,12,13,14,15,16,17,18 | did -h $dname 4,5,6,7,8,9,10 }
    if ($did == 3) { dialog -m aidehl aidehl } 
    if $did == 8 && $did(4) { did -aj $dname 5 $did(4) | hadd hl $did(5).lines $did(4) }
    if ($did == 9) { did -d $dname 5 $did(5).sel | var %x 1 | while $did(5,%x) { hdel hl $calc(%x +1) | hadd hl %x $did(5,%x) | inc %x } | halt } 
    if ($did($dname,12).state == 1) { hadd hl radio 1 }
    if ($did($dname,13).state == 1) { hadd hl radio 2 }
    if ($did($dname,18).state == 1) { hadd hl radio 3 }
  }
  if $devent == close { hsave -o hl hl.txt }
}

on *:TEXT:*:#: {
  var %x = 1 
  while $hget(hl,%x) {
    if ($hget(hl,%x)  isin $1-) { 
      if ($hget(hl,radio) == 1) { echo 11 -a Highlight sur $chan par $nick ==> $hget(hl,%x)  | halt }
      if ($hget(hl,radio) == 2) { if ($window(@highlight) == $null) { window -k0zne @highlight } | window @highlight | background -f @highlight systeme/image/abstract008.jpg | aline -ph 11 @highlight - $+ $time $+ - Highlight sur $chan par $nick ==> $hget(hl,%x) :  $1- | halt }
      if ($hget(hl,radio) == 3) { /splay $hget(hl,son) | echo 11 -a Highlight sur $chan par $nick ==> $hget(hl,%x) | halt }
    }
    inc %x
  }
}

Conclusion :


A mttre dans les remotes.

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.