**********************************************
VEGETA T v2.0
By uN|x
Official Home Page www.ircvegetascript.cjb.net
E-mail ircvegetascript@email.it
**********************************************

dialog Messaggi {
  size -1 -1 400 355
  title "[ VEGETA T ] v2.0 Messaggi Automatici"
  check "Messaggio per chi entra", 1, 10 10 184 20
  edit "", 2, 10 33 379 25, autohs
  check "Messaggio per chi esce", 3, 10 75 183 20
  edit "", 4, 10 98 379 25, autohs
  check " Messaggio on join", 5, 10 140 147 20
  edit "", 6, 10 163 379 25, autohs
  box "", 8, 4 1 392 65
  box "", 9, 4 66 392 65
  box "", 10, 4 131 392 65
  box "", 11, 1 -2 398 201
  check "Messaggio on OP", 12, 10 208 124 20
  check "Messaggio on DEOP", 13, 10 236 120 20
  check "Messaggio on VOICE", 14, 10 264 120 20
  check "Messaggio on DEVOICE", 15, 10 292 134 20
  edit "", 16, 150 292 238 23, autohs
  edit "", 17, 150 208 238 23, autohs
  edit "", 18, 150 236 238 23, autohs
  edit "", 19, 150 264 238 23, autohs
  box "", 20, 1 196 398 125
  button "Chiudi", 7, 3 326 394 25,ok
}

on *:dialog:messaggi:init:0: {
  if (%messaggioentra == on) { did -c messaggi 1 | did -e messaggi 2 } 
  else { did -b messaggi 2
  }
  if (%messaggioesce == on) { did -c messaggi 3 | did -e messaggi 4 } 
  else { did -b messaggi 4
  }
  if (%messaggiojoin == on) { did -c messaggi 5 | did -e messaggi 6 }
  else { did -b messaggi 6
  }
  if (%messaggioop == on) { did -c messaggi 12 | did -e messaggi 17 }
  else { did -b messaggi 17
  }
  if (%messaggiodeop == on) { did -c messaggi 13 | did -e messaggi 18 }
  else { did -b messaggi 18
  }
  if (%messaggiovoice == on) { did -c messaggi 14 | did -e messaggi 19 }
  else { did -b messaggi 19
  }
  if (%messaggiodevoice == on) { did -c messaggi 15 | did -e messaggi 16 }
  else { did -b messaggi 16
  }
  did -a messaggi 2 %messaggioentrata
  did -a messaggi 4 %messaggiouscita
  did -a messaggi 6 %messaggionjoin
  did -a messaggi 17 %messaggioonop
  did -a messaggi 18 %messaggioondeop
  did -a messaggi 19 %messaggioonvoice
  did -a messaggi 16 %messaggioondevoice
}

on *:dialog:messaggi:sclick:1: {
  if ($did == 1) {
    if ($did(1).state == 1) { set %messaggioentra on | did -e messaggi 2 }
    if ($did(1).state != 1) { set %messaggioentra off | did -b messaggi 2 }
  }
}

on *:dialog:messaggi:sclick:3: {
  if ($did == 3) {
    if ($did(3).state == 1) { set %messaggioesce on | did -e messaggi 4 }
    if ($did(3).state != 1) { set %messaggioesce off | did -b messaggi 4 } 
  }
}

on *:dialog:messaggi:sclick:5: {
  if ($did == 5) {
    if ($did(5).state == 1) { set %messaggiojoin on | did -e messaggi 6 }
    if ($did(5).state != 1) { set %messaggiojoin off | did -b messaggi 6 } 
  }
}

on *:dialog:messaggi:sclick:12: {
  if ($did == 12) {
    if ($did(12).state == 1) { set %messaggioop on | did -e messaggi 17 }
    if ($did(12).state != 1) { set %messaggioop off | did -b messaggi 17 }
  }
}

on *:dialog:messaggi:sclick:13: {
  if ($did == 13) {
    if ($did(13).state == 1) { set %messaggiodeop on | did -e messaggi 18 }
    if ($did(13).state != 1) { set %messaggiodeop off | did -b messaggi 18 }
  }
}

on *:dialog:messaggi:sclick:14: {
  if ($did == 14) {
    if ($did(14).state == 1) { set %messaggiovoice on | did -e messaggi 19 }
    if ($did(14).state != 1) { set %messaggiovoice off | did -b messaggi 19 }
  }
}

on *:dialog:messaggi:sclick:15: {
  if ($did == 15) {
    if ($did(15).state == 1) { set %messaggiodevoice on | did -e messaggi 16 }
    if ($did(15).state != 1) { set %messaggiodevoice off | did -b messaggi 16 }
  }
}

on *:dialog:messaggi:sclick:7: {
}

on *:dialog:messaggi:edit:*: {
  if ($did == 2) { set %messaggioentrata $did(messaggi,2).text }
  if ($did == 4) { set %messaggiouscita $did(messaggi,4).text }
  if ($did == 6) { set %messaggionjoin $did(messaggi,6).text }
  if ($did == 17) { set %messaggioonop $did(messaggi,17).text }
  if ($did == 18) { set %messaggioondeop $did(messaggi,18).text }
  if ($did == 19) { set %messaggioonvoice $did(messaggi,19).text }
  if ($did == 16) { set %messaggioondevoice $did(messaggi,16).text }
}

on 1:JOIN:#:{
  if ( $nick == $me ) {
    if (%messaggiojoin == on) { /msg $chan %messaggionjoin }
  }
  if ( $nick != $me ) {
    if (%messaggioentra == on) { /msg $nick %messaggioentrata }
  }
}

on 1:PART:#:{
  if ($nick != $me) {
    if (%messaggioesce == on) { /msg $nick %messaggiouscita }
  }
}

on 1:OP:#:{
  if ($opnick == $me) {
    if (%messaggioop == on) { /msg $chan $nick %messaggioonop }
  }
}

on 1:DEOP:#:{
  if ($opnick == $me) {
    if (%messaggiodeop == on) { /msg $chan $nick %messaggioondeop }
  }
}

on 1:VOICE:#:{
  if ($vnick == $me) {
    if (%messaggiovoice == on) { /msg $chan $nick %messaggioonvoice }
  }
}

on 1:DEVOICE:#:{
  if ($vnick == $me) {
    if (%messaggiodevoice == on) { /msg $chan $nick %messaggioondevoice }
  }
}

alias messaggi {
  /dialog -m messaggi messaggi
}
