;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; Dialogue Aide ;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias F1 { if ($dialog(aide).title != $null) { dialog -v aide }
  else { dialog -m aide aide }
}

dialog aide {
  size -1 -1 550 350
  title "Aide"
  button "",1,1000 1000 1 1,ok
  list 2,10 30 530 325, multi,vsbar
  combo 3,340 5 150 100,drop,sort,vsbar
  text "»» Cliquez sur la barre de défilement pour voir les différentes aides",4,-1 7 330 20,right
}

on 1:dialog:aide:init:0:{
  did -ac aide 3 Aide Script
  did -a aide 3 Aide Pseudo
  did -a aide 3 Aide Alias
  did -a aide 3 Aide Remotes
  did -a aide 3 Aide Variables
  did -a aide 3 Aide Popups
  var %fic.aide = aide/aide_script.txt
  var %temp.ligne.fic.aide = $lines(%fic.aide)
  var %temp.ligne.aide = 1
  var %temp.aide = $read -l $+ %temp.ligne.aide %fic.aide
  while (%temp.ligne.fic.aide >= %temp.ligne.aide) {
    did -i aide 2 %temp.ligne.aide %temp.aide
    inc %temp.ligne.aide
    var %temp.aide = $read -l $+ %temp.ligne.aide %fic.aide
  }
}

on 1:dialog:aide:sclick:3:{ 
  if ($did(3) == $null) { halt }
  did -r aide 2
  var %temp.ligne.aide = 1
  var %fic.aide = aide\ $+ $replace($did(3),$chr(32),_) $+ .txt
  var %temp.ligne.fic.aide = $lines(%fic.aide)
  var %temp.aide = $read -l $+ %temp.ligne.aide %fic.aide
  while (%temp.ligne.fic.aide >= %temp.ligne.aide) {
    did -i aide 2 %temp.ligne.aide %temp.aide
    inc %temp.ligne.aide
    var %temp.aide = $read -l $+ %temp.ligne.aide %fic.aide
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; Dialoque Propos ;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dialog propos {
  size -1 -1 390 265
  title "A propos"
  text "A propos de NisScript",1,50 10 275 15,center
  text "",2,15 65 130 15
  text "",6,15 80 120 15
  text "Fait par Nisroch",3,15 95 100 15
  text "Contact :",4,15 112 45 15
  link "irc://irc.geeknode.org/#zebulon.fr",9,63 112 170 13
  text "Site :",5,15 129 28 15
  link "http://wushunisroch.free.fr/",7,43 129 135 13
  text "© 2002-2021 Aucun droit réservé",8,15 147 165 15
  text "Remerciements :",17,15 195 135 15
  text "À Coco77 (2nd World Script), Raton_laveur (Ratonus-Script), Sebiseba (Sebi-Script), à Gen pour son aide précieuse, à Skwi pour sa regex et à Mortbise le dénicheur de bugs.",18,15 210 305 50,left
  box "",11,10 53 230 114 
  box "",12,324 215 52 29
  box "",15,5 35 380 145
  box "",16,110 18 170 12,center
  box "",20,5 188 380 70
  button "OK",13,325 222 50 20,ok
  icon 14,220 20 175 180,images/moi.jpg
}

on *:dialog:propos:init:0:{ did -a propos 6 Version de mIRC: $version
  did -a propos 2 Version du script: %nsv
}
on *:dialog:propos:sclick:7:{ run $did(7) }
on *:dialog:propos:sclick:9:{ run $did(9) }

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; Dialogue 1° démarrage ;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

dialog boot {
  title "1° Config"
  size -1 -1 180 130
  edit "",1,90 5 85 20,autohs
  edit "",2,90 33 85 20,autohs
  edit "",3,90 55 85 20,autohs
  edit "",4,90 80 85 20,autohs
  text "Nom complet:",11,23 9 65 15
  text "Pseudo:",12,49 33 40 20
  text "Pseudo alternatif:",13,3 57 87 15
  text "E-Mail:",14,56 82 34 15
  button "OK",10,65 105 50 20,ok
}

on *:dialog:boot:init:0:{
  did -a boot 1 $fullname
  did -a boot 2 $mnick
  did -a boot 3 $anick
  did -a boot 4 $emailaddr
}

on *:dialog:boot:sclick:10:{
  .fullname $did(1)
  .nick $did(2)
  .anick $did(3)
  .emailaddr $did(4)
  if (%n.dema == $null) { demarrage | f12 }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; Dialogue Connexion ;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias f2 { if ($dialog(script).title != $null) { dialog -v script | halt }
  dialog -m script script
  if ($server != $null) servchoix
}

dialog script {
  title "Connexion"
  size 5 5 309 245
  button "Connexion",1,160 190 135 30, ok
  button "Choisir Serveur(s) de Chat",30,13 190 140 30
  button "À Propos",31,9 111 72 20
  button "Aide Script",32,9 136 72 20
  button "Configuration",33,9 161 72 20
  check "Joindre les serveurs selectionnés",40,13 220 175 16
  check "Connexion auto",41,200 220 100 16
  icon 2,10 5 90 90, images\connex.jpg
  box "",4,113 0 190 95
  box "",27,122 7 172 80
  box "",28,5 95 298 145
  box "",29,85 103 210 80
  text "" 5,150 25 150 20
  text "© Nisroch 2002-2021" 6,137 45 120 20
  text "Aucun droit réservé" 8,150 65 120 20
  text "Visitez l'antre de Nisroch !!!",13,90 120 250 20
  text "Plein de freewares utiles...",14,90 135 250 18
  edit "http://wushunisroch.free.fr",15,90 153 146 20, read, autohs
  button "&Visiter",16,240 153 45 20
}
on *:dialog:script:sclick:1:{
  dialog -x script
  if ($dialog(multi).title != $null) { dialog -x multi }
  if (%allj != $null) { var %con.ini 0
    while (%con.ini <= 15) {
      inc %con.ini
      if (%serv.ajoin. [ $+ [ %con.ini ] ] == on && %check.ajoin == $null) { server %serv.adr. [ $+ [ %con.ini ] ] %serv.port. [ $+ [ %con.ini ] ] | set %check.ajoin on }
      elseif (%serv.ajoin. [ $+ [ %con.ini ] ] == on) { server -m %serv.adr. [ $+ [ %con.ini ] ] %serv.port. [ $+ [ %con.ini ] ] }
    }
    unset %check.ajoin
  }
  if (%allj == $null) server %def.serv %def.port
  unset %connexion.anim
}

on *:dialog:script:sclick:16:{ run $did(15) }
on *:dialog:script:sclick:30:{ servchoix  }
on *:dialog:script:sclick:31:{ dialog -m propos propos }
on *:dialog:script:sclick:32:{ f1 }
on *:dialog:script:sclick:33:{ f12 }
on *:dialog:script:sclick:40:{ if (%allj == $null) { set %allj on }
  else { unset %allj }
}
on *:dialog:script:sclick:41:{ if (%acon == $null) { set %acon on }
  else { unset %acon }
}

alias bouton.connexion {
  if ($dialog(script).title == $null) { .timerConnexion off | halt }
  did -ra script 1 $gettok(%connexion.anim,%connexion.anim1,46)
  inc %connexion.anim1
  if (%connexion.anim1 > 6) { set %connexion.anim1 1 }
}

on 1:dialog:script:init:0:{
  did -a script 5 NisScript %nsv
  if (%allj == on) { did -c script 40 }
  if (%acon == on) { did -c script 41 }
  set %connexion.anim >>>> Connexion  <<<<.>>>  Connexion  <<<.>>   Connexion   <<.>    Connexion    <.     Connexion     .        Connexion        
  .timerConnexion -mo 0 150 bouton.connexion
}

on *:start:{
  if (%acon != $null) {
    if (%allj != $null) { var %con.ini 0
      while (%con.ini <= 15) {
        inc %con.ini
        if (%serv.ajoin. [ $+ [ %con.ini ] ] == on && %check.ajoin == $null) { server %serv.adr. [ $+ [ %con.ini ] ] %serv.port. [ $+ [ %con.ini ] ] | set %check.ajoin on }
        elseif (%serv.ajoin. [ $+ [ %con.ini ] ] == on) { server -m %serv.adr. [ $+ [ %con.ini ] ] %serv.port. [ $+ [ %con.ini ] ] }
      }
      unset %check.ajoin
    }
    if (%allj == $null) server %def.serv %def.port
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;; Dialogue Choix serveur ;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias servchoix { if ($dialog(multi).title != $null) { dialog -v multi }
  else { dialog -m multi multi }
}

dialog multi {
  title "Gestion des serveurs"
  size 330 5 388 380
  button "OK" 1001,220 355 100 20,ok
  box "Serveurs" 1,3 3 215 345
  box "Ports" 2,223 3 56 345
  box "Def" 6,282 28 32 320
  box "Join - Auto" 7,318 28 66 320
  text "¤¤ Défaut ¤¤" 3,15 21 80 20
  list 4,101 18 110 20,size
  list 5,227 18 45 20,size
  text "¤¤ Serveur 1 ¤¤" 10,15 45 80 20
  edit "" 11,101 42 110 20,autohs %serv.adr.1
  edit "" 12,227 42 45 20,autohs %serv.port.1
  button "Set" 13,285 44 24 17
  button "Join" 14,321 44 27 17
  check "" 15,359 45 15 15
  text "¤¤ Serveur 2 ¤¤" 20,15 65 80 20
  edit "" 21,101 62 110 20,autohs %serv.adr.2
  edit "" 22,227 62 45 20,autohs %serv.port.2
  button "Set" 23,286 64 24 17
  button "Join" 24,321 64 27 17
  check "" 25,359 65 15 15
  text "¤¤ Serveur 3 ¤¤" 30,15 85 80 20
  edit "" 31,101 82 110 20,autohs %serv.adr.3
  edit "" 32,227 82 45 20,autohs %serv.port.3
  button "Set" 33,286 84 24 17
  button "Join" 34,321 84 27 17
  check "" 35,359 85 15 15
  text "¤¤ Serveur 4 ¤¤" 40,15 105 80 20
  edit "" 41,101 102 110 20,autohs %serv.adr.4
  edit "" 42,227 102 45 20,autohs %serv.port.4
  button "Set" 43,286 104 24 17
  button "Join" 44,321 104 27 17
  check "" 45,359 105 15 15
  text "¤¤ Serveur 5 ¤¤" 50,15 125 80 20
  edit "" 51,101 122 110 20,autohs %serv.adr.5
  edit "" 52,227 122 45 20,autohs %serv.port.5
  button "Set" 53,286 124 24 17
  button "Join" 54,321 124 27 17
  check "" 55,359 125 15 15
  text "¤¤ Serveur 6 ¤¤" 60,15 145 80 20
  edit "" 61,101 142 110 20,autohs %serv.adr.6
  edit "" 62,227 142 45 20,autohs %serv.port.6
  button "Set" 63,286 144 24 17
  button "Join" 64,321 144 27 17
  check "" 65,359 145 15 15
  text "¤¤ Serveur 7 ¤¤" 70,15 165 80 20
  edit "" 71,101 162 110 20,autohs %serv.adr.7
  edit "" 72,227 162 45 20,autohs %serv.port.7
  button "Set" 73,286 165 24 17
  button "Join" 74,321 164 27 17
  check "" 75,359 164 15 15
  text "¤¤ Serveur 8 ¤¤" 80,15 185 80 20
  edit "" 81,101 182 110 20,autohs %serv.adr.8
  edit "" 82,227 182 45 20,autohs %serv.port.8
  button "Set" 83,286 184 24 17
  button "Join" 84,321 184 27 17
  check "" 85,359 185 15 15
  text "¤¤ Serveur 9 ¤¤" 90,15 205 80 20
  edit "" 91,101 202 110 20,autohs %serv.adr.9
  edit "" 92,227 202 45 20,autohs %serv.port.9
  button "Set" 93,286 204 24 17
  button "Join" 94,321 204 27 17
  check "" 95,359 205 15 15
  text "¤¤ Serveur 10 ¤¤" 100,12 225 88 20
  edit "" 101,101 222 110 20,autohs %serv.adr.10
  edit "" 102,227 222 45 20,autohs %serv.port.10
  button "Set" 103,286 224 24 17
  button "Join" 104,321 224 27 17
  check "" 105,359 225 15 15
  text "¤¤ Serveur 11 ¤¤" 110,12 245 88 20
  edit "" 111,101 242 110 20,autohs %serv.adr.11
  edit "" 112,227 242 45 20,autohs %serv.port.11
  button "Set" 113,286 244 24 17
  button "Join" 114,321 244 27 17
  check "" 115,359 245 15 15
  text "¤¤ Serveur 12 ¤¤" 120,12 265 88 20
  edit "" 121,101 262 110 20,autohs %serv.adr.12
  edit "" 122,227 262 45 20,autohs %serv.port.12
  button "Set" 123,286 264 24 17
  button "Join" 124,321 264 27 17
  check "" 125,359 265 15 15
  text "¤¤ Serveur 13 ¤¤" 130,12 285 88 20
  edit "" 131,101 282 110 20,autohs %serv.adr.13
  edit "" 132,227 282 45 20,autohs %serv.port.13
  button "Set" 133,286 284 24 17
  button "Join" 134,321 284 27 17
  check "" 135,359 285 15 15
  text "¤¤ Serveur 14 ¤¤" 140,12 305 88 20
  edit "" 141,101 302 110 20,autohs %serv.adr.14
  edit "" 142,227 302 45 20,autohs %serv.port.14
  button "Set" 143,286 304 24 17
  button "Join" 144,321 304 27 17
  check "" 145,359 305 15 15
  text "¤¤ Serveur 15 ¤¤" 150,12 325 88 20
  edit "" 151,101 322 110 20,autohs %serv.adr.15
  edit "" 152,227 322 45 20,autohs %serv.port.15
  button "Set" 153,286 324 24 17
  button "Join" 154,321 324 27 17
  check "" 155,359 325 15 15
  button "Tout supprimer" 1000,40 355 100 20
}

on 1:dialog:multi:init:0:{
  if (%def.serv == $null) {
    var %serv.ini 0
    :loop
    inc %serv.ini
    if (%serv.ini >= 16) { goto end }
    if (%serv.adr. [ $+ [ %serv.ini ] ] == $null) { goto loop }
    if (%serv.adr. [ $+ [ %serv.ini ] ] != $null) {
      set %def.serv %serv.adr. [ $+ [ %serv.ini ] ]
      set %def.port %serv.port. [ $+ [ %serv.ini ] ]
      goto end
    }
    :end
  }
  did -a multi 4 %def.serv
  did -a multi 5 %def.port
  did -a multi 11 %serv.adr.1
  did -a multi 12 %serv.port.1
  did -a multi 21 %serv.adr.2
  did -a multi 22 %serv.port.2
  did -a multi 31 %serv.adr.3
  did -a multi 32 %serv.port.3
  did -a multi 41 %serv.adr.4
  did -a multi 42 %serv.port.4
  did -a multi 51 %serv.adr.5
  did -a multi 52 %serv.port.5
  did -a multi 61 %serv.adr.6
  did -a multi 62 %serv.port.6
  did -a multi 71 %serv.adr.7
  did -a multi 72 %serv.port.7
  did -a multi 81 %serv.adr.8
  did -a multi 82 %serv.port.8
  did -a multi 91 %serv.adr.9
  did -a multi 92 %serv.port.9
  did -a multi 101 %serv.adr.10
  did -a multi 102 %serv.port.10
  did -a multi 111 %serv.adr.11
  did -a multi 112 %serv.port.11
  did -a multi 121 %serv.adr.12
  did -a multi 122 %serv.port.12
  did -a multi 131 %serv.adr.13
  did -a multi 132 %serv.port.13
  did -a multi 141 %serv.adr.14
  did -a multi 142 %serv.port.14
  did -a multi 151 %serv.adr.15
  did -a multi 152 %serv.port.15
  if (%serv.ajoin.1 == on) { did -c multi 15 }
  if (%serv.ajoin.2 == on) { did -c multi 25 }
  if (%serv.ajoin.3 == on) { did -c multi 35 }
  if (%serv.ajoin.4 == on) { did -c multi 45 }
  if (%serv.ajoin.5 == on) { did -c multi 55 }
  if (%serv.ajoin.6 == on) { did -c multi 65 }
  if (%serv.ajoin.7 == on) { did -c multi 75 }
  if (%serv.ajoin.8 == on) { did -c multi 85 }
  if (%serv.ajoin.9 == on) { did -c multi 95 }
  if (%serv.ajoin.10 == on) { did -c multi 105 }
  if (%serv.ajoin.11 == on) { did -c multi 115 }
  if (%serv.ajoin.12 == on) { did -c multi 125 }
  if (%serv.ajoin.13 == on) { did -c multi 135 }
  if (%serv.ajoin.14 == on) { did -c multi 145 }
  if (%serv.ajoin.15 == on) { did -c multi 155 }
}

on *:dialog:multi:sclick:*:{
  if ($did == 13) { set %def.serv $did(11)
    set %def.port $did(12)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 14) { if ($server == $null) { server $did(11) $did(12) }
    else { server -m $did(11) $did(12) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 15) { if (%serv.ajoin.1 != on) { set %serv.ajoin.1 on | halt }
    if (%serv.ajoin.1 == on) { set %serv.ajoin.1 }
  }
  if ($did == 23) { set %def.serv $did(21)
    set %def.port $did(22)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 24) { if ($server == $null) { server $did(21) $did(22) }
    else { server -m $did(21) $did(22) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 25) { if (%serv.ajoin.2 != on) { set %serv.ajoin.2 on | halt }
    if (%serv.ajoin.2 == on) { set %serv.ajoin.2 }
  }
  if ($did == 33) { set %def.serv $did(31)
    set %def.port $did(32)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 34) { if ($server == $null) { server $did(31) $did(32) }
    else { server -m $did(31) $did(32) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 35) { if (%serv.ajoin.3 != on) { set %serv.ajoin.3 on | halt }
    if (%serv.ajoin.3 == on) { set %serv.ajoin.3 }
  }
  if ($did == 43) { set %def.serv $did(41)
    set %def.port $did(42)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 44) { if ($server == $null) { server $did(41) $did(42) }
    else { server -m $did(41) $did(42) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 45) { if (%serv.ajoin.4 != on) { set %serv.ajoin.4 on | halt }
    if (%serv.ajoin.4 == on) { set %serv.ajoin.4 }
  }
  if ($did == 53) { set %def.serv $did(51)
    set %def.port $did(52)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 54) { if ($server == $null) { server $did(51) $did(52) }
    else { server -m $did(51) $did(52) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 55) { if (%serv.ajoin.5 != on) { set %serv.ajoin.5 on | halt }
    if (%serv.ajoin.5 == on) { set %serv.ajoin.5 }
  }
  if ($did == 63) { set %def.serv $did(61)
    set %def.port $did(62)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 64) { if ($server == $null) { server $did(61) $did(62) }
    else { server -m $did(61) $did(62) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 65) { if (%serv.ajoin.6 != on) { set %serv.ajoin.6 on | halt }
    if (%serv.ajoin.6 == on) { set %serv.ajoin.6 }
  }
  if ($did == 73) { set %def.serv $did(71)
    set %def.port $did(72)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 74) { if ($server == $null) { server $did(71) $did(72) }
    else { server -m $did(71) $did(72) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 75) { if (%serv.ajoin.7 != on) { set %serv.ajoin.7 on | halt }
    if (%serv.ajoin.7 == on) { set %serv.ajoin.7 }
  }
  if ($did == 83) { set %def.serv $did(81)
    set %def.port $did(82)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 84) { if ($server == $null) { server $did(81) $did(82) }
    else { server -m $did(81) $did(82) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 85) { if (%serv.ajoin.8 != on) { set %serv.ajoin.8 on | halt }
    if (%serv.ajoin.8 == on) { set %serv.ajoin.8 }
  }
  if ($did == 93) { set %def.serv $did(91)
    set %def.port $did(92)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 94) { if ($server == $null) { server $did(91) $did(92) }
    else { server -m $did(91) $did(92) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 95) { if (%serv.ajoin.9 != on) { set %serv.ajoin.9 on | halt }
    if (%serv.ajoin.9 == on) { set %serv.ajoin.9 }
  }
  if ($did == 103) { set %def.serv $did(101)
    set %def.port $did(102)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 104) { if ($server == $null) { server $did(101) $did(102) }
    else { server -m $did(101) $did(102) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 105) { if (%serv.ajoin.10 != on) { set %serv.ajoin.10 on | halt }
    if (%serv.ajoin.10 == on) { set %serv.ajoin.10 }
  }
  if ($did == 113) { set %def.serv $did(111)
    set %def.port $did(112)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 114) { if ($server == $null) { server $did(111) $did(112) }
    else { server -m $did(111) $did(112) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 115) { if (%serv.ajoin.11 != on) { set %serv.ajoin.11 on | halt }
    if (%serv.ajoin.11 == on) { set %serv.ajoin.11 }
  }
  if ($did == 123) { set %def.serv $did(121)
    set %def.port $did(122)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 124) { if ($server == $null) { server $did(121) $did(122) }
    else { server -m $did(121) $did(122) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 125) { if (%serv.ajoin.12 != on) { set %serv.ajoin.12 on | halt }
    if (%serv.ajoin.12 == on) { set %serv.ajoin.12 }
  }
  if ($did == 133) { set %def.serv $did(131)
    set %def.port $did(132)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 134) { if ($server == $null) { server $did(131) $did(132) }
    else { server -m $did(131) $did(132) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 135) { if (%serv.ajoin.13 != on) { set %serv.ajoin.13 on | halt }
    if (%serv.ajoin.13 == on) { set %serv.ajoin.13 }
  }
  if ($did == 143) { set %def.serv $did(141)
    set %def.port $did(142)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 144) { if ($server == $null) { server $did(141) $did(142) }
    else { server -m $did(141) $did(142) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 145) { if (%serv.ajoin.14 != on) { set %serv.ajoin.14 on | halt }
    if (%serv.ajoin.14 == on) { set %serv.ajoin.14 }
  }
  if ($did == 153) { set %def.serv $did(151)
    set %def.port $did(152)
    did -o multi 4 1 %def.serv
    did -o multi 5 1 %def.port
  }
  if ($did == 154) { if ($server == $null) { server $did(151) $did(152) }
    else { server -m $did(151) $did(152) }
    if ($dialog(script).title != $null) dialog -x script script
    dialog -x multi multi
  }
  if ($did == 155) { if (%serv.ajoin.15 != on) { set %serv.ajoin.15 on | halt }
    if (%serv.ajoin.15 == on) { set %serv.ajoin.15 }
  }
  if ($did == 1000) { did -r multi 4,5,11,12,15,21,22,25,31,32,35,41,42,45,51,52,55,61,62,65,71,72,75,81,82,85,91,92,95,101,102,105,111,112,115,121,122,125,131,132,135,141,142,145,151,152,155
    dialog -x multi multi
    set %serv.adr.*
    set %serv.port.*
    set %serv.ajoin.*
    .saveini variables.ini
    set %def.serv
    set %def.port
  }
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; Dialogue Configuration ;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias f12 { if ($dialog(speedconf).title != $null) { dialog -x speedconf | halt }
  dialog -m speedconf speedconf
}
dialog speedconf {
  title "Console de Configuration"
  size -1 -1 341 261
  check "Couleurs &Pseudos" 1,5 5 104 15
  check "Couleurs/&Déco" 2,5 25 100 15
  check "Auto &CloneScan" 3,5 45 100 15
  check "Auto &KillGhost" 4,5 65 100 15
  check "Anti Dé&op" 5,115 5 100 15
  check "Anti &Ban" 6,115 25 100 15
  check "System &Info" 7,115 45 100 15
  check "&GTSdll" 8,115 65 100 15
  check "LagBar [F6]" 9,220 5 100 15
  check "Console Perso [F8]" 10,220 25 110 15
  check "Console Event [F9]" 11,220 45 110 15
  check "-   Pseudo e&xact" 13,223 87 95 15,left
  check "-  &Notif." 14,123 113 50 15,left
  edit "" 20,4 85 15 20, %reac
  text "Nombre de lettres du pseudo pour l'écho" 21,23 88 195 15
  edit "" 30,4 110 21 20, %pv
  text "Nombre de PV max" 31,28 113 90 15
  edit "" 70,185 110 15 20,autohs %jdel
  text "Délai au Join auto (en sec.)" 71,203 113 150 15
  edit "" 60,4 135 70 20
  text "Timestamp" 61,77 138 60 15
  edit "" 90,180 135 20 20
  text "Signe pour les évènements" 91,203 138 130 15
  edit "" 80,4 160 20 20, %col1
  text "" 81,27 163 70 15
  edit "" 82,103 160 20 20, %col2
  text "Couleur 2 ([xxx])" 83,126 163 85 15
  edit "" 84,222 160 20 20, %col3
  text "Couleur 3 (texte)" 85,245 163 90 15  
  button "Aide [F1]" 40,5 185 54 20
  button "&Serveurs" 41,62 185 55 20
  button "Auto Login [F7]" 42,120 185 83 20
  button "Config &Away" 43,205 185 75 20
  button "1° Config" 44,282 185 55 20
  button "Couleurs Pseudos [F3]" 45,5 210 117 20
  button "Couleurs/Déco [F4]" 46,125 210 100 20
  button "À p&ropos" 47,228 210 53 20
  button "Site &web" 48,284 210 53 20
  button "&MSG divers" 49,5 235 80 20
  button "&Valider" 100,237 235 100 20, ok  
}

on *:dialog:speedconf:init:0:{
  if ($group(#nlist) == on) { did -c speedconf 1 }
  if (%deco.enable == on) { did -c speedconf 2 }
  if ($group(#scln) == on) { did -c speedconf 3 }
  if ($group(#kill) == on) { did -c speedconf 4 }
  if ($group(#deop) == on) { did -c speedconf 5 }
  if ($group(#aban) == on) { did -c speedconf 6 }
  if ($script(sysinfo.mrc) != $null) { did -c speedconf 7 }
  if ($script(gtsdll.ini) != $null) { did -c speedconf 8 }
  if ($exists(system\gtsdll\gtsdll.ini) != $true) { did -b speedconf 8 }
  if (%lagbar == on) { did -c speedconf 9 }
  if ($dialog(arf2).title != $null) { did -c speedconf 10 }
  if ($dialog(arf).title != $null) { did -c speedconf 11 }
  if (%exact == on) { did -c speedconf 13 | did -b speedconf 20 }
  if (%pvmax.not == on) { did -c speedconf 14 }
  did -a speedconf 20 %reac
  did -a speedconf 30 %pv
  did -a speedconf 60 $readini(mirc.ini,text,timestamp)
  did -a speedconf 70 %jdel
  did -a speedconf 80 %col1
  did -a speedconf 82 %col2
  did -a speedconf 84 %col3
  did -a speedconf 90 %e.sign
  did -a speedconf 81 Couleur 1 ( $+ %e.sign $+ )
}

on *:dialog:speedconf:edit:60:{ .timestamp -f $did(60)
  saveini
}

on *:dialog:speedconf:edit:90:{ set %e.sign $did(90)
  did -a speedconf 81 Couleur 1 ( $+ %e.sign $+ )
}

on *:dialog:speedconf:sclick:*:{
  if ($did == 1) { if ($group(#nlist) != on) { abook -l
      .enable #nlist
      unset %wc.*
      .timerclineup 0 20 wc
    }
    else { abook -l
      .disable #nlist
      unset %wc.*
      .timerclineup off
    }
  }
  if ($did == 2) { if (%deco.enable == on) { %deco.enable = $null }
    elseif (%deco.enable == $null) { set %deco.enable on }
    else { set %deco.enable on | did -c color 2 }
  }   
  if ($did == 3) { if ($group(#scln) != on) { .enable #scln }
    else { .disable #scln }
  }
  if ($did == 4) { if ($group(#kill) != on) { .enable #kill }
    else { .disable #kill | unset %kill.* }
  }
  if ($did == 5) { if ($group(#deop) != on) { .enable #deop }
    else .disable #deop
  }
  if ($did == 6) { if ($group(#aban) != on) { .enable #aban }
    else .disable #aban
  }
  if ($did == 7) { if ($script(sysinfo.mrc) == $null) { .load -rs10 system\remotes\sysinfo.mrc  }
    else { .unload -rs sysinfo.mrc }
  }
  if ($did == 8) { if ($script(gtsdll.ini) == $null) { .load -rs11 system\gtsdll\gtsdll.ini }
    else { .unload -rs gtsdll.ini }
  }
  if ($did == 9) { f6 }
  if ($did == 10) { if ($did(10).state == 1) { f8 } | elseif ($did(speedconf,10).state == 0 && $dialog(arf2).title != $null) { dialog -x arf2 } }
  if ($did == 11) { f9 }
  if ($did == 13) { if (%exact != on) { set %exact on | did -b speedconf 20 }
    else { set %exact | did -e speedconf 20 }
  }
  if ($did == 14) { if (%pvmax.not != on) { set %pvmax.not on }
    else { set %pvmax.not }
  }
  if ($did == 40) { f1 }
  if ($did == 41) { servchoix }
  if ($did == 42) { f7 }
  if ($did == 43) { confaw }
  if ($did == 44) { if ($dialog(boot).title != $null) { dialog -v boot | halt }
    dialog -m boot boot
  }
  if ($did == 45) { f3 }
  if ($did == 46) { f4 }
  if ($did == 47) { if ($dialog(propos).title != $null) { dialog -v propos | halt }
    dialog -m propos propos
  }
  if ($did == 48) { run http://wushunisroch.free.fr }
  if ($did == 49) { if ($dialog(msgconf).title != $null) { dialog -x msgconf | halt }
    dialog -m msgconf msgconf
  }
}

dialog msgconf {
  title "Configuration MSG divers"
  size -1 -1 300 200
  button "&OK" 100,100 175 100 20,ok
  box "Opérateur" 101,5 97 290 70
  text "PV max dépassé" 1,5 7 80 15
  edit "" 2,85 4 210 20,autohs, %msg.pvmax
  text "Ctcp Ping" 3,5 32 60 15
  edit "" 4,85 29 210 20,autohs, %msg.ctcp.ping
  text "Ctcp Time" 5,5 57 60 15
  edit "" 6,85 54 210 20,autohs, %msg.ctcp.time
  text "Ctcp Finger" 7,5 82 60 15
  edit "" 8,85 79 210 20,autohs, %msg.ctcp.finger
  text "Kick rapide" 9,10 117 60 15
  edit "" 10,85 114 205 20,autohs
  text "Pass popup 'Bloquer #'" 11,10 142 110 15
  edit "" 12,120 139 170 20,autohs, %lockchan
}

on *:dialog:msgconf:init:0:{
  did -a msgconf 2 %msg.pvmax
  did -a msgconf 4 %msg.ctcp.ping
  did -a msgconf 6 %msg.ctcp.time
  did -a msgconf 8 %msg.ctcp.finger
  did -a msgconf 10 %kickdef
  did -a msgconf 12 %lockchan
}

on *:dialog:msgconf:edit:10:{ set %kickdef $did(10) }
