on *:LOAD:   {
  EDsetup
}
on *:UNLOAD:   {
  echo Unloading EDEncoder
}
alias /ed { dialog -dm EDecode EDecode | chanall }
dialog EDecode {
  title "Encoder/Decoder v1.3"
  size -1 -1 157 163
  option dbu
  box "Options", 1, 9 7 135 94
  button "Decode Varible", 2, 22 17 47 12
  list 3, 76 14 63 64, size
  button "Clear List", 4, 22 34 47 12
  button "Refresh List", 5, 22 50 47 12
  button "Add Channel", 6, 22 66 47 12
  box "Encoder/Decoder", 7, 10 108 135 50
  EDit "", 8, 17 121 94 11
  button "Send", 9, 112 121 30 10
  EDit "", 10, 17 139 94 11
  button "Decode", 11, 112 140 31 10
  check "Always On Top", 12, 22 80 50 10
  check "Auto-Decode", 13, 85 80 50 10
  button "OK", 14, 0 0 9 10, ok
}
on *:DIALOG:EDecode:*:*:{
  if ($devent == init) {
    if (%EDTop == 1) { did -c EDecode 12 | dialog -o EDecode EDecode }
    if (%EDTop == 0) { did -u EDecode 12 | dialog -n EDecode EDecode }
    if (%EDAuto == 1) { did -c EDecode 13 }
    if (%EDAuto == 0) { did -u EDecode 13 }
  }
  if ($devent == sclick) {
    if ($did == 2) { set %EDVar $$?="Enter Any Varible: " }
    if ($did == 3) { set %EDChan $did(3).seltext }
    if ($did == 4) { did -r EDecode 3 }
    if ($did == 5) { did -r EDecode 3 | chanall }
    if ($did == 6) { did -a EDecode 3 $$?="Enter A Channel: " }
    if ($did == 9) { set %EDSend $did(8).text | if (%EDSend != $null) { /echo 4 To %EDChan $+ : $encode(%EDSend,%EDVar) 2=4 %EDSend | /msg %EDChan 4 $+ ( $+ 4 $+ %EDTrigger $+ ) $encode($encode(%EDSend,%EDVar),%EDVar2) | /did -r EDecode 8 } }
    if ($did == 11) { set %EDDec $did(10).text | did -r EDecode 8 | did -a EDecode 8 $decode($decode(%EDDec,%EDVar2),%EDVar) }
    if ($did == 12) { set %EDTop $did(12).state | if (%EDTop = 0) { dialog -n EDecode EDecode } | if (%EDTop = 1) { dialog -o EDecode EDecode } }
    if ($did == 13) { set %EDAuto $did(13).state }
  }
}
alias EDOptions { dialog -dmo EDOptions EDOptions }
dialog EDOptions {
  title "EDmith Decoder Options"
  size -1 -1 143 92
  option dbu
  text "Trigger", 2, 6 12 25 8
  EDit "", 3, 13 22 50 10
  check "Auto-Decode", 4, 82 34 50 9
  check "Always On-Top", 5, 82 18 50 10
  link "E-Mail Scripter", 6, 20 76 38 8
  link "mIRC Contact", 7, 20 67 42 8
  box "Contact", 8, 11 59 63 30
  box "Options", 9, 2 2 139 54
  text "Varible", 10, 7 35 25 8
  EDit "", 11, 14 43 50 10
  button "Close", 12, 102 77 37 12, ok
}
on *:DIALOG:EDOptions:*:*:{
  if $devent = init { 
    if (%EDTop == 1) { did -c EDOptions 5 | dialog -o EDOptions EDOptions }
    if (%EDTop == 0) { did -u EDOptions 5 | dialog -n EDOptions EDOptions }
    if (%EDAuto == 1) { did -c EDOptions 4 }
    if (%EDAuto == 0) { did -u EDOptions 4 }
    did -r EDOptions 3
    did -a EDOptions 3 %EDTrigger
    did -r EDOptions 11
    did -a EDOptions 11 %EDVar
  }
  if ($devent == sclick) {
    if ($did == 4) { set %EDAuto $did(4).state }
    if ($did == 5) { set %EDTop $did(5).state }
    if ($did == 6) { run mailto:teenmanlds@yahoo.com }
    if ($did == 7) { server irc.mircx.com | echo 4 My Nick: Lost_and_ConfusED }
  }
  if ($devent == EDit) {
    if ($did == 3) { set %EDTrigger $did(3).text }
    if ($did == 11) { set %EDVar $did(11).text }
  }
}
alias EDsetup { 
  window -a @EDSetup 100 50 450 400
  aline @EDSetup 10** ED Encoder/Decoder Setup **
  aline @EDSetup 10=============================
  aline @EDSetup 13Commands:
  aline @EDSetup 13   /ed - Run the decoder dialog
  aline @EDSetup 13   /EDoptions - Run the options dialog
  aline @EDSetup 13   /EDsetup - Run this setup again
  aline @EDSetup 13   /en - Encode text following /en
  aline @EDSetup 13   /de - Decode text following /de
  aline @EDSetup 10=============================
  aline @EDSetup 7Main Setup:
  aline @EDSetup 7    Trigger for Auto-Decoding Text
  set %EDTrigger BOOM
  aline @EDSetup 7    Trigger: %EDTrigger
  aline @EDSetup 7    Varible for Encoding text
  aline @EDSetup 7     Letter "m" is a popular varible.
  set %EDVar m
  aline @EDSetup 7    Varible: %EDVar
  aline @EDSetup 7    Sub-Varible for Encoding Encoded text
  set %EDVar2 z
  aline @EDSetup 7     Letter "z" is not really popular, but we'll use it.
  aline @EDSetup 10=============================
  aline @EDSetup 9   Scripted By: John Endicott
  aline @EDSetup 4      Contact by joining irc.mircx.com server.
  aline @EDSetup 10=============================
  aline @EDSetup 10** End of ED Encoder/Decoder Setup **
}
alias chanall {
  did -r EDecode 3
  set %i 1
  :next
  set %schan $chan(%i)
  if %schan == $null goto done
  if %schan != $null did -a EDecode 3 %schan
  inc %i
  goto next
  :done
  unset %i
}
menu channel,menubar,status {
  En-Decoder
  .&Open:ed
  .-
  .O&ptions:edoptions
  .-
  .&Setup:edsetup
}
alias en { /echo 4 $encode($encode($$1-,%EDVar),%EDVar2) | /msg $chan ( $+ 4 $+ %EDTrigger $+ ) $encode($encode($$1-,%EDVar),%EDVar2) }
alias de { /echo $chan 9 $decode($decode($$1-,%EDVar2),%EDVar) }
on *:TEXT:*:#:if ($1 = ( $+ 4 $+ %EDTrigger $+ )) { if (%EDAuto = 1) { /echo $chan 4(AUTO) $decode($decode($2-,%EDVar2),%EDVar) 4(AUTO) } }
