All pastes #627012 Raw Edit

Mine

public text v1 · immutable
·published 2007-07-20 01:19 UTC
rendered paste body
; Advanced Highlight System Version 0.1 
; Created by Chessnut of SwiftIRC. 
; Load into your remotes and right click anywhere to start. 

alias hlog { 
  if ($window(@HighlightLog)) window -c @HighlightLog 
  window -laC +st @HighlightLog -1 -1 650 218 
  loadbuf 1-12 -r @HighlightLog h_sys.txt 
} 

menu @HighlightLog { 
  dclick: if ($gettok($line($menu,$1),1,32)) window -a $v1 
  rclick: clipboard $line($menu,$1)
} 

alias hlight { 
  if ($dialog(h_sys)) dialog -x h_sys 
  dialog -man h_sys h_sys 
} 

alias -l codeit return $replace($1,$chr(32),$chr(135),$chr(91),$chr(134),$chr(93),$chr(156),=,$chr(166)) 
alias -l decodeit return $replace($1,$chr(135),$chr(32),$chr(134),$chr(91),$chr(156),$chr(93),$chr(166),=) 

dialog h_sys { 
  title "Advanced Highlight System" 
  size -1 -1 184 162 
  option dbu 
  check "Enable Advanced Highlighting", 1, 8 7 86 10 
  text "Highlight List:", 2, 8 19 33 8 
  list 3, 8 28 122 98, size 
  button "Add", 4, 139 35 37 12 
  button "Edit", 5, 139 51 37 12 
  button "Delete", 6, 139 67 37 12 
  button "Ok", 7, 76 137 37 12, default ok cancel 
  check "Show log on refocus", 8, 9 128 60 10 
  button "Move Up", 9, 139 105 37 12 
  button "Move Down", 10, 139 121 37 12 
  button "Ignore List", 11, 139 83 37 12 
  text "Adv. Highlights v0.1 Created by Chessnut", 12, 126 144 53 16 
} 

dialog h_sysignore { 
  title "Ignore List" 
  size -1 -1 168 132 
  option dbu 
  list 1, 9 16 113 90, size vsbar 
  text "Names and addresses to ignore on highlight:", 2, 14 6 117 8 
  button "Add", 3, 125 24 37 12 
  button "Delete", 4, 125 40 37 12 
  button "Ok", 6, 73 112 37 12, ok cancel 
} 

dialog h_syspop { 
  title "Highlighted!" 
  size -1 -1 178 62 
  option dbu 
  button "Cancel", 1, 52 46 37 12, ok cancel 
  text "", 2, 13 7 156 35, center 
  button "Goto", 3, 95 46 37 12 
  text "", 4, 138 48 25 8, hide 
} 

dialog h_sys_add { 
  title "Add Highlight" 
  size -1 -1 124 204 
  option dbu 
  text "Expression to highlight:", 1, 12 7 61 8 
  edit "", 2, 11 17 105 10, autohs 
  combo 3, 11 41 55 41, size drop 
  text "Colour of highlight:", 4, 12 31 52 8 
  button "...", 19, 70 40 47 12, disable 
  check "Flash message:", 7, 12 56 50 10 
  edit "", 8, 11 66 50 10, disable autohs 
  check "Limit flash to:", 9, 71 56 50 10 
  edit "", 10, 70 66 17 10, disable limit 2 
  text "time(s)", 11, 88 67 25 8 
  check "Pop-up notifier", 12, 12 80 50 10 
  button "Ok", 13, 45 184 37 12, default 
  text "...", 14, 79 7 25 8, hide 
  text "", 15, 83 81 25 8, hide 
  check "Autofocus", 16, 65 80 50 10 
  check "Echo active window", 17, 12 90 60 10 
  check "Play Sound:", 18, 71 29 40 10 
  text "Only trigger in channels/queries with:", 5, 12 101 92 8 
  text "Use commas to separate multiple channels/nicks. Leave blank to trigger anywhere.", 6, 6 124 117 15 
  edit "", 20, 12 110 104 10, autohs 
  edit "", 22, 12 150 103 10, disable autohs 
  check "Auto-respond with message:", 21, 12 140 79 10 
  text "Highlight with event:", 23, 7 163 52 8 
  check "On Text", 24, 12 172 33 10 
  check "On Action", 25, 45 172 33 10 
  check "On Notice", 26, 82 172 36 10 
} 

menu status,query,nicklist,channel,menubar { 
  .Advanced Highlights 
  ..Main: hlight 
  ..Logs: hlog 
  .. $+ $iif(($menu != nicklist && $menu != query) || !$1,$style(2)) Add nick to highlight ignore: { writeini h_sys.ini ignore $1 1 | echo -a $1 added to highlight ignore list. You will no longer be highlighted by this nick. } 
  .. $+ $iif(($menu != nicklist && $menu != query) || !$1,$style(2)) Add address to highlight ignore: { writeini h_sys.ini ignore $address($1,2) 1 | echo -a $address($1,2) added to highlight ignore list. You will no longer be highlighted by a nick using this address. } 
} 

;- ON INITIALISATION 
on *:dialog:h_sys:init:0: { 
  var %x 1 
  if ($exists(h_sys.ini)) { 
    did $+(-,$iif($readini(h_sys.ini,preferences,enable) == 1,c,u)) $dname 1 
    did $+(-,$iif($readini(h_sys.ini,preferences,applog) == 1,c,u)) $dname 8 
    while ($ini(h_sys.ini,expressions,%x)) { 
      did -a $dname 3 $decodeit($ifmatch) 
      inc %x 
    } 
  } 
  else did -c $dname 1,8 
} 

;- ADD CLICK 
on *:dialog:h_sys:sclick:4: { 
  if ($dialog(h_sys_add)) dialog -x h_sys_add 
  dialog -mad h_sys_add h_sys_add 
} 

;- EDIT CLICK 
on *:dialog:h_sys:sclick:5: { 
  if ($did(3).sel) { 
    writeini h_sys.ini preferences active $codeit($did(3).seltext) 
    if ($dialog(h_sys_edit)) dialog -x h_sys_edit 
    dialog -mad h_sys_edit h_sys_add 
  } 
} 

;- DELETE CLICK 
on *:dialog:h_sys:sclick:6: { 
  if ($did(3).sel) { 
    remini h_sys.ini expressions $codeit($did(3).seltext) 
    did -d $dname 3 $v1 
  } 
} 

;- IGNORE LIST CLICK 
on *:dialog:h_sys:sclick:11: { 
  if ($dialog(h_sysignore)) dialog -x h_sysignore 
  dialog -mad h_sysignore h_sysignore 
} 

;- MOVE UP CLICK 
on *:dialog:h_sys:sclick:9: { 
  if ($did(3).sel != 1 && $did(3).sel) { 
    did -ic $dname 3 $calc($v1 - 1) $did(3,$v1) 
    did -d $dname 3 $calc($v1 + 1) 
    if ($read(h_sys.ini,w,$+($codeit($did(3).seltext),=*))) { 
      write $+(-il,$calc($readn - 1)) h_sys.ini $v1 
      write $+(-dl,$calc($readn + 1)) h_sys.ini 
    } 
  } 
} 

;- MOVE DOWN CLICK 
on *:dialog:h_sys:sclick:10: { 
  if ($did(3).sel != $did(3).lines && $did(3).sel) { 
    did -ic $dname 3 $calc($v1 + 2) $did(3,$v1) 
    did -d $dname 3 $v1 
    if ($read(h_sys.ini,w,$+($codeit($did(3).seltext),=*))) { 
      write $+(-il,$calc($readn + 2)) h_sys.ini $v1 
      write $+(-dl,$readn) h_sys.ini 
    } 
  } 
} 

;- OK CLICK 
on *:dialog:h_sys:sclick:11: { 
  writeini h_sys.ini preferences enable $iif($did(1).state == 1,1,0) 
  writeini h_sys.ini preferences applog $iif($did(8).state == 1,1,0) 
} 

;- OK CLICK 
on *:dialog:h_sys:sclick:7: { 
  writeini h_sys.ini preferences enable $iif($did(1).state == 1,1,0) 
  writeini h_sys.ini preferences applog $iif($did(8).state == 1,1,0) 
} 

; -------------------- 
;- ADD DIALOG INIT 
on *:dialog:h_sys_add:init:0: { 
  didtok $dname 3 46 < None >.White.Black.Dark Blue.Dark Green.Red $& 
    .Maroon.Purple.Orange.Yellow.Green.Turquoise.Cyan.Blue.Magenta.Dark Grey.Grey 
  did -c $dname 3,24-26 1 
} 

;- EDIT DIALOG INIT 
on *:dialog:h_sys_edit:init:0: { 
  dialog -t $dname Edit Highlight 
  didtok $dname 3 46 < None >.White.Black.Dark Blue.Dark Green.Red $& 
    .Maroon.Purple.Orange.Yellow.Green.Turquoise.Cyan.Blue.Magenta.Dark Grey.Grey 
  did -c $dname 3 1 
  did -a $dname 2,15 $decodeit($readini(h_sys.ini,n,preferences,active)) 
  if ($readini(h_sys.ini,n,expressions,$codeit($did(2)))) { 
    tokenize 135 $ifmatch 
    did -c $dname 3 $1 
    did -ar $dname 14 $2 
    did -ar $dname 19 $nopath($2) 
    did $+(-,$iif($3 == 1,c,u)) $dname 7 
    did $+(-,$iif($did(7).state == 1,e,b)) $dname 8 
    did -ar $dname 8 $iif($4 != __,$v1) 
    did $+(-,$iif($5 == 1,c,u)) $dname 9 
    did $+(-,$iif($did(7).state == 1,e,b)) $dname 9 
    did $+(-,$iif($did(9).state == 1 && $did(7).state == 1,e,b)) $dname 10 
    did -ar $dname 10 $iif($6 != __,$v1) 
    did $+(-,$iif($7 == 1,c,u)) $dname 12 
    did $+(-,$iif($8 == 1,c,u)) $dname 16 
    did $+(-,$iif($9 == 1,c,u)) $dname 17 
    did $+(-,$iif($10 == 1,c,u)) $dname 18 
    did $+(-,$iif($did(18).state == 1,e,b)) $dname 19 
    if ($11 != __) did -ar $dname 20 $11 
    did $+(-,$iif($12 == 1,c,u)) $dname 21 
    if ($13 != __) did -ar $dname 22 $13 
    did $+(-,$iif($did(21).state == 1,e,b)) $dname 22 
    if ($istok($14,text,46)) did -c $dname 24 
    if ($istok($14,action,46)) did -c $dname 25 
    if ($istok($14,notice,46)) did -c $dname 26 
  } 
} 

;- ADD/EDIT DIALOG F CHOOSE 
on *:dialog:h_sys_*:sclick:19: { 
  did -ar $dname 14 $iif($sfile($iif($did(14) != ... && $did(14),$+($nofile($v1),*.wav;*.mid;*.mp3),$+($scriptdir,*.wav;*.mid;*.mp3)),Select a sound file),$ifmatch,$did(14)) 
  did -ar $dname $did $nopath($did(14)) 
} 

;- TICK/UNTICK 
on *:dialog:h_sys_*:sclick:7,9,18,21: { 
  did $+(-,$iif($did($did).state == 1,e,b)) $dname $calc($did + 1) 
  if ($did == 7) { 
    did $+(-,$iif($did($did).state == 1,e,b)) $dname 9 
    if ($did(9).state == 1 && $did($did).state == 1) did -e $dname 10 
    else did -b $dname 10 
  } 
} 

;- EDIT DIALOG OK 
on *:dialog:h_sys_edit:sclick:13: { 
  if ($did(2)) { 
    if ($did(2) != $did(15)) { 
      write $+(-w,$codeit($did(15)),=*) h_sys.ini $+($codeit($did(2)),=,$did(3).sel,‡,$did(14),‡,$did(7).state,‡,$iif($did(8),$v1,__),‡,$did(9).state, $+ $& 
        ‡,$iif($did(10),$v1,__),‡,$did(12).state,‡,$did(16).state,‡,$did(17).state,‡,$did(18).state,‡, $+ $& $iif($did(20),$v1,__),‡,$did(21).state,‡,$iif($did(22),$v1,__),‡,$iif($did(24).state == 1,text,0),.,$iif($did(25).state == 1,action,0),.,$iif($did(26).state == 1,notice,0)) 
      did -oc h_sys 3 $didwm(h_sys,3,$did(15)) $did(2) 
    } 
    else writeini h_sys.ini expressions $codeit($did(2)) $+($did(3).sel,‡,$did(14),‡,$did(7).state,‡,$iif($did(8),$v1,__),‡,$did(9).state,‡  $+ $& 
      ,$iif($did(10),$v1,__),‡,$did(12).state, $+ $& 
      ‡,$did(16).state,‡,$did(17).state,‡,$did(18).state,‡,$iif($did(20),$v1,__),‡,$did(21).state,‡, $+ $& 
      $iif($did(22),$v1,__),‡,$iif($did(24).state == 1,text,0),.,$iif($did(25).state == 1,action,0),.,$iif($did(26).state == 1,notice,0)) 
    did -c h_sys 3 $didwm(h_sys,3,$did(15)) 
  } 
  dialog -x $dname $dname 
} 

;- ADD DIALOG OK 
on *:dialog:h_sys_add:sclick:13: { 
  if ($did(2)) { 
    writeini h_sys.ini expressions $codeit($did(2)) $+($did(3).sel,‡,$did(14),‡,$did(7).state,‡,$iif($did(8),$v1,__), $+ $& 
      ‡,$did(9).state,‡,$iif($did(10),$v1,__),‡,$did(12).state,‡,did(16).state,‡, $+ $& 
      $did(17).state,‡,$did(18).state,‡,$iif($did(20),$v1,__),‡,$did(21).state,‡,$iif($did(22),$v1,__), $+ $& 
      ‡,$iif($did(24).state == 1,text,0),.,$iif($did(25).state == 1,action,0),.,$iif($did(26).state == 1,notice,0)) 
    did -ca h_sys 3 $did(2) 
  } 
  dialog -x $dname $dname 
} 

; --------------------------------- 

alias -l h_check { 
  if ($readini(h_sys.ini,n,preferences,enable) == 1) { 
    var %h_chan $1, %h_nick $2, %h_event $3, %x 1 
    set %syspop3 $4- 
    while ($ini(h_sys.ini,expressions,%x)) { 
      var %k $decodeit($ifmatch) 
      if ((($regex(%k,/\/.*\//) && $regex(%syspop3,%k)) || (!$regex(%k,/\/.*\//) && $regex(%syspop3,/\b(\Q $+ $replace(%k,$chr(42),$+(\E,$chr(46),$chr(42),\Q),$chr(44),$+(\E,$chr(124),\Q)) $+ \E)\b/i))) && $iif($gettok($readini(h_sys.ini,expressions,$codeit(%k)),11,135) != __,$istok($v1,$iif(%h_chan,$v1,%h_nick),44),%h_nick) && !$readini(h_sys.ini,ignore,%h_nick) && !$readini(h_sys.ini,ignore,$address(%h_nick,2))) { 
        var %c 1 
        tokenize 135 $readini(h_sys.ini,expressions,$codeit(%k)) 
        if ($istok($14,%h_event,46)) { 
          haltdef 
          if (!$appactive) set %gh_sys 1 
          while ($readini(mirc.ini,cnicks,$+(n,%c))) { 
            if ($regex($ifmatch,/^\x2c(\d+)\x2c{3}\d\x2c1/)) { var %regc $regml(1) | break } 
            inc %c 
          } 
          if (!%regc) { 
            var %t 1 
            while ($chan(%t)) { 
              if ($nick($v1,1,r)) { var %regc $nick($chan(%t),$v1).color | break } 
              inc %t 
            } 
          } 
          if (%h_event == text && $istok($14,text,46)) { 
            echo $iif($1 == 1,$null,$calc($1 - 2)) -tm $iif(%h_chan,$v1,%h_nick) $+(<,$chr(3),$iif(%h_chan,$nick(%h_chan,%h_nick).color,$iif(%regc,$v1,1)), $+ $& 
              $iif($gettok($readini(mirc.ini,options,n2),30,44) == 1 && %h_chan,$nick(%h_chan,%h_nick).pnick,%h_nick),$chr(3),>) %syspop3 
            write -il1 h_sys.txt $iif(%h_chan,$v1,%h_nick) in a $+($chr(2),%h_event,$chr(2)) event: $timestamp $+(<,$chr(3),$iif(%h_chan,$nick(%h_chan,%h_nick).color,$iif(%regc,$v1,1)), $+ $& $iif($gettok($readini(mirc.ini,options,n2),30,44) == 1 && %h_chan,$nick(%h_chan,%h_nick).pnick,%h_nick),$chr(3),>) %syspop3 
            beep 1         
          } 
          elseif (%h_event == action && $istok($14,action,46)) { 
            echo $iif($1 == 1,$null,$calc($1 - 2)) -tm $iif(%h_chan,$v1,%h_nick) $+($chr(3),$color(action)) $+ * %h_nick $+ $chr(3) $+ $iif($1 == 1,$null,$calc($1 - 2)) %syspop3 
            write -il1 h_sys.txt $iif(%h_chan,$v1,%h_nick) in an $+($chr(2),%h_event,$chr(2)) event: $+($chr(3),$color(action),$timestamp) * $nick %syspop3 
            beep 1         
          } 
          elseif (%h_event == notice && $istok($14,notice,46)) { 
            echo $iif($1 == 1,$null,$calc($1 - 2)) -tm $iif(%h_chan,$v1,$active) $+($chr(3),$color(notice),-,$nick,$iif($chan,: $+ $v1,$null),-) $+ $chr(3) $+ $iif($1 == 1,$null,$calc($1 - 2)) %syspop3 
            write -il1 h_sys.txt $iif(%h_chan,$v1,%h_nick) in a $+($chr(2),%h_event,$chr(2)) event: $+($chr(3),$color(notice),$timestamp) $+(-,$nick,$iif($chan,: $+ $v1,$null),-) %syspop3 
            beep 1         
          } 
          if ($lines(h_sys.txt) > 12) write -dl13 h_sys.txt 
          window -g2 $iif(%h_chan,$v1,$iif(%h_event == notice,$active,%h_nick)) 
          if ($2 != ... && $10 == 1) .splay $qt($2) 
          if ($4 != __ && $3 == 1) flash $+(-r,$iif($6 != __ && $6 isnum && $5 == 1,$6)) $4 
          if ($7 == 1 && (($appactive && %h_chan != $active) || !$appactive)) { 
            set %syspop You have been highlighted by %h_nick in $iif(%h_chan,$v1,a query window) 
            if (%h_event == text && $istok($14,text,46)) { set %syspop2 $timestamp $+(<,$iif($gettok($readini(mirc.ini,options,n2),30,44) == 1 && %h_chan,$nick(%h_chan,%h_nick).pnick,%h_nick),>) %syspop3 } 
            elseif (%h_event == action && $istok($14,action,46)) { set %syspop2 $timestamp * $nick %syspop3 } 
            elseif (%h_event == notice && $istok($14,notice,46)) { set %syspop2 $timestamp $+(-,$nick,$iif($chan,: $+ $v1,$null),-) %syspop3 } 
            dialog -mad $+(h_syspop,$ticks) h_syspop 
          } 
          if ($8 == 1) { 
            window -a $iif(%h_chan,$v1,%h_nick) 
            findtext -n %syspop3 
          } 
          if ($9 == 1 && (($appactive && %h_chan != $active) || !$appactive)) { 
            echo $iif($1 == 1,$null,$calc($1 - 2)) -a You have just been highlighted by %h_nick in $iif(%h_chan,$v1,$iif(%h_event == notice,a private notice,a query window)) 
          } 
          if ($12 == 1 && $13 != __) notice %h_nick $13 
          halt 
        } 
      } 
      inc %x 
    } 
  } 
  unset %syspop3
} 

on ^*:text:*:*: h_check $iif($chan,$v1,0) $nick $event $1- 
on ^*:action:*:*: h_check $iif($chan,$v1,0) $nick $event $1- 
on ^*:notice:*:*: h_check $iif($chan,$v1,0) $nick $event $1- 


on *:appactive: { 
  if ($appactive && $readini(h_sys.ini,preferences,applog) == 1 && %gh_sys == 1) { 
    hlog 
  } 
  unset %gh_sys 
} 

; -------------------------------------- 

;- POPUP INIT 
on *:dialog:h_syspop*:init:0: did -ar $dname 2 $+(%syspop,$crlf,$crlf,%syspop2) 

on *:dialog:h_syspop*:sclick:3: { 
  noop $regex(%syspop,/highlighted by (.*) in (#.*)?/) 
  dialog -x $dname 
  window -a $regml($regml(0)) 
  findtext -r %syspop3 
} 

on *:dialog:h_syspop*:close:0: unset %syspop* 

; -------------------------------------- 

;- IGNORE LIST INIT 
on *:dialog:h_sysignore:init:0: { 
  var %x 1 
  while ($ini(h_sys.ini,ignore,%x)) { 
    did -a $dname 1 $v1 
    inc %x 
  } 
} 

;- ADD CLICK 
on *:dialog:h_sysignore:sclick:3: { 
  if ($?="Enter a name or address to add to the ignore list. $crlf $+ If adding an address, use banmask 2.") { 
    writeini h_sys.ini ignore $v1 1 
    did -ac $dname 1 $v1 
  } 
} 

;- DELETE CLICK 
on *:dialog:h_sysignore:sclick:4: { 
  if ($did(1).sel) { 
    remini h_sys.ini ignore $did(1).seltext 
    did -d $dname 1 $v1 
  } 
}