Highlight Script — File Browser

HighlightScriptv1.0 / HighlightScriptv1.0 / highlight.mrc

highlight.mrc — 27.74 KB — Download this file

menu * {
  -
  &Highlight $ver
  .&Setup:hdialog highlight
  .&Settings: hdialog highlight | did -f highlight 998
  .&Advanced Settings: hdialog highlight | did -f highlight 999
  .-
  .&Add/Delete...
  ..&... Words:hdialog highlight_add
  ..&... Networks/Chans:hdialog highlight_edit
  .&Script ( $+ $highlight-status $+ ):
  ..$iif($highlight-status == on,$style(3)) o&n:highadd status on
  ..$iif($highlight-status == off,$style(3)) o&ff:highadd status off
  .-
  .$iif(!$isfile($readme),$style(2)) &Readme:run $readme
  .&About: hdialog highlight-about
  .&Unload: unload.highlight
}

dialog highlight {
  title "Highlight"
  size -1 -1 164 135
  option dbu

  tab "Highlight", 997, 3 1 155 115
  check "Enable ", 1, 8 18 63 10, tab 997
  text "Network:", 500, 9 30 22 8, tab 997
  combo 2, 8 40 60 40, tab 997 size drop
  text "Channel:", 501, 8 54 22 8, tab 997
  combo 3, 8 65 60 46, tab 997 size drop
  text "Highlight words:", 502, 74 18 39 8, tab 997
  edit "", 4, 73 25 63 10, tab 997 autohs
  button "+", 6, 137 26 13 10, tab 997
  button "-", 7, 137 37 13 10, tab 997
  list 5, 73 35 63 76, tab 997 size

  tab "Settings", 998
  check "Play Sound on Highlight", 8, 8 20 66 10, tab 998
  edit "", 9, 8 31 60 10, tab 998 autohs
  button "...", 10, 69 31 13 10, tab 998
  check "Flash", 11, 91 20 22 10, tab 998
  edit "", 12, 114 21 14 9, tab 998 limit 2
  text "times", 503, 130 22 13 8, tab 998
  text "Msg:", 504, 92 33 12 8, tab 998
  edit "", 13, 105 32 47 9, tab 998 autohs
  check "Color text in:", 14, 9 49 41 10, tab 998
  combo 15, 51 48 30 9, tab 998 drop
  ;edit "", 15, 51 50 13 9, tab 998 limit 2
  check "Notify by echo", 16, 9 59 45 10, tab 998
  check "Echo in active", 17, 17 69 43 10, tab 998
  check "Echo in target", 18, 17 79 43 10, tab 998
  text "Echo msg:", 505, 69 60 25 8, tab 998
  edit "", 19, 69 69 80 10, tab 998 autohs
  text "$nick $target $date etc.", 506, 75 80 69 8, tab 998
  box "", 507, 88 13 66 33, tab 998
  box "", 508, 6 13 83 33, tab 998
  box "", 509, 6 42 148 49, tab 998
  check "Log on Highlight", 20, 8 92 50 10, tab 998
  edit "", 21, 8 102 60 10, tab 998 autohs
  button "...", 22, 69 102 13 10, tab 998
  check "Strip text", 23, 87 93 33 10, tab 998
  check "Prefixed nick (@|%|+)", 24, 87 103 65 10, tab 998
  box "", 510, 6 87 148 27, tab 998

  tab "Advanced Settings", 999
  box "", 511, 86 14 69 56, tab 999
  box "", 512, 6 91 81 21, tab 999
  box "", 513, 6 14 81 35, tab 999
  box "Events", 514, 6 45 81 50, tab 999
  check "Place in editbox (if empty)", 25, 8 20 72 10, tab 999
  edit "", 26, 8 31 75 10, tab 999 autohs
  text "If you enable an event the script will trigger for that event", 515, 9 53 76 14, tab 999
  check "on TEXT", 27, 9 70 29 10, tab 999
  check "on NOTICE", 28, 46 70 37 10, tab 999
  check "on ACTION", 29, 46 82 37 10, tab 999
  check "on CHAT", 30, 9 82 30 10, tab 999
  check "Match only whole words", 31, 9 98 67 10, tab 999
  check "Case Sensitive", 32, 90 19 50 10, tab 999
  check "Ctrl Code Sensitive", 33, 90 31 55 11, tab 999
  check "Call Alias on Highlight", 34, 90 43 60 10, tab 999
  edit "", 35, 90 55 60 10, tab 999 autohs

  menu "File", 399
  menu "Add/Delete...", 405, 399
  item "... Words", 400, 405
  item "... Networks/Chans", 401, 405
  item break, 450, 399
  item "About", 402, 399
  item break, 451, 399
  item "Unload", 403, 399
  item "Exit", 404, 399

  button "Ok", 98, 3 119 30 12, ok
  button "Cancel", 99, 42 119 30 12, cancel
  button "About", 100, 127 119 30 12

}

dialog highlight-about {
  title "About"
  size -1 -1 91 50
  option dbu
  text "by SSJ4_Son_Goku", 1, 20 9 46 8, center
  text "Highlight v1.0", 2, 28 1 33 8
  link "songoku1@gmail.com", 3, 21 27 67 8
  text "Email:", 4, 3 27 14 8
  text "Made on June 6, 2004 ", 5, 23 17 60 8
  button "Ok", 7, 27 37 37 12, ok
}

dialog highlight_add {
  title "Add/Delete Words"
  size -1 -1 154 99
  option dbu
  text "Network:", 500, 87 5 22 8
  combo 1, 87 15 60 40, size drop
  text "Press Shift or Control and left-click all the channels you want to add/delete the following word(s) too. To add/delete several words seperate them with a comma.", 501, 4 5 78 40
  text "Channels:", 502, 87 40 24 8
  list 2, 87 49 60 45, size extsel
  edit "", 3, 4 57 77 10, autohs
  button "Add", 4, 3 69 34 10
  button "Delete", 5, 46 69 34 10
  text "Words:", 503, 4 47 18 8
  button "Ok", 6, 3 84 34 10, ok
  button "Cancel", 7, 46 84 34 10, cancel
}


dialog highlight_edit {
  title "Add/Delete Networks/Chans"
  size -1 -1 133 122
  option dbu
  text "Networks:", 501, 4 4 25 8
  list 1, 4 14 57 30, size
  ;combo 1, 4 14 57 30, size drop
  button "Add Network", 2, 4 46 57 12
  button "Delete Network", 3, 4 63 57 12
  text "Chans:", 502, 68 4 17 8
  list 4, 68 14 60 43, size
  ;combo 4, 68 14 60 43, size drop
  button "Add Chan", 5, 68 59 60 12
  button "Delete Chan", 6, 68 76 60 12
  text "Here you can add or delete any networks or chans you wish to add/delete for future purposes.", 500, 4 82 57 36
  button Ok, 998, 65 106 30 12, ok
  button "Cancel", 999, 99 106 30 12, cancel
}

alias -l load_networks {
  var %dname = highlight
  did -r %dname 2-5
  didtok %dname 2 32 $hightable
  did -c %dname 2 1
  var %i = 1 | while (%i <= $did(%dname,2).lines) { if ($did(%dname,2,%i) == $network) { did -c %dname 2 %i | break } | inc %i }
  if (!$did(%dname,2).seltext) did -c %dname 2 1
  var %network = $did(%dname,2).seltext
  didtok %dname 3 32 $highchan(%network)
  did -c %dname 3 1
  var %chan = $did(%dname,3).seltext
  did -o %dname 1 1 Enable %network
  if ($highget(%network,status) == on) did -c %dname 1
  else change.items disable
  if ($highget(%network,%chan)) {
    didtok %dname 5 149 $v1
    did -c %dname 5 1 
    did -a %dname 4 $did(%dname,5).seltext 
  }
}
on *:DIALOG:highlight:init:*:{

  ; Highlight

  dll $+(",$scriptdir,ColorCombo.dll,") COMBO $dname 15
  ; Networks and Channels
  /*
  didtok $dname 2 32 $hightable
  did -c $dname 2 1
  var %i = 1 | while (%i <= $did(2).lines) { if ($did(2,%i) == $network) { did -c $dname 2 %i | break } | inc %i }
  didtok $dname 3 32 $highchan($did(2).seltext)
  did -c $dname 3 1
  var %network = $did(2).seltext,%chan = $did(3).seltext
  did -o $dname 1 1 Enable %network
  ; Check enable <network>
  if ($highget(%network,status) == on) did -c $dname 1
  else change.items disable
  if ($highget(%network,%chan)) { didtok $dname 5 149 $v1 | did -c $dname 5 1 | did -a $dname 4 $did(5).seltext }
  */
  load_networks

  ; Settings

  ; Sound
  if ($regex(sound,$highget(sound),^(on|off)•(.*)$)) {
    if ($regml(sound,1) == on) did -c $dname 8 
    else change.d 8 9 10
    var %file = $rrep($regml(sound,2))
    did -ra $dname 9 $nopath(%file)
  }

  ; Flash
  if ($regex(flash,$highget(flash),^(on|off)•([0-9]+)•(.*)$)) {
    if ($regml(flash,1) == on) did -c $dname 11
    else change.d 11 12,13
    did -ra $dname 12 $regml(flash,2)
    if ($regml(flash,3)) did -ra $dname 13 $rrep($v1)
  }

  ; Color text
  if ($regex(colortext,$highget(colortext),^(on|off)•([0-9]+)$)) {
    if ($regml(colortext,1) == on) did -c $dname 14
    else change.d 14 15
    did -c $dname 15 $regml(colortext,2)
  }

  ; Echo
  if ($regex(echo,$highget(echo),^(on|off)•(on|off)•(on|off)•(.*)$)) { 
    if ($regml(echo,1) == on) did -c $dname 16
    else change.d 16 19 17,18
    if ($regml(echo,2) == on) did -c $dname 17
    if ($regml(echo,3) == on) did -c $dname 18
    did -ra $dname 19 $rrep($regml(echo,4))
  }

  ; Logs
  if ($regex(logs,$highget(logs),^(on|off)•(on|off)•(on|off)•(.*)$)) {
    if ($regml(logs,1) == on) did -c $dname 20
    else change.d 20 21 22,23,24
    var %file = $rrep($regml(logs,4))
    if ($right(%file,3) != txt) {
      ;var % [ $+ [ $ticks ] ] $input(The specified log file $+($chr(40),%file,$chr(41)) name is not a .txt file. Please specify a .txt file.,w,Invalid File)
      did -u $dname 20
      did -ra $dname 21 Invalid Path
    }
    else did -ra $dname 21 $nopath(%file)
    if ($regml(logs,2) == on) did -c $dname 23
    if ($regml(logs,3) == on) did -c $dname 24
  }

  ; Advanced Settings

  ; Fill editbox
  if ($regex(editbox,$$highget(editbox),^(on|off)•(.*)$)) {
    if ($regml(editbox,1) == on) did -c $dname 25
    else change.d 25 26
    did -ra $dname 26 $rrep($regml(editbox,2))
  }

  ; Events
  /*
  if ($regex(events,$highget(events),^(on|off)•(on|off)•(on|off)•(on|off)$)) {
    if ($regml(events,1) == on) did -c $dname 27
    if ($regml(events,2) == on) did -c $dname 28
    if ($regml(events,3) == on) did -c $dname 29
    if ($regml(events,4) == on) did -c $dname 30
  }
  */
  if ($group(#highlight.text) == on) did -c $dname 27
  if ($group(#highlight.notice) == on) did -c $dname 28
  if ($group(#highlight.action) == on) did -c $dname 29
  if ($group(#highlight.chat) == on) did -c $dname 30

  ; Match whole words
  if ($highget(matchwholewords) == on) did -c $dname 31
  ; Case sensitive match
  if ($highget(case) == on) did -c $dname 32
  ; Control Code sensitive
  if ($highget(ctrlcode) == on) did -c $dname 33
  ; Alias
  if ($regex(alias,$highget(alias),^(on|off)•(.*)$)) {
    if ($regml(alias,1) == on) did -c $dname 34
    else change.d 34 35
    did -ra $dname 35 $rrep($regml(alias,2))
  }
}

on *:DIALOG:highlight:sclick:*:{
  var %network = $did(2).seltext,%chan = $did(3).seltext
  if ($did == 1) {
    if ($did(1).state) { change.items enable | highadd %network status on }
    else { change.items disable | highadd %network status off }
  }
  if ($did == 2) { 
    var %network = $did(2).seltext
    did -o $dname 1 1 Enable %network
    did -r $dname 4,5
    load.chans %network 3
    if ($highget(%network,status) == on) { did -c $dname 1 | change.items enable }
    else { did -u $dname 1 | change.items disable }
  }
  if ($did == 3) {
    var %chan = $did(3).seltext
    did -r $dname 4,5
    if ($highget(%network,%chan)) { didtok $dname 5 149 $v1 | did -r $dname 4 }
    did -c $dname 5 1
    did -a $dname 4 $did(5).seltext
  }
  if ($did == 5) { did -ra $dname 4 $did(5).seltext }
  if ($did == 6)  && ($did(4)) {
    var %text = $did(4),%words = $highget(%network,%chan)
    if ($istok(%words,%text,149)) { var % [ $+ [ $ticks ] ] $input(That word/term is already listed for that channel.,w,Double-term) | return }
    did -a $dname 5 %text
    did -c $dname 5 $did(5).lines
    did -rf $dname 4
    highadd %network %chan $addtok(%words,%text,149)
  }
  if ($did == 7) && ($did(4)) {
    var %text = $did(4),%words = $highget(%network,%chan),%did = $iif($did(5).sel,$v1,1)
    highlight.remove %network %chan %text
    ; If last word is gone, remove #channel
    if (!$highget(%network,%chan)) {
      var %l = $did(3).sel
      filter -xcio $dname 3 $dname 3 %chan
      did -c $dname 3 $iif($did(5,%l),%l,$calc(%l -1))
      var %chan = $did(3)
      did -r $dname 4,5
      didtok $dname 5 149 $highget(%network,%chan)
      did -c $dname 5 1
      did -a $dname 4 $did(5).seltext
      ; If all Channels are gone, remove Network
      if (!$did(3).lines) {
        var %l = $did(2).sel
        filter -xcio $dname 2 $dname 2 %network
        hdel highlight $+(%network,$chr(44),status)
        load_networks
      }
    }
    else {
      filter -xcio $dname 5 $dname 5 %text
      did -c $dname 5 $iif($did(5,%did),%did,$calc(%did -1))
      did -ra $dname 4 $did(5).seltext
    }
  }
  if ($did == 8) change.d $did 9 10
  if ($did == 10) {
    var %file = $sfile($mircdir*.mp3,Choose a sound file,Done)
    if (%file) { highadd sound $+($oo(8),$chr(149),$rep(%file)) | did -ra $dname 9 $nopath(%file) }
  }
  if ($did == 11) change.d $did 12,13
  if ($did == 14) change.d $did 15
  if ($did == 16) change.d $did 19 17,18
  if ($did == 20) change.d $did 21 22,23,24
  if ($did == 22) {
    var %file = $sfile($mircdir*.txt,Choose a log file,Done)
    var %20 = $oo(20),%23 = $oo(23),%24 = $oo(24)
    if (%file) { highadd logs $+(%20,•,%23,•,%24,•,$rep(%file)) | did -ra $dname 21 $nopath(%file) }
  }
  if ($did == 25) change.d $did 26
  if ($did == 34) change.d $did 35
  if ($did == 98) save
  if ($did == 100) hdialog highlight-about
}

on *:DIALOG:highlight:dclick:5:{ hdialog highlight_add | did -a highlight_add 3 $did(5).seltext }

on *:DIALOG:highlight:menu:*:{
  if ($did == 400) hdialog highlight_add
  if ($did == 401) hdialog highlight_edit
  if ($did == 402) hdialog highlight-about
  if ($did == 403) unload.highlight
  if ($did == 404) dialog -x $dname
}

on *:DIALOG:highlight_add:init:*:{
  didtok $dname 1 32 $hightable
  did -c $dname 1 1
  didtok $dname 2 32 $highchan($did(1).seltext)
  did -f $dname 3
  did -c $dname 2 1
}
on *:DIALOG:highlight_add:sclick:*:{
  if ($did isnum 4-5) && ($did(3)) && ($did(2).seltext) {
    var %i = 1,%r | while (%i <= $did(2,0).sel) { var %r = $addtok(%r,$did(2,$did(2,%i).sel),44) | inc %i }
    if ($did == 4) var %action = highlight.add
    else var %action = highlight.remove
    %action $did(1).seltext %r $did(3)
    if ($dialog(highlight)) {
      var %network = $did(1).seltext,%chan = $did(2).seltext
      if ($did(highlight,2) == %network) && ($did(highlight,3) == %chan) {
        if ($did == 4) didtok highlight 5 44 $did(3)
        else { 
          var %text = $did(3),%i
          if ($numtok(%text,44) > 1) {
            var %i = 1
            while ($gettok(%text,%i,44)) {
              filter -xcio highlight 5 highlight 5 $v1
              inc %i
            }
          }
          filter -xcio highlight 5 highlight 5 $did(3)
          did -c highlight 5 1 
        }
      }
    }
    var %x = $input(Successfully $iif($did == 4,added,deleted) $qt($did(3)) $iif($did == 4,to,from) $qt(%r) $iif($did != 4,if possible),io)
  }
  if ($did == 1) {
    did -r $dname 2
    didtok $dname 2 32 $highchan($did(1).seltext)
    did -c $dname 2 1
  }
}

on *:DIALOG:highlight_edit:init:*:{
  didtok $dname 1 32 $hightable
  did -c $dname 1 1
  if ($did(1).seltext) didtok $dname 4 32 $highchan($did(1).seltext)
  did -c $dname 4 1
}
on *:DIALOG:highlight_edit:sclick:*:{
  if ($did == 1) {
    did -r $dname 4
    didtok $dname 4 32 $highchan($did(1).seltext)
    did -c $dname 4 1
  }
  if ($did == 2) {
    var %input = $?="Put network name to add below."
    if (%input) {
      highadd %input status on
      did -a $dname 1 %input
      did -c $dname 1 $did(1).lines
      did -r $dname 4
      if ($highchan(%input)) didtok $dname 4 32 $v1
      if ($dialog(highlight)) did -a highlight 2 %input
      if ($dialog(highlight_add)) did -a highlight_add 1 %input
    }
  }
  if ($did == 3) && ($did(1).seltext) {
    if ($input(Delete network $did(1).seltext ?,q,Delete $did(1).seltext)) {
      var %network = $did(1).seltext,%line = $did(1).sel
      hdel -w highlight $+(%network,$chr(44),*)
      filter -cxio $dname 1 $dname 1 %network
      did -c $dname 1 $iif($did(1,%line),%line,$calc(%line -1))
      did -r $dname 4
      if ($highchan($did(1).seltext)) didtok $dname 4 32 $highchan($did(1).seltext)
      if ($dialog(highlight)) load_networks
      if ($dialog(highlight_add)) {
        filter -xcio highlight_add 1 highlight_add 1 %network
        did -c highlight_add 1 1
        if ($did(highlight_add,1).seltext) {
          did -r highlight_add 2
          didtok highlight_add 2 32 $highchan($did(highlight_add,1).seltext)
          did -c highlight_add 2 1
        }
      }
    }
  }
  if ($did == 5) {
    var %input = $?="Put Channel name to add below."
    if (%input) { 
      highadd $did(1).seltext %input  $!me
      did -a $dname 4 %input 
      did -c $dname 4 $did(4).lines
      if ($dialog(highlight_add)) && ($did(highlight_add,1).seltext == $did(1).seltext)  did -a highlight_add 2 %input
      if ($dialog(highlight)) && ($did(highlight,2).seltext == $did(1).seltext) did -a highlight 3 %input
    }
  }
  if ($did == 6) {
    if ($input(Delete $did(4).seltext $+ ?,q,Delete $did(4).seltext)) {
      var %input = $did(4).seltext,%line = $did(4).sel,%network = $did(1).seltext
      highdel %network %input
      if (!$highchan(%network)) {
        var %line2 = $did(1).sel
        filter -xcio $dname 1 $dname 1 %network
        hdel -w highlight $+(%network,$chr(44),*)
        did -c $dname 1 $iif($did(1,%line2),%line2,$calc(%line2 -1))
        if ($highchan($did(1).seltext)) didtok $dname 4 32 $highchan($did(1).seltext)
        if ($dialog(highlight)) load_networks
        if ($dialog(highlight_add)) {
          filter -xcio highlight_add 1 highlight_add 1 %network
          did -c highlight_add 1 1
          if ($did(highlight_add,1).seltext) {
            did -r highlight_add 2
            didtok highlight_add 2 32 $highchan($did(highlight_add,1).seltext)
            did -c highlight_add 2 1
          }
        }
      }
      filter -xcio $dname 4 $dname 4 %input
      did -c $dname 4 $iif($did(4,%line),%line,$calc(%line -1))
      if ($dialog(highlight)) {
        filter -xcio highlight 3 highlight 3 %input
        did -c highlight 3 1
        var %chan = $did(highlight,3).seltext
        if ($highget(%network,%chan)) {
          didtok highlight 5 149 $v1
          did -c highlight 5 1 
          did -a highlight 4 $did(highlight,5).seltext 
        }
      }
      if ($dialog(highlight_add)) filter -xcio highlight_add 2 highlight_add 2 %input
    }
  }
}

alias -l ver return v1.0
alias -l save {
  var %a = highadd
  %a sound $+($oo(8),•,$gettok($highget(sound),2,149))
  %a flash $+($oo(11),•,$did(12),•,$rep($did(13)))
  %a colortext $+($oo(14),•,$did(15).sel)
  %a echo $+($oo(16),•,$oo(17),•,$oo(18),•,$rep($did(19)))
  %a logs $+($oo(20),•,$oo(23),•,$oo(24),•,$rep($did(21)))
  %a editbox $+($oo(25),•,$rep($did(26)))
  ;%a events $+($oo(27),•,$oo(28),•,$oo(29),•,$oo(30))
  /*
  if ($oo(27) == on) && ($group(#highlight.text) == off) .enable #highlight.text
  else .disable #highlight.text
  if ($oo(28) == on) && ($group(#highlight.notice) == off) .enable #highlight.notice
  else .disable #highlight.notice
  if ($oo(29) == on) && ($group(#highlight.chat) == off) .enable #highlight.chat
  else .disable #highlight.chat
  if ($oo(30) == on) && ($group(#highlight.action) == off) .enable #highlight.action
  else .disable #highlight.action
  */
  groups.c $oo(27) text
  groups.c $oo(28) notice
  groups.c $oo(29) action
  groups.c $oo(30) chat
  %a matchwholewords $oo(31)
  %a case $oo(32)
  %a ctrlcode $oo(33)
  %a alias $+($oo(34),•,$rep($did(35)))
}

alias -l change.items {
  if ($1 == enable) { var %1 = -n,%2 = -e }
  else { var %1 = -m,%2 = -b }
  did %1 Highlight 4
  did %2 Highlight 3,5,6,7
}
alias -l change.d {
  if ($did(Highlight,$1).state) { var %1 = -n,%2 = -e }
  else { var %1 = -m, %2 = -b }
  did %1 $dname $2
  if ($3) did %2 $dname $3
}

; /highlight.add <network> <chan1,chan2,chan3> <word1,word2,word3>
alias -l highlight.add {
  var %network = $1,%chan = $2,%chans,%words = $3,%i = 1,%a,%n = $numtok(%chan,44),%t = $numtok(%words,44)
  while (%i <= %n) {
    var %a = 1
    while (%a <= %t) {
      var %chans = $gettok(%chan,%i,44),%word = $gettok(%words,%a,44)
      if (!$istok($highget(%network,%chans),%word,149)) highadd %network %chans $addtok($highget(%network,%chans),%word,149)
      inc %a
    }
    inc %i
  }
}

; /highlight.remove <network> <chan1,chan2,chan3> <word1,word2,word3>
alias -l highlight.remove {
  var %network = $1,%chan = $2,%words = $3,%i = 1,%a,%n = $numtok(%chan,44),%t = $numtok(%words,44)
  while (%i <= %n) {
    var %a = 1
    while (%a <= %t) {
      var %chans = $gettok(%chan,%i,44),%word = $gettok(%words,%a,44),%words1 = $highget(%network,%chans)
      if (!$istok(%words1,%word,149)) || (($numtok(%words1,149) == 1) && (%words1 != %word)) { inc %a | continue }
      if ($numtok(%words1,149) == 1) highdel %network %chans
      else highadd %network %chans $remtok(%words1,%word,1,149)
      inc %a
    }
    inc %i
  }
}

; /load.chans network chanid
alias -l load.chans {
  did -r $dname $2
  didtok $dname $2 32 $highchan($1)
  did -c $dname $2 1
  if ($highget($1,$did(3).seltext)) { didtok $dname 5 149 $v1 | did -r $dname 4 }
}

alias -l groups.c {
  if ($1 == on) && ($group($+(#highlight.,$2)) == off) .enable $+(#highlight.,$2)
  if ($1 == off) && ($group($+(#highlight.,$2)) == on) .disable $+(#highlight.,$2)
}
alias -l oo { if ($did($1).state) return on | return off }
alias -l rep return $replace($1-,$chr(32),$chr(150))
alias -l rrep return $replace($1-,$chr(150),$chr(32))

; HIGH*2 ALIASES WERE FOR OLD FORMAT WHERE 
; HASH TABLE NAMES WERE HIGHLIGHT-<NETWORK>
; NOT USED ANYMORE

alias -l highget return $hget(highlight,$iif($2,$+($1,$chr(44),$2),$1))
;alias highget2 return $hget(highlight $+ $iif($2,- $+ $1),$iif($2,$2,$1))

alias -l highadd {
  if ($3) { var %network = $1 | tokenize 32 $2- }
  hadd -m highlight $iif(%network,$+(%network,$chr(44),$1),$1) $2-
}

/*
alias highadd2 {
  if (!$3) var %table = highlight
  else { var %table = highlight- $+ $1 | tokenize 32 $2- }
  hadd -m %table $1 $2-
}
*/

; /highdel [network] <chan|stuff>
alias -l highdel {
  if ($2) { var %network = $1 | tokenize 32 $2- }
  hdel highlight $iif(%network,$+(%network,$chr(44),$1),$1)
}

/*
alias highdel2 {
  if (!$2) var %table = highlight
  else var %table = highlight- $+ $1
  hdel -m %table $ [ $+ [ $0 ] ]
}
*/

alias -l hightable {
  var %i = 1,%r
  while ($hfind(highlight,* $+ $chr(44) $+ status,%i,w)) { var %r = %r $gettok($v1,1,44) | inc %i }
  return %r
}

/*
alias hightable2 {
  var %i = 1,%r
  while (%i <= $hget(0)) { if (highlight-* iswm $hget(%i)) %r = %r $remove($hget(%i),highlight-) | inc %i }
  return %r
}
*/

alias -l highchan {
  var %i = 1,%r,%regex = $+(/,$1,\,$chr(44),[^status].*/i)
  while ($hfind(highlight,%regex,%i,r)) { var %r = %r $gettok($v1,2,44) | inc %i }
  return %r
}

/*
alias highchan2 {
  var %i = 1,%table = highlight- $+ $1,%r
  while (%i <= $hget(%table,0).item) { %r = %r $hget(%table,%i).item | inc %i }
  return $remove(%r,status)
} 
*/

alias -l highlight-status return $highget(status)
alias -l readme return $qt($scriptdirhighlightread-me.txt)
alias -l hdialog dialog $iif($dialog($1),-v,-m $1) $1

#highlight.text on
on ^*:TEXT:*:*:highlight.parse $1-
#highlight.text end

#highlight.notice on
on *:NOTICE:*:?:highlight.parse $1-
#highlight.notice end

#highlight.chat off
on ^*:CHAT:*:highlight.parse $1-
#highlight.chat end

#highlight.action on
on ^*:ACTION:*:#:highlight.parse $1-
#highlight.action end

alias -l highlight.parse {
  /*
  if ($highget($network,Default)) {
    set %1- $1-
    var %whole,%highlight.text = $v1
    tokenize 149 %highlight.text
    h.find $*
    if (%match) highlight.check %1- • $iif(#,#,$nick) • %match
    unset %1- %match
  }
  if ($highget($network,$iif(#,#,$nick))) {
    set %1- $1-
    var %whole,%highlight.text = $v1
    tokenize 149 %highlight.text
    h.find $*
    if (%match) highlight.check %1- • $iif(#,#,$nick) • %match
    unset %1- %match
  }
  */
  if ($highget(status) == off) return
  if (!$chan) && ($nick) var %a = Query
  else var %a = $chan
  if ($highget($network,%a)) {
    set %1- $1-
    var %whole,%highlight.text = $v1
    tokenize 149 %highlight.text
    h.find $*
    if (%match) highlight.check %1- • $iif(#,#,$nick) • %match
    unset %1- %match
  }
}

alias -l h.find {
  var %whole,%regex,%1 = $($1-,2)
  if ($highget(matchwholewords) == on) var %regex = $+(/,\b,$chr(40),%1,$chr(41),\b,/)
  else var %regex = $+(/,$chr(40),%1,$chr(41),/)
  if ($highget(case) == off) var %regex = $+(%regex,i)
  if ($regex($iif($highget(ctrlcode) == off,$strip(%1-),%1-),%regex)) set %match $regml(1)
}

alias -l highlight.check {

  ; Editbox

  var %target = $right($gettok($1-,2,149),-1),%word = $right($gettok($1-,3-,149),-1),%text,%regex,%stuff,%nick
  tokenize 149 $gettok($1-,1,149)
  if ($editbox(%target) == $null) && ($regex($highget(editbox),/^(on)•(.*)$/)) {
    var %t = $replace($regml(2),$chr(150),$chr(32))
    editbox %target $(%t,2)
  }

  ; Sound
  if ($regex($highget(sound),/^(on)•(.*)$/)) splay $qt($replace($regml(2),$chr(150),$chr(32)))

  ; Flash
  if ($regex($highget(flash),/^(on)•(.*)•(.*)$/)) flash $+(-r,$regml(2)) $regml(3)

  ; Color Text
  if ($regex($highget(colortext),/^(on)•(\d+)$/)) {
    if ($highget(matchwholewords) == on) var %regex = $+(/,\b,$chr(40),%word,$chr(41),\b,/g)
    else var %regex = $+(/,$chr(40),%word,$chr(41),/g)
    var %color = $+(,$calc($regml(2) -2))
    .echo -q $regsub($1-,%regex,$+(%color,\1),%text)
    haltdef
    if ($nick(#,$nick)) { var %color2 = $+(,$nick(#,$nick).color),%nick = $nick(#,$nick).pnick }
    elseif ($cnick($nick).color) { var %color2 = $+(,$v1) | var %nick = $nick }
    else { var %color2 = $cnick($me).color | var %nick = $me }
    if ($event == text) echo -mt %target $+(<,%color2,%nick,99,>) %text
    elseif ($event == chat) echo -mt =$nick $+(<,%color2,%nick,99,>) %text
    elseif ($event == notice) echo -mtac notice $+(-,%nick,-) %text
    elseif ($event == action) echo -mtc action %target * %nick %text
  }

  ; Echo
  if ($regex($highget(echo),/^(on)•(on|off)•(on|off)•(.*)$/)) {
    var %a = $regml(4),%stuff = $($replacex(%a,$chr(150),$chr(32)),2)
    if ($event == notice) var %t = $active
    elseif ($event == chat) var %t = =$nick
    else var %t = %target
    if ($regml(2) == on) && ($active != %target) echo -am %stuff
    if ($regml(3) == on) echo -m %t %stuff
  }

  ; Alias
  if ($regex($highget(alias),/^(on)•(.*)$/)) $($replace($regml(2),$chr(150),$chr(32)),2)

  ; Logs
  if ($regex($highget(logs),/^(on)•(on|off)•(on|off)•(.*)$/)) {
    var %stuff = $1-,%nick = $nick,%file = $replace($regml(4),$chr(150),$chr(32)),%a = write $qt(%file)

    if ($nick) var %nick = $nick
    else var %nick = $me
    if ($regml(3) == on) && ($nick(#,%nick).pnick) var %nick = $nick(#,%nick).pnick
    if ($regml(2) == on) var %stuff = $strip($1-)
    if (!$isfile(%file)) write -c $+(",%file,")
    %a $str(-,25) $fulldate ( $+ %target $+ )
    %a $timestamp $+(<,%nick,>) %stuff
    %a $crlf
  }
}

on *:QUIT:{
  if ($hget(highlight)) .hsave highlight highlight.has
}

on *:START:{
  if ($isfile(highlight.has)) { .hmake highlight 100 | .hload highlight highlight.has }
}

on *:LOAD:{
  if ($version < 6.32) {
    echo -a This Highlight Script was tested on mIRC 6.32 and you have version $version $+ . 
    echo -a This Script *may* work on your version, but if you're experiencing problems, please update your mIRC at www.mirc.com
  }
  echo -a Creating Hash Table...
  if (!$hget(highlight)) .hmake highlight 100
  var %a = .hadd highlight
  echo -a Loading default Values...
  %a alias off•highlight.notify–$1-
  %a case off
  %a colortext on•11
  %a ctrlcode off
  %a  echo on•on•on•13–$nick–just–highlighted–you–at–$time–in–$iif(#,#,$nick)–$+–:–$1-
  %a editbox off•$nick–at–$time–with:–$1-–$chr(124)
  %a flash on•15•HIGHLIGHT
  %a logs on•on•on•highlight-logs.txt
  %a matchwholewords on
  %a sound off
  %a status on
  echo -a Finished loading default values...
  if ($network) {
    highlight.add $network status on
    highlight.add $network $chan(1) $me
  }
  else {
    echo -a You are not connected to any Network. Script could not add any Network/Channel to the list. Please be sure to do so yourself manually in:
    echo -a Right-Click anywhere -> Highlight $ver -> Add/Delete... -> ... Networks/Chans
  }
}

on *:UNLOAD:{
  if (!$input(Are you sure you want to unload Highlight Script $ver $+ ?,y)) halt
  echo -a Unloading Highlight Script $ver ...
  if ($isfile(highlight.has)) .remove highlight.has
  if ($hget(highlight)) .hfree highlight
  .dll -u $qt($scriptdirColorCombo.dll)
  .unload -rs $qt($script)
  echo -a Script successfully unloaded. Thanks for using Highlight Script $ver $+ .
}