Highlight Revenge

Here is room for additional scripts for Gamers.IRC.

You are highly advised to read the How-To first!
User avatar
Tuxman
Administrator
Posts: 1873
Joined: 24.10.2003 00:13
Status: That guy
Contact:

Highlight Revenge

Unread postby Tuxman » 05.04.2009 20:33

There are some weird ppl around who have fun highlighting you (like !tux)... time for a payback!

Code: Select all

on *:TEXT:*:*:{
  ; -- BNC --
  if ($nick == -psyBNC || $nick == -sBNC || $left($nick,1) == $chr(34)) { return }

  ; -- Text check --
  if ($ini(mirc.ini,highlight,0) < 1) { halt }
  var %hl.myhighlights,%hl.i = 1
  while (%hl.i <= $ini(mirc.ini,highlight,0)) {
    %hl.myhighlights = $addtok(%hl.myhighlights,$eval($remove($gettok($readini(mirc.ini,highlight,n $+ $calc(%hl.i - 1)),7,44),"),2),32)
    inc %hl.i
  }

  var %hl.i = 1
  while (%hl.i <= $numtok(%hl.myhighlights,32)) {
    if ($gettok(%hl.myhighlights,%hl.i,32) isin $1-) {

      ; [ FLOOD PROTECTION ]

      ; -- have a break ... 10 seconds minimum --
      if (!%hl.flooded) { set -u10 %hl.flooded 1 }
      else { halt }


      ; [ STATUS RECOGNITION ]

      ; -- Matchstrings --
      ;  -> Status:  known statuses (extend it however you want it to ;))
      ;  -> Divider: allowed characters
      var %hl.nickRipStatus  = NA/DND/BNC/AFK/AWAY/OFF/AW/CS/WOW/ON/HL/CHILL/TV
      var %hl.nickRipDivider = ^/\/`/_/-/[/][/ $+ $chr(124)

      ; -- Split nickname --
      var %hl.nickVar        = $nick
      var %hl.nickCntDivider = 1
      var %hl.nickCntStatus  = 1
      var %hl.nickSplit      = $false

      while (%hl.nickCntDivider <= $numtok(%hl.nickRipDivider,47)) {
        while (%hl.nickCntStatus <= $numtok(%hl.nickRipStatus,47)) {
          var %hl.nickRegex = /(\w $+ %hl.nickCntStatus $+ $chr(124) $+ %hl.nickCntStatus $+ \w)/
          if ($gettok(%hl.nickRipDivider,%hl.nickCntDivider,47) $+ $gettok(%hl.nickRipStatus,%hl.nickCntStatus,47) isin %hl.nickVar && $regex($gettok(%hl.nickRipStatus,%hl.nickCntStatus,47),%hl.nickRegex) == 0) {
            %hl.nickSplit = $true
            %hl.nickVar = $remove(%hl.nickVar,$gettok(%hl.nickRipDivider,%hl.nickCntDivider,47) $+ $gettok(%hl.nickRipStatus,%hl.nickCntStatus,47))
            break
          }
          else {
            inc %hl.nickCntStatus
          }
        }
        if ($right(%hl.nickVar,1) == $gettok(%hl.nickRipDivider,%hl.nickCntDivider,47)) {
          %hl.nickVar = $remove(%hl.nickVar,$gettok(%hl.nickRipDivider,%hl.nickCntDivider,47))
        }
        if (%hl.nickSplit) {
          break
        }
        %hl.nickCntStatus = 1
        inc %hl.nickCntDivider
      }


      ; [ TAG RECOGNITION ]

      ; -- Regex --
      var %hl.nickRipTags1 = $regex(nickRip1, %hl.nickVar, /\[(\S*)\]/)
      var %hl.nickRipTags2 = $regex(nickRip2, %hl.nickVar, /(\S*)\|/)
      var %hl.nickRipTags3 = $regex(nickRip3, %hl.nickVar, /(\S*)`/)

      ; -- Split nickname --
      if (!$regex($remove(%hl.nickVar,$regml(nickRip1,1)),/^(\W*)$/)) {
        %hl.nickVar = $remove(%hl.nickVar,[ $+ $regml(nickRip1,1) $+ ])
      }

      if (!$regex($remove(%hl.nickVar,$regml(nickRip2,1)),/^(\W*)$/)) {
        %hl.nickVar = $remove(%hl.nickVar,$regml(nickRip2,1) $+ $chr(124))
      }

      if (!$regex($remove(%hl.nickVar,$regml(nickRip3,1)),/^(\W*)$/)) {
        %hl.nickVar = $remove(%hl.nickVar,$regml(nickRip3,1) $+ `)
      }

      %hl.nickVar = $remove(%hl.nickVar,[])
      %hl.nickVar = $remove(%hl.nickVar,$chr(124))
      %hl.nickVar = $remove(%hl.nickVar,`)

      ; ------------------------------------
      ; -- Output --
      msg $iif($chan, $chan, $nick) ! $+ $lower(%hl.nickVar)
      break
    }

    inc %hl.i
  }
}
Remark:
You can use %hl.nickVar (cleaned nickname) for further processing.
^\__/
..O.o

This is Einkaufswagen. Copy Einkaufswagen into your signature to help him on his way to world domination.

Who is online

Users browsing this forum: No registered users and 0 guests