dialog Remote.Creator {
  title "Remote Creator"
  size -1 -1 317 228
  option dbu
  combo 1, 9 13 80 55, size drop
  box "Crea un Remote", 2, 4 4 309 221
  edit "", 3, 175 23 124 60, read multi return hsbar vsbar
  text "Visual. Remote:", 4, 212 12 42 8
  button "Scegli un Evento", 5, 93 13 49 10
  radio "", 6, 102 39 10 10
  radio "", 7, 102 52 10 10
  radio "", 8, 102 64 10 10
  text "Chan", 60, 112 39 50 10
  text "PM (Query)", 70, 112 52 50 10
  text "Chan/PM", 80, 112 64 66 10
  edit "", 9, 10 98 106 10, autohs
  text "", 10, 10 79 105 17
  text "", 11, 153 114 146 78
  button "Setta parola", 12, 10 111 37 10
  button "Invia a Clipboard", 13, 209 86 49 10
  button "Setta Nick", 14, 10 160 37 10
  edit "", 15, 10 146 106 10, autohs
  text "", 16, 10 124 106 20
  button "?", 17, 146 13 7 10
  text "", 18, 9 178 106 17
  button "Esci", 19, 266 204 42 12, ok
  edit "", 20, 9 197 106 10, autohs
  button "Setta Comando", 21, 10 211 37 10
  box "Info/Help", 22, 146 104 159 94
  button "Salta", 23, 79 160 37 10
  text "Attiva in:", 24, 98 29 47 8
}


ON *:DIALOG:remote.creator:*:*: {

  if ($devent == edit) {

    if ($did == 20) {
      if (!$did(20)) { did -b $xrem 21 }
      if ($did(20)) { did -e $xrem 21 }
    }
    if ($did == 15) {
      if (!$did(15)) { did -b $xrem 14 }
      if ($did(15)) { did -e $xrem 14 }
    }
    if ($did == 9) {
      if (!$did(9)) { did -b $xrem 12 }
      if ($did(9)) { did -e $xrem 12 }
    }
  }


  if ($devent == Init) {
    dll $mdx SetMircVersion $version
    dll $mdx MarkDialog $dname $dialog($dname).hwnd
    if (%unome == 1) {
      dll $mdx SetDialog $dname bgcolor $rgb(0,72,170)
      dll $mdx  SetColor $dname 1,4,5,6,7,8,60,70,80,9,10,11,16,18,24 background $rgb(0,72,170)
      dll $mdx  SetColor $dname 1,4,5,6,7,8,60,70,80,9,10,11,16,18,24 textbg $rgb(0,72,170)
      dll $mdx  SetColor 1,3,4,5,6,7,8,60,70,80,9,10,11,15,16,18,20,24 text $rgb(255,255,255)
      dll $mdx  SetColor $dname  3,9,15,20 background $rgb(0,0,0)
      dll $mdx  SetColor $dname  3,9,15,20 textbg $rgb(0,0,0)
      dll $mdx  SetColor $dname 12,13,14,17,19,21,23 background $rgb(0,0,0)
      dll $mdx SetColor $dname 2,22 background $rgb(255,134,0)
    }
    if (%unome == 2) {
      dll $mdx SetDialog $dname bgcolor $rgb(0,0,95)
      dll $mdx  SetColor $dname 1,4,5,6,7,8,60,70,80,9,10,11,16,18,24 background $rgb(0,0,95)
      dll $mdx  SetColor $dname 1,4,5,6,7,8,60,70,80,9,10,11,16,18,24 textbg $rgb(0,0,95)
      dll $mdx  SetColor 1,3,4,5,6,7,8,60,70,80,9,10,11,15,16,18,20,24 text $rgb(255,255,255)
      dll $mdx  SetColor $dname  3,9,15,20 background $rgb(0,0,0)
      dll $mdx  SetColor $dname  3,9,15,20 textbg $rgb(0,0,0)
      dll $mdx  SetColor $dname 12,13,14,17,19,21,23 background $rgb(0,0,0)
      dll $mdx SetColor $dname 2,22 background $rgb(196,196,196)
    }
    did -b $xrem 5,6-9,12-15,17,20,21
    did -a $xrem 1 On Action Event
    did -a $xrem 1 On Input Event
    did -a $xrem 1 On Mode Event
    did -a $xrem 1 On Nick Event
    did -a $xrem 1 On Notice Event
    did -a $xrem 1 On Op Event
    did -a $xrem 1 On Deop Event
    did -a $xrem 1 On Voice Event
    did -a $xrem 1 On Devoice Event
    did -a $xrem 1 On Halfop Event
    did -a $xrem 1 On Dehalfop Event
    did -a $xrem 1 On Text Event
    did -a $xrem 1 On Join Event
    did -a $xrem 1 On Part Event
    did -a $xrem 1 On Quit Event
    did -a $xrem 1 On Ban Event
    did -a $xrem 1 On Unban Event
    did -a $xrem 1 On Kick Event
    did -a $xrem 1 On Topic Event
    did -b $xrem 23
  }

  if ($devent == Sclick) {

    if ($did == 1) {

      did -e $xrem 5,6,7,8,17
      did -b $xrem 1

      if ($wrd == Action) {
        did -ra $xrem 3 on *:ACTION:*:
        did -a $xrem 10 Word for Script to activate on:
        did -a $xrem 11 text matches if text contains only this word $crlf text* matches if text starts with this word $crlf *text matches if text ends with this word $crlf *text* matches if text contains this word anywhere $crlf $crlf The On Action event triggers when someone uses '/me'
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Input) {
        did -ra $xrem 3 on *:INPUT:
        did -a $xrem 10 Word for Script to activate on:
        did -a $xrem 11 text matches if text contains only this word $crlf text* matches if text starts with this word $crlf *text matches if text ends with this word $crlf *text* matches if text contains this word anywhere $crlf $crlf The on INPUT event triggers when you enter text in an editbox and press enter.
      }
      if ($wrd == Mode) {
        did -ra $xrem 3 on *:MODE:
        did -b $xrem 7,8
        did -a $xrem 10 Word for Script to activate on:
        did -a $xrem 11 text matches if text contains only this word $crlf text* matches if text starts with this word $crlf *text matches if text ends with this word $crlf *text* matches if text contains this word anywhere $crlf $crlf NOTE: use the mode, example: +m = m , +s = s , $crlf -s = -s $crlf $crlf The on MODE event triggers when a user changes a channel mode.
        did -a $xrem 16 set a specific nick for script to activate on, if you would like for this script to activate for everyone, please choose "Skip"
      }
      if ($wrd == Nick) {
        did -ra $xrem 3 On *:NICK: $chr(123)
        did -b $xrem 6-9
        did -c $xrem 6
        did -e $xrem 15,23
        did -a $xrem 11 The on NICK event triggers when a user changes nickname while on the same channel as you.
        did -a $xrem 16 set a specific nick for script to activate on, if you would like for this script to activate for everyone, please choose "Skip"
      }
      if ($wrd == Notice) {
        did -ra $xrem 3 On *:NOTICE:*:
        did -e $xrem 6-8
        did -a $xrem 11 text matches if text contains only this word $crlf text* matches if text starts with this word $crlf *text matches if text ends with this word $crlf *text* matches if text contains this word anywhere $crlf $crlf The on NOTICE event triggers when someone uses a '/notice'.
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }

      if ($wrd == Op) {
        did -ra $xrem 3 On *:OP:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -e $xrem 15,23
        did -a $xrem 11 The on OP events trigger when a user on a channel is opped.
        did -a $xrem 16 set a specific nick for script to activate on, if you would like for this script to activate for everyone, please choose "Skip"
      }
      if ($wrd == Deop) {
        did -ra $xrem 3 On *:DEOP:#: $chr(123)
        did -b $xrem 6-8
        did -a $xrem 11 The on DEOP events trigger when a user on a channel is deopped.
        did -e $xrem 15,23
        did -c $xrem 6
        did -a $xrem 16 set a specific nick for script to activate on, if you would like for this script to activate for everyone, please choose "Skip"
      }
      if ($wrd == Dehalfop) {
        did -ra $xrem 3 On *:DEHELP:#: $chr(123)
        did -b $xrem 6-8
        did -a $xrem 11 The on DEHELP events trigger when a user on a channel is dehalfopped.
        did -e $xrem 15,23
        did -c $xrem 6
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == halfop) {
        did -ra $xrem 3 On *:HELP:#: $chr(123)
        did -b $xrem 6-8
        did -a $xrem 11 The on HELP events trigger when a user on a channel is halfopped.
        did -e $xrem 15,23
        did -c $xrem 6
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Voice) {
        did -ra $xrem 3 On *:VOICE:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on VOICE events trigger when a user on a channel is voice.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == devoice) {
        did -ra $xrem 3 On *:DEVOICE:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on DEVOICE events trigger when a user on a channel is devoiced.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Text) {
        did -ra $xrem 3 On *:TEXT:*:
        did -e $xrem 6-8
        did -a $xrem 11 text matches if text contains only this word $crlf text* matches if text starts with this word $crlf *text matches if text ends with this word $crlf *text* matches if text contains this word anywhere $crlf $crlf The on TEXT event triggers when you receive private and/or channel messages.
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Join) {
        did -ra $xrem 3 On *:JOIN:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on JOIN events trigger when a user joins a channel.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == part) {
        did -ra $xrem 3 On *:PART:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on JOIN events trigger when a user parts a channel.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Quit) {
        did -ra $xrem 3 On *:QUIT: $chr(123)
        did -b $xrem 6-8
        did -a $xrem 11 The on QUIT event triggers when a user quits IRC while on the same channel as you.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == BAN) {
        did -ra $xrem 3 On *:BAN:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on BAN events trigger when a user on a channel is banned.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Unban) {
        did -ra $xrem 3 On *:UNBAN:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on UNBAN events trigger when a user on a channel is unbanned.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == Kick) {
        did -ra $xrem 3 On *:KICK:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on KICK event triggers when a user is kicked from a channel.
        did -e $xrem 15,23
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
      if ($wrd == topic) {
        did -ra $xrem 3 On *:TOPIC:#: $chr(123)
        did -b $xrem 6-8
        did -c $xrem 6
        did -a $xrem 11 The on TOPIC event triggers when a user changes a channel topic.
        did -e $xrem 9
        did -a $xrem 10 set a specific topic for the script to activate on.
        did -a $xrem 16 Set a specific nick for the script to activate on, if you want this script to work for everyone, click on 'Skip'
      }
    }


    if ($did == 6) {
      did -a $xrem 3 #: $chr(123) | did -b $xrem 6-8 | did -e $xrem 9 
      if ($wrd == Nick) {
        did -b $xrem 9
        did -e $xrem 15
      }
    }

    if ($did == 7) { did -a $xrem 3 ?: $chr(123) | did -b $xrem 6-8 | did -e $xrem 9 }



    if ($did == 8) { did -a $xrem 3 *: $chr(123) | did -b $xrem 6-8 | did -e $xrem 9 }




    if ($did == 12) {
      did -a $xrem 3 $crlf if ( $+ $did($xrem,9) iswm $!1- $+ ) $chr(123)
      did -b $xrem 9,12 
      did -e $xrem 15,23
    }


    if ($did == 14) {
      did -a $xrem 3 $crlf if ( $+ $!nick == $did($xrem,15) $+ ) $chr(123)
      did -b $xrem 14,15,23
      did -e $xrem 20
      did -a $xrem 11 $crlf Set a command to do, Example 'msg $!nick Hi' $crlf $crlf use $chr(124) as a separator if you would like to perform more than one command. $crlf $crlf Example: $crlf msg $!nick Hi $chr(124) msg $!chan $!nick just joined the channel.
    }


    if ($did == 13) {
      var %x = 0
      clipboard
      while (%x < $did($xrem,3).lines) {
        inc %x
        clipboard -a $crlf $did($xrem,3,%x)
      }
    }


    if ($did == 21) {
      %xbrackets = $did($xrem,3).lines
      did -b $xrem 20,21
      did -a $xrem 3 $crlf $did($xrem,20) $str($crlf $chr(125),%xbrackets)
      did -e $xrem 13
      did -a $xrem 11 You will have to load this into Remotes (ALT + R) for this script to activate.
    }

    if ($did == 23) {
      did -e $xrem 20
      did -b $xrem 14,15,23
    }


    if ($did == 17) {
      help ON $wrd
    }


    if ($did == 5) {
      did -u $xrem 6-8
      did -e $xrem 1,6,7,8
      did -b $xrem 5,6,7,8,9,12,14,15,17,20,23
      did -r $xrem 3,9,10,11,15,20
    }
  }
}



alias xrem { return Remote.Creator }
alias wrd { return $gettok($did($dname,1),2,32) }
alias remote.creator { dialog -mdro Remote.Creator Remote.creator |  if ( %cc181p == on ) { $tunder TDDialog $dialog(remote.creator).hwnd > 2 } }

on *:JOIN:#:{
  if ($nick != $me) && (%logs == on) {
    set %nick $nick
    set %mask $address($nick,2)
    set %nick2 $readini txt\profili.ini %mask nick
    set %mask2 $readini txt\profili.ini %mask mask
    if (%mask == %mask2) {
      if (%nick != %nick2) {
        beep
        $iif(!$window(@log),window -z @log)
        aline -hp @log 7-3( $- $time $+ )7-3(7 $+ $chan $+ 3)7-8 $nick ha joinato in precedenza con il nick8 %nick2
      }
    }
    if (!$ini(txt\profili.ini,mask)) hashtable
  }
  set %rbg.c $chan
  if $nick = $me { .enable #renklenen | nick.rengle }
  else { cline %rengli.328 $chan $nick | nick.rengle }
  if ($nick == $me) && (%icon.nl != $null) { nlust.chan $chan }
  if (%peak.chan != $null) && ($chan == %peak.chan) && ($nick(%peak.chan,0) > %peak.users) {
    set %peak.users $nick(%peak.chan,0)
    set %peak.data $date(dd/mm/yyyy)
    set %peak.ora $time(HH:nn:ss)
    if (%peak.peak == on) && (%peak.mexpeak != $null) msg %peak.chan [ [ %peak.mexpeak ] ]
  }
  if ($nick = $me && %cc2 == on ) { if (%unome == 1) { timer 1 3 msg $chan %sal1 } | else { timer 1 3 msg $chan %sal12 } | halt }
  if ($nick != $me && %cc3 == on )  { if (%unome == 1) { timer 1 2 notice $nick 4 #  %joi1 %scriptlogo } | else { timer 1 2 notice $nick 4 #  %joi12  %scriptlogo | halt } }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autv1 = on ) { /mode # +v $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %auth = on ) { /mode # +h $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %auto = on ) { /mode # +o $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autp = on ) { /mode # +a $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autw = on ) { /mode # +q $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autdv = on ) { /mode # -v $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autdh = on ) { /mode # -h $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autdo = on ) { /mode # -o $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autdp = on ) { /mode # -a $nick }
  if ( %attautg == on ) && ( $chan == %gradchan1 ) && ( %autdw = on ) { /mode # -q $nick }
  if ($ialchan($address($nick,2),$chan,0) >= 2 ) { set %tmp.cloni1 0
    :ciclo1 | inc %tmp.cloni1
    if ($ialchan($address($nick,2),$chan,%tmp.cloni1)) { set %tmp.cloni2 %tmp.cloni2 $ialchan($address($nick,2),$chan,%tmp.cloni1).nick }
    if (%tmp.cloni1 < $ialchan($address($nick,2),$chan,0)) goto ciclo1
    if (%unome == 1) { echo $chan 3 $+ $timestamp 11* [4Clonazzi11]7:8 %tmp.cloni2 su8 $chan 7(8 $+ $address($nick,2) $+ 7) | if (%c10 == on ) splay sounds\join.wav  }
    if (%unome == 2) { echo $chan 3 $+ $timestamp 3* [4Clonazzi3]:8 %tmp.cloni2 su8 $chan 7(8 $+ $address($nick,2) $+ 7) | if (%c10 == on ) splay sounds\join.wav  }
    unset %tmp.cloni*
  }
}
alias hashtable {
  if (!$hget(profilo)) { hmake profilo 5 }
  hadd profilo nick %nick
  hadd profilo mask %mask
  hsave -sai profilo txt\profili.ini $hget(profilo,mask)
  hfree profilo
}
