All pastes #1682992 Raw Edit

Highlight Script

public text v1 · immutable
#1682992 ·published 2009-11-23 00:26 UTC
rendered paste body
; #################################################################
; ## Highlight System script                                     ##
; ## Designed and written by EsCanavi                            ##
; ## Edited by Majinvegito3                                      ##
; #################################################################


; ##############################################
; # Load Default Options                       #
; ##############################################
on *:load: {
  if (!$findfile($mircdir,dcx.dll,1)) {
    echo 4 -a **** You do not appear to have dcx.dll which is required for this addon to work
    echo 4 -a **** You can download it from: http://www.mircscripts.org/download.php?id=2942&type=5
  }
  else {
    if (!$readini(HighlightSettings.ini,Config,SysEnable))        writeini HighlightSettings.ini Config SysEnable On
    if (!$readini(HighlightSettings.ini,Config,LogEnable))        writeini HighlightSettings.ini Config LogEnable On
    if (!$readini(HighlightSettings.ini,Config,SoundEnable))      writeini HighlightSettings.ini Config SoundEnable Off
    if (!$readini(HighlightSettings.ini,Config,EchoEnable))       writeini HighlightSettings.ini Config EchoEnable On
    if (!$readini(HighlightSettings.ini,Config,EchoMsg))          writeini HighlightSettings.ini Config EchoMsg Off
    if (!$readini(HighlightSettings.ini,Config,AutoGet))          writeini HighlightSettings.ini Config AutoGet On

    echo -a 4>>> Successfully loaded $remove($script,$scriptdir) - Highlight Script
    echo -a 4>>> Type /Highlights or right click and select 'Highlight System' to open options
  }
}


on *:unload: {
  echo -a 3>>> Successfully unloaded $remove($script,$scriptdir) - Highlight Script
}


; ##############################################
; # Popup Menus                                #
; ##############################################
menu status,channel,query,menubar,@Highlights {
  -
  Highlight System: {
    if (!$findfile($mircdir,dcx.dll,1)) {
      echo 4 -a **** You do not appear to have dcx.dll which is required for this addon to work
      echo 4 -a **** You can download it from: http://www.mircscripts.org/download.php?id=2942&type=5
    }
    else dialog $iif($dialog(Highlights),-v,-m) Highlights Highlights
  }
  -
}


; ##############################################
; # Access Alias                               #
; ##############################################
alias Highlights {
  if (!$findfile($mircdir,dcx.dll,1)) {
    echo 4 -a **** You do not appear to have dcx.dll which is required for this addon to work
    echo 4 -a **** You can download it from: http://www.mircscripts.org/download.php?id=2942&type=5
  }
  else dialog $iif($dialog(Highlights),-v,-m) Highlights Highlights
}


; ##############################################
; # Main Dialog                                #
; ##############################################
dialog -l Highlights {
  title Highlight System Settings
  size -1 -1 160 163
  option dbu
  tab "Basic Settings", 2, 0 -1 157 141
  check "Enable Highlight System", 13, 6 25 68 10, tab 2
  box "Enable", 14, 2 18 75 19, tab 2
  box "Highlight Logging System", 15, 78 18 78 19, tab 2
  check "Enable Highlight Logs", 16, 82 25 64 10, tab 2
  box "Sound Options", 19, 2 38 75 100, tab 2
  check "Enable Sounds", 20, 6 46 50 10, tab 2
  text "Sound File:", 21, 5 57 31 6, tab 2
  edit "", 22, 4 63 54 10, tab 2 read autohs
  text "Preview Sound:", 23, 5 78 39 8, tab 2
  button "Play", 24, 46 76 27 12, tab 2
  text "Note: If you add a sound here, it is not recommended to enable sounds in the built-in mIRC Highlights System.", 18, 5 104 68 33, tab 2
  button "Clear Sound", 25, 20 90 37 12, tab 2
  box "Echo Active Window", 27, 78 38 78 30, tab 2
  check "Echo Active Window", 28, 82 46 60 10, tab 2
  check "Include Message", 29, 92 56 52 10, tab 2
  button "Open", 31, 59 62 16 12, tab 2
  box "mIRC Highlights", 32, 78 69 78 69, tab 2
  button "Get mIRC Highlights", 33, 88 95 58 12, tab 2
  check "Use mIRC Highlights", 35, 82 77 71 10, tab 2
  button "Modify Highlights", 34, 88 109 58 12, tab 2
  tab "Help", 3
  box "Highlight System Help", 9, 6 15 146 121, tab 3
  text "Click a button below to receive help on the corresponding topic", 10, 28 33 99 15, tab 3 center
  button "General Help", 11, 49 54 61 12, tab 3
  button "Enable System Help", 12, 16 69 61 12, tab 3
  button "Logging System Help", 17, 81 69 61 12, tab 3
  button "Sound Help", 26, 16 84 61 12, tab 3
  button "Echo System Help", 30, 81 84 61 12, tab 3
  button "mIRC Highlights Help", 36, 16 99 61 12, tab 3
  button "Get / Modify Help", 37, 81 99 61 12, tab 3
  tab "About", 4
  box "Highlight System", 5, 3 28 152 91, tab 4
  text "Highlight System", 6, 22 40 112 8, tab 4 center
  text "Logging format and design by EsCanavi", 7, 22 56 112 8, tab 4 center
  text "Edited by Majinvegito3", 8, 22 64 112 8, tab 4 center
  link "http://majy.servegame.org/Majinvegito3/", 38, 27 104 102 8, tab 4
  text "To make suggestions or offer any kind of feedback on this script, please visit the link below and register on the site or email Majinvegito3 at Majinvegito3@gmail.com", 40, 28 75 103 28, tab 4
  text Copyright $chr(169) by Majinvegito3, 39, 22 48 112 8, tab 4 center
  button "OK", 1, 61 146 37 12, ok
}


on *:dialog:Highlights:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty

    if ($readini(HighlightSettings.ini,Config,SysEnable) == On) did -c $dname 13          | else did -b $dname 16,18,20,21,22,23,24,25,28,33,34,35
    if ($readini(HighlightSettings.ini,Config,LogEnable) == On) did -c $dname 16          | else did -u $dname 16
    if ($readini(HighlightSettings.ini,Config,SoundEnable) == On) did -c $dname 20        | else did -b $dname 18,21,22,23,24,25,31
    if ($readini(HighlightSettings.ini,Config,EchoEnable) == On) did -c $dname 28         | else did -b $dname 29
    if ($readini(HighlightSettings.ini,Config,EchoMsg) == On) did -c $dname 29            | else did -u $dname 29
    if ($readini(HighlightSettings.ini,Config,SoundFile)) did -a $dname 22 $readini(HighlightSettings.ini,Config,SoundFile)
    if ($readini(HighlightSettings.ini,Config,AutoGet) == On) {
      did -c $dname 35
      did -b $dname 33,34
    }
    else did -e $dname 33,34
  }
  if ($devent == sclick) {
    if ($did == 1) {
      if ($did(22)) writeini HighlightSettings.ini Config SoundFile $did(22)
    }
    if ($did == 11) {
      dialog $iif($dialog(GeneralHighlightsHelp),-v,-m) GeneralHighlightsHelp GeneralHighlightsHelp
    }
    if ($did == 12) {
      dialog $iif($dialog(EnableSysHelp),-v,-m) EnableSysHelp EnableSysHelp
    }
    if ($did == 13) {
      if ($readini(HighlightSettings.ini,Config,SysEnable) == On) {
        writeini HighlightSettings.ini Config SysEnable Off
        did -u $dname 13
        did -b $dname 16,18,20,21,22,23,24,25,28,29,31,33,34,35
      }
      elseif ($readini(HighlightSettings.ini,Config,SysEnable) == Off) {
        writeini HighlightSettings.ini Config SysEnable On
        did -c $dname 13
        did -e $dname 16,20,28,35
        if ($readini(HighlightSettings.ini,Config,SoundEnable) == On) did -e $dname 18,21,22,23,24,25,31
        if ($readini(HighlightSettings.ini,Config,EchoEnable) == On) did -e $dname 29
        if ($readini(HighlightSettings.ini,Config,AutoGet) == Off) did -e $dname 33,34
      }
    }
    if ($did == 16) {
      if ($readini(HighlightSettings.ini,Config,LogEnable) == On) {
        writeini HighlightSettings.ini Config LogEnable Off
        did -u $dname 16
      }
      elseif ($readini(HighlightSettings.ini,Config,LogEnable) == Off) {
        writeini HighlightSettings.ini Config LogEnable On
        did -c $dname 16
      }
    }
    if ($did == 17) {
      dialog $iif($dialog(LogSysHelp),-v,-m) LogSysHelp LogSysHelp
    }
    if ($did == 20) {
      if ($readini(HighlightSettings.ini,Config,SoundEnable) == On) {
        writeini HighlightSettings.ini Config SoundEnable Off
        did -u $dname 20
        did -b $dname 18,21,22,23,24,25,31
      }
      elseif ($readini(HighlightSettings.ini,Config,SoundEnable) == Off) {
        writeini HighlightSettings.ini Config SoundEnable On
        did -c $dname 20
        did -e $dname 18,21,22,23,24,25,31
      }
    }
    if ($did == 24) {
      if ($did(22)) splay $did(22)
    }
    if ($did == 25) {
      remini HighlightSettings.ini Config SoundFile
      did -r $dname 22
    }
    if ($did == 26) {
      dialog $iif($dialog(SoundSysHelp),-v,-m) SoundSysHelp SoundSysHelp
    }
    if ($did == 28) {
      if ($readini(HighlightSettings.ini,Config,EchoEnable) == On) {
        writeini HighlightSettings.ini Config EchoEnable Off
        did -u $dname 28
        did -b $dname 29
      }
      elseif ($readini(HighlightSettings.ini,Config,EchoEnable) == Off) {
        writeini HighlightSettings.ini Config EchoEnable On
        did -c $dname 28
        did -e $dname 29
      }
    }
    if ($did == 29) {
      if ($readini(HighlightSettings.ini,Config,EchoMsg) == On) {
        writeini HighlightSettings.ini Config EchoMsg Off
        did -u $dname 29
      }
      elseif ($readini(HighlightSettings.ini,Config,EchoMsg) == Off) {
        writeini HighlightSettings.ini Config EchoMsg On
        did -c $dname 29
      }
    }
    if ($did == 30) {
      dialog $iif($dialog(EchoSysHelp),-v,-m) EchoSysHelp EchoSysHelp
    }
    if ($did == 31) {
      did -a $dname 22 $sfile($mircdir)
    }
    if ($did == 33) {
      if ($input(Retrieved the following highlights from your current mIRC settings: $crlf $crlf $+ $HighlightSysGet.Highlights $Crlf $crlf $+ Would you like to use these as your Custom Highlights System highlights? You can use the 'Modify Hilights' button to modify or add to these.,yi,Highlights)) {
        writeini HighlightSettings.ini Config Highlights $HighlightSysGet.Highlights
      }
    }
    if ($did == 34) {
      var %highlights = $input(Enter Highlight words or identifiers seperated by commas ONLY. $crlf $+ Eg: $+($me,$chr(44),ALTNICK,$chr(44),$ $+ me),oe,Modify Highlights,$readini(HighlightSettings.ini,n,Config,Highlights)))
      if (%highlights) writeini HighlightSettings.ini Config Highlights $remove(%highlights,$chr(32))
      else remini HighlightSettings.ini Config Highlights
    }
    if ($did == 35) {
      if ($readini(HighlightSettings.ini,Config,AutoGet) == On) {
        writeini HighlightSettings.ini Config AutoGet Off
        did -u $dname 35
        did -e $dname 33,34
      }
      elseif ($readini(HighlightSettings.ini,Config,AutoGet) == Off) {
        writeini HighlightSettings.ini Config AutoGet On
        did -c $dname 35
        did -b $dname 33,34
      }
    }
    if ($did == 36) {
      dialog $iif($dialog(mIRCHighlightsHelp),-v,-m) mIRCHighlightsHelp mIRCHighlightsHelp
    }
    if ($did == 37) {
      dialog $iif($dialog(GetModifyHelp),-v,-m) GetModifyHelp GetModifyHelp
    }
    if ($did == 38) {
      run http://majy.servegame.org/Majinvegito3/
    }
  }
}


; ##############################################
; # Help Dialogs                               #
; ##############################################
dialog -l GeneralHighlightsHelp {
  title General Highlights System Help
  size -1 -1 150 80
  option dbu
  box "General Help", 1, 4 3 142 53
  button "Close", 2, 59 63 37 12, ok
  text "This addon is an extra addition to the built-in mIRC Highlights System. It is more user customizable and easier to use. For more in depth information, check out the other help files.", 3, 10 17 131 29
}


on *:dialog:GeneralHighlightsHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l EnableSysHelp {
  title Enable System Help
  size -1 -1 150 80
  option dbu
  box "Enable System Help", 1, 4 3 142 53
  button "Close", 2, 59 63 37 12, ok
  text "Clicking the checkbox will enable the addon as well as allow you to configure the other customizable options of this Highlights System. Unchecking the box will disable the system and all customizable options.", 3, 10 17 131 29
}


on *:dialog:EnableSysHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l LogSysHelp {
  title Logging System Help
  size -1 -1 150 80
  option dbu
  box "Logging System Help", 1, 4 3 142 53
  button "Close", 2, 59 63 37 12, ok
  text "Clicking the checkbox will enable a log window (@Highlights) to be opened which will log all of your highlights, including the message that highlighted you.  Unchecking the box will disable the logging system.", 3, 10 17 131 29
}


on *:dialog:LogSysHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l SoundSysHelp {
  title Sound Help
  size -1 -1 150 80
  option dbu
  box "Sound Help", 1, 4 3 142 53
  button "Close", 2, 59 63 37 12, ok
  text "The enable checkbox will enable or disable the sound on highlight.  You can choose the sound of your choice. Click 'Play' to preview the sound. If you want to delete the sound you chose, click 'Clear Sound' to remove it.", 3, 10 15 131 33
}


on *:dialog:SoundSysHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l EchoSysHelp {
  title Echo System Help
  size -1 -1 150 80
  option dbu
  box "Echo System Help", 1, 4 3 142 53
  button "Close", 2, 59 63 37 12, ok
  text "Clicking the enable checkbox will cause an echo to the currently active window to be displayed upon receiving a highlight.  If you also want to include the message in this echo, click the 'Include Message' checkbox.", 3, 10 15 131 33
}


on *:dialog:EchoSysHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l mIRCHighlightsHelp {
  title mIRC Highlights Help
  size -1 -1 150 80
  option dbu
  box "mIRC Highlights Help", 1, 4 3 142 55
  button "Close", 2, 59 63 37 12, ok
  text "If you want this highlight system to automatically use your highlights set in the built-in mIRC Highlights System, click the 'Use mIRC Highlights'  checkbox. Otherwise, you can set up custom highlights completely seperate from those in the built in system. More about this is explained in the Get/Modify Help files.", 3, 10 10 131 45
}


on *:dialog:mIRCHighlightsHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


dialog -l GetModifyHelp {
  title Get / Modify Help
  size -1 -1 150 80
  option dbu
  box "Get / Modify Highlights Help", 1, 4 3 142 55
  button "Close", 2, 59 63 37 12, ok
  text "'Get mIRC Highlights' will take your highlights from the built-in IRC Highlights System and will then allow you to edit and/or modify them with the 'Modify Highlights' button. You can also just click on 'Modify Highlights' to set up the words which will highlight you in this system (completely seperate from the built-in system).", 3, 10 13 131 40
}


on *:dialog:GetModifyHelp:*:*: {
  if ($devent == init) {
    dcx Mark $dname $devent $did
    xdialog -a $dname +ac 250
    xdialog -b $dname +nty
  }
}


; ##############################################
; # Text/Action Highlight Events               #
; ##############################################
on *:text:*:#: {
  if ($readini(HighlightSettings.ini,Config,SysEnable) == On) {
    if (($me isin $RemovePunctuation($strip($1-,burc))) || ($HighlightSysCheck.For.Highlights($RemovePunctuation($strip($1-,burc))))) {
      $iif($readini(HighlightSettings.ini,Config,LogEnable) == On,window -egknz @Highlights)
      if ($readini(HighlightSettings.ini,Config,SoundEnable) == On) {
        $iif($readini(HighlightSettings.ini,Config,SoundFile),splay $readini(HighlightSettings.ini,Config,SoundFile))
      }
      if ($readini(HighlightSettings.ini,Config,EchoEnable) == On) {
        if ($active != @Highlights && $active != $chan) {
          echo 07 -at2 07**** [03Highlight07]03 $nick 07highlighted you on 03 $+ $chan $+ 07 (03 $+ $network $+ 07) $&
            $iif($readini(HighlightSettings.ini,Config,EchoMsg) == On,07[10 $+ $1- $+ 07])
        }
      }
      if ($readini(HighlightSettings.ini,Config,LogEnable) == On) {
        echo 07 -t2 @Highlights 07**** [03Message07]03 $nick 07highlighted you on 03 $+ $chan $+ 07 (03 $+ $network $+ 07) $&
          07[10 $+ $1- $+ 07]
      }
    }
  }
  else halt
}


on *:action:*:#: {
  if ($readini(HighlightSettings.ini,Config,SysEnable) == On) {
    if (($me isin $RemovePunctuation($strip($1-,burc))) || ($HighlightSysCheck.For.Highlights($RemovePunctuation($strip($1-,burc))))) {
      $iif($readini(HighlightSettings.ini,Config,LogEnable) == On,window -egknz @Highlights)
      if ($readini(HighlightSettings.ini,Config,SoundEnable) == On) {
        $iif($readini(HighlightSettings.ini,Config,SoundFile),splay $readini(HighlightSettings.ini,Config,SoundFile))
      }
      if ($readini(HighlightSettings.ini,Config,EchoEnable) == On) {
        if ($active != @Highlights && $active != $chan) {
          echo 07 -at2 07**** [03Highlight07]03 $nick 07highlighted you on 03 $+ $chan $+ 07 (03 $+ $network $+ 07) $&
            $iif($readini(HighlightSettings.ini,Config,EchoMsg) == On,07[10 $+ $nick $1- $+ 07])
        }
      }
      if ($readini(HighlightSettings.ini,Config,LogEnable) == On) {
        echo 07 -t @Highlights 07**** [03Action07]03 $nick 07highlighted you on 03 $+ $chan $+ 07 (03 $+ $network $+ 07) $&
          07[10 $+ $nick $1- $+ 07]
      }
    }
  }
  else halt
}


; ##############################################
; # Other Aliases                              #
; ##############################################
alias -l HighlightSysGet.Highlights {
  var %x = 1, %Groups = $ini(mirc.ini,highlight,0)
  while (%x <= %Groups) {
    var %TempHighlightSysHighlights = $addtok(%TempHighlightSysHighlights,$highlight(%x),44)
    inc %x
  }
  return %TempHighlightSysHighlights
}


alias -l HighlightSysCheck.For.Highlights { 
  if ($readini(HighlightSettings.ini,Config,AutoGet) == On) set %HighlightSysHighlights $HighlightSysGet.Highlights
  else set %HighlightSysHighlights $readini(HighlightSettings.ini,n,Config,Highlights)

  var %x = 1, %highlights = $numtok(%HighlightSysHighlights,44)
  while (%x <= %highlights) {
    var %chighlight = $($gettok(%HighlightSysHighlights,%x,44),2)
    if ($istok($1-,%chighlight,32)) { return %chighlight | unset %HighlightSysHighlights }
    inc %x
  }
  unset %HighlightSysHighlights
  return $false
}


alias -l RemovePunctuation {
  return $remove($1,.,?,,*,&,!,:,;,',",$chr(40),$chr(41),$chr(44),$chr(60),$chr(61),$chr(62),$chr(64),$chr(95))
}


; ##############################################
; # dcx.dll Aliases                            #
; ##############################################
alias dcx {
  if ($isid) return $dll($findfile($mircdir,dcx.dll,1),$1,$2-)
  else dll " $+ $findfile($mircdir,dcx.dll,1) $+ " $1 $2-
}

alias -l xdid {
  if ($isid) return $dcx(_xdid,$1 $2 $prop $3-)
  else dcx xdid $2 $3 $1 $4-
}

alias -l xdialog {
  if ($isid) return $dcx(_xdialog,$1 $prop $2-)
  else dcx xdialog $2 $1 $3-
}