Archive for the ‘mIRC’ Category.

hli.mrc - Highlight Ignore

;;;; Highlight Ignore v1.1.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Simple script to enable/disable highlights on the fly.                     ;;
;;                                                                            ;;
;; Commands available:                                                        ;;
;;   /hli                                                                     ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.1                                                                     ;;
;; * Fixed script so it catches all highlights, but doesn't catch numbers     ;;
;;   which $me apparently tends to catch.                                     ;;
;;   Only works with 1 word in each highlight entry :(                        ;;
;; * Changed the date syntax which was used in the @Hightlights window.       ;;
;;                                                                            ;;
;; v1.1.0                                                                     ;;
;; * Rewrote code to be nicer/more compact.                                   ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias hli {
  if (%hli.status != $null && %hli.status != 0 && %hli.status != off) {
    set %hli.status 0
    echo -tac info *** Highlight ignore is OFF: mIRC will now act according to your Highlight Settings.
  }
  else {
    set %hli.status 1
    echo -tac info *** Highlight ignore is ON: mIRC will no longer flash or beep when you get highlighted.
  }
}

on ^*:TEXT:*:*: {
  if ($matchtok($1-, $highlight($1-), 0, 32)) {
    if ($window(@Highlights) == $null) window -n @Highlights
   echo @Highlights [[ $+ $asctime(yyyy-mm-dd HH:nn:ss) $+ ]] < $+ $nick $+ $iif($chan != $null,@ $+ $chan,) $+ @ $+ $network $+ > $1-
   if (%hli.status == 1 || %hli.status == on) {
      haltdef
      if ($target == $nick || $target == =$nick) var %target = $iif(=* iswm $active,=$nick,$nick)
      else var %target = $target
     echo $highlight($1-).color -t %target < $+ $nick $+ > $1-
   }
  }
}

on ^*:ACTION:*:*: {
  if ($matchtok($1-, $highlight($1-), 0, 32)) {
    if ($window(@Highlights) == $null) window -n @Highlights
   echo -c action @Highlights [[ $+ $asctime(yyyy-mm-dd HH:nn:ss) $+ ]] * $+ $nick $+ $iif($chan != $null,@ $+ $chan,) $+ @ $+ $network $1-
   if (%hli.status == 1 || %hli.status == on) {
      haltdef
      if ($target == $nick || $target == =$nick) var %target = $iif(=* iswm $active,=$nick,$nick)
      else var %target = $target
     echo $highlight($1-).color -t %target * $nick $1-
   }
  }
}

morse.mrc - Morse Talk

;;;; Morse Talk v1.0.2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; This morse script is only able to convert to and from 0-9 and A-Z          ;;
;;                                                                            ;;
;; The script consists of 2 identifiers, 1 alias and a MORSE-to-normal text   ;;
;; catcher.                                                                   ;;
;;                                                                            ;;
;; To talk to the active window, with morse code simply type:                 ;;
;;   "/morse This will be written in morse code"                              ;;
;; Will output:                                                               ;;
;;   "[s2m] - .... .. ...  .-- .. .-.. .-..  -... .  .-- .-. .. - - . -.      ;;
;;    .. -.  -- --- .-. ... .  -.-. --- -.. . "                               ;;
;;                                                                            ;;
;; Any user that have the same morse script loaded will have the morse code   ;;
;; automatically converted into normal text, so they will actually see the    ;;
;; following on their screen:                                                 ;;
;;   "[m2s] THIS WILL BE WRITTEN IN MORSE CODE"                               ;;
;;                                                                            ;;
;; The 2 identifiers available is $string2morse and $morse2string, wich can   ;;
;; be used in other scripts.                                                  ;;
;;   "//echo -a Some of $string2morse(this) text will be in morse"            ;;
;; Will output:                                                               ;;
;;   "Some of - .... .. ...  text will be in morse"                           ;;
;; And:                                                                       ;;
;;   "//echo -a $morse2string(- .... .. ... )"                                ;;
;; Will output:                                                               ;;
;;   "THIS"                                                                   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.2                                                                     ;;
;; * Fixed many of the scripts replacement routines.                          ;;
;; + Added automatic morse->ascii conversion between several people using     ;;
;;   script.                                                                  ;;
;; * Split up the parts of the script, so that it will be easier to use in    ;;
;;   other scripts.                                                           ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias string2morse {
  var %string2morse = $replace($1-,$chr(32),$chr(15) $+ $chr(32))
  var %string2morse = $replace(%string2morse,A,$chr(15) $+ .- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,B,$chr(15) $+ -... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,C,$chr(15) $+ -.-. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,D,$chr(15) $+ -.. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,E,$chr(15) $+ . $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,F,$chr(15) $+ ..-.- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,G,$chr(15) $+ --. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,H,$chr(15) $+ .... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,I,$chr(15) $+ .. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,J,$chr(15) $+ .--- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,K,$chr(15) $+ -.- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,L,$chr(15) $+ .-.. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,M,$chr(15) $+ -- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,N,$chr(15) $+ -. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,O,$chr(15) $+ --- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,P,$chr(15) $+ .--. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,Q,$chr(15) $+ --.- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,R,$chr(15) $+ .-. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,S,$chr(15) $+ ... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,T,$chr(15) $+ - $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,U,$chr(15) $+ ..- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,V,$chr(15) $+ ...- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,W,$chr(15) $+ .-- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,X,$chr(15) $+ -..- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,Y,$chr(15) $+ -.-- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,Z,$chr(15) $+ --.. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,0,$chr(15) $+ ----- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,1,$chr(15) $+ .---- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,2,$chr(15) $+ ..--- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,3,$chr(15) $+ ...-- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,4,$chr(15) $+ ....- $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,5,$chr(15) $+ ..... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,6,$chr(15) $+ -.... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,7,$chr(15) $+ --... $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,8,$chr(15) $+ ---.. $+ $chr(32) $+ $chr(15))
  var %string2morse = $replace(%string2morse,9,$chr(15) $+ ----. $+ $chr(32) $+ $chr(15))
  return %string2morse
}

alias
morse2string {
  var %morse2string = $replace($1-,$chr(15) $+ $chr(32),$chr(32))
  var %morse2string = $replace(%morse2string,$chr(15) $+ .- $+ $chr(32) $+ $chr(15),A)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -... $+ $chr(32) $+ $chr(15),B)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -.-. $+ $chr(32) $+ $chr(15),C)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -.. $+ $chr(32) $+ $chr(15),D)
  var %morse2string = $replace(%morse2string,$chr(15) $+ . $+ $chr(32) $+ $chr(15),E)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ..-.- $+ $chr(32) $+ $chr(15),F)
  var %morse2string = $replace(%morse2string,$chr(15) $+ --. $+ $chr(32) $+ $chr(15),G)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .... $+ $chr(32) $+ $chr(15),H)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .. $+ $chr(32) $+ $chr(15),I)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .--- $+ $chr(32) $+ $chr(15),J)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -.- $+ $chr(32) $+ $chr(15),K)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .-.. $+ $chr(32) $+ $chr(15),L)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -- $+ $chr(32) $+ $chr(15),M)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -. $+ $chr(32) $+ $chr(15),N)
  var %morse2string = $replace(%morse2string,$chr(15) $+ --- $+ $chr(32) $+ $chr(15),O)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .--. $+ $chr(32) $+ $chr(15),P)
  var %morse2string = $replace(%morse2string,$chr(15) $+ --.- $+ $chr(32) $+ $chr(15),Q)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .-. $+ $chr(32) $+ $chr(15),R)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ... $+ $chr(32) $+ $chr(15),S)
  var %morse2string = $replace(%morse2string,$chr(15) $+ - $+ $chr(32) $+ $chr(15),T)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ..- $+ $chr(32) $+ $chr(15),U)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ...- $+ $chr(32) $+ $chr(15),V)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .-- $+ $chr(32) $+ $chr(15),W)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -..- $+ $chr(32) $+ $chr(15),X)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -.-- $+ $chr(32) $+ $chr(15),Y)
  var %morse2string = $replace(%morse2string,$chr(15) $+ --.. $+ $chr(32) $+ $chr(15),Z)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ----- $+ $chr(32) $+ $chr(15),0)
  var %morse2string = $replace(%morse2string,$chr(15) $+ .---- $+ $chr(32) $+ $chr(15),1)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ..--- $+ $chr(32) $+ $chr(15),2)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ...-- $+ $chr(32) $+ $chr(15),3)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ....- $+ $chr(32) $+ $chr(15),4)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ..... $+ $chr(32) $+ $chr(15),5)
  var %morse2string = $replace(%morse2string,$chr(15) $+ -.... $+ $chr(32) $+ $chr(15),6)
  var %morse2string = $replace(%morse2string,$chr(15) $+ --... $+ $chr(32) $+ $chr(15),7)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ---.. $+ $chr(32) $+ $chr(15),8)
  var %morse2string = $replace(%morse2string,$chr(15) $+ ----. $+ $chr(32) $+ $chr(15),9)
  return %morse2string
}

alias
morse {
  echo -tac info Wrote: $1-
 msg $active [s2m] $string2morse($1-)
}

on ^*:TEXT:[s2m]*:*:{
  haltdef
  echo -tc normal $target < $+ $nick $+ > [m2s] $morse2string($2-)
}

progress.mrc - Progress Meter

;;;; Progress Meter v1.0.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan aka. b|man.                                  ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; This script is mainly used in other script for creating percentage         ;;
;; progress bars.                                                             ;;
;; Simply use it like this:                                                   ;;
;; $progress(100) and offcourse replace 100 with whatever percentage it needs ;;
;; to fill out.                                                               ;;
;; You can feed it optional parameters for the design of the bar:             ;;
;; $progress(<percent>[,filled[,not-filled[,bracket-begin[,bracket-end]]]])   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.1                                                                     ;;
;; * Fixed optional fill-char/not-fill-char.                                  ;;
;; - Removed the possibility to replace the brackets on-the-fly due to the    ;;
;;   fact that it didn't work. Trying to figure out a good way to do this.    ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias progress {
  var %prc $round($calc( $$1 / 10),0)
  var %i = 1
  while ($len(%out) < 10) {
    if (%i <= %prc) var %out = %out $+ |
    else var %out = %out $+ .
    inc %i
 }
  if ($2 != $null) var %out = $replace(%out,|,$2)
  if ($3 != $null) var %out = $replace(%out,.,$3)
  ;; Commented out due to not working, see changelog for v1.0.1
  ;; if ($4 != $null && $5 != $null) var %out = $replace(%out,|,$4) var %out = $4 $+ %out $+ $5
  ;; else var %out = $chr(91) $+ %out $+ $chr(93)
  var %out = $chr(91) $+ %out $+ $chr(93)
  return %out
}

shortDuration.mrc - Simpler, shorter duration

;;;; Short Duration v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Very simple script that gives me an extra identifier for making the        ;;
;; duration delivered by mIRC's own $duration shorter and cleaner.            ;;
;; really very customizable                                                   ;;
;;                                                                            ;;
;; Identifiers available:                                                     ;;
;;   $shortDuration()                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias shortDuration {
  return $replace($1-,$chr(32),,secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
}

simple_amip.mrc - Simple AMIP Announcer

;;;; Simple AMIP Announcer v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Simple script to announce in a channel what you're listening to.           ;;
;; The scripts interacts with the AMIP plugin for WinAMP, which can be found  ;;
;; on this address: http://amip.tools-for.net/wiki/                           ;;
;;                                                                            ;;
;; This script has it's 2 default outputs bound to the F3 and Shift+F3 keys.  ;;
;;                                                                            ;;
;; Identifiers available:                                                     ;;
;;   $amip_announce                                                           ;;
;;                                                                            ;;
;; Examples:                                                                  ;;
;;   msg $active $amip_announce                                               ;;
;;   msg $active $amip_announce(xml)                                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias F3 /msg $active $amip_announce
alias
SF3 /msg $active $amip_announce(xml)
alias amip_announce {
  ;; Check if it's a stream or a file.
  if (($left($dde mPlug var_fn "",7) == http://) || ($left($dde mPlug var_fn "",8) == https://)) {
    var %is_stream = 1
  }
  else {
    var %is_stream = 0
  }

  ;; Fetch the various information from AMIP.
  var %tag.auto = $dde mPlug var_name ""
 var %tag.fullpath = $dde mPlug var_fn ""
 var %tag.extension = $iif(%is_stream == 1,stream,$dde mPlug var_ext "")
  var %tag.artist = $dde mPlug var_1 ""
 var %tag.title = $dde mPlug var_2 ""
 var %tag.album = $dde mPlug var_4 ""
 var %tag.track = $dde mPlug var_3 ""
 var %tag.bitrate = $dde mPlug var_br ""
 ;; These can only be set if it's not a stream.
  if (%is_stream == 0) {
    var %tag.length.sec = $dde mPlug var_sl ""
   var %tag.length.nice = $replace($duration(%tag.length.sec),secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
    var %tag.size.byte = $file($dde mPlug var_fn "").size
    var %tag.size.nice = $round($csize(%tag.size.byte),2)
    var %tag.size.nice.ext = $csize(%tag.size.byte).ext
  }
  if ($1 == xml) {
    var %output = < $+ %tag.extension
   if ((%tag.artist == $null) || ($len(%tag.artist) == 0) || (%tag.title == $null) || ($len(%tag.title) == 0)) {
      var %output = %output $+ $chr(32) $+ song=" $+ %tag.auto  $+ "
   }
    else {
      var %output = %output $+ $chr(32) $+ artist=" $+ %tag.artist  $+ "
     var %output = %output $+ $chr(32) $+ title=" $+ %tag.title  $+ "
   }
    if ((%tag.album != $null)) {
      var %output = %output $+ $chr(32) $+ album=" $+ %tag.album $+ "
   }
    if ((%tag.track != $null) && ($len(%tag.track) != 0)) {
      var %output = %output $+ $chr(32) $+ track=" $+ %tag.track $+ "
   }
    if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ length=" $+ %tag.length.nice $+ "
     var %output = %output $+ $chr(32) $+ size=" $+ %tag.size.nice $+ $chr(32) $+ %tag.size.nice.ext $+ "
   }
    var %output = %output $+ $chr(32) $+ bitrate=" $+ %tag.bitrate $+ "
   if (%is_stream == 1) {
      var %output = %output $+ $chr(32) $+ url=" $+ %tag.fullpath $+ "
   }
    var %output = %output $+ $chr(32) $+ />
 }
  elseif ($1 == action) {
    var %output = is listening to:
    var %output = %output $+ $chr(32) $+ %tag.auto
   if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
    }
    else {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
    }
  }
  else {
    var %output = %tag.extension $+ :
    var %output = %output $+ $chr(32) $+ %tag.auto
   if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
    }
    else {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
    }
  }
  return %output
}