Archive

Posts Tagged ‘mIRC’

mirc.php for GeSHi

December 12th, 2007 1 comment

Seems there were a minor issue with the mirc.php file from GeSHi causing all code entries set to be parsed as mIRC scripts to stop with an error. Fixed (or rather made a dirty hack) it so my mIRC scripts once again could be highlighted :)

<?php
/*************************************************************************************
* mirc.php
* -----
* Author: Alberto 'Birckin' de Areba (Birckin@hotmail.com)
* Copyright: (c) 2006 Alberto de Areba
* Release Version: 1.0.7.20
* Date Started: 2006/05/29
*
* mIRC Scripting language file for GeSHi.
*
* CHANGES
* -------
* 2006/05/29 (1.0.0)
*   -  First Release
*
* 2007/12/12 (1.0.1) - Brian Schmidt Pedersen
*   -  Removed the forward slash from all mIRC keywords, since in actual
*       mIRC scripts, they're often written without the slash.
*   -  Entry 6 (timer parsing) under REGEXPS caused GeSHi to halt with an error
*       simple solution was to remove the slash(es)
*
*************************************************************************************
*
*     This file is part of GeSHi.
*
*   GeSHi is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   GeSHi is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with GeSHi; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
************************************************************************************/


$language_data = array (
    'LANG_NAME' => 'mIRC Scripting',
    'COMMENT_SINGLE' => array(
        1 => ';'
    ),
    'COMMENT_MULTI' => array(),
    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    'QUOTEMARKS' => array(),
    'ESCAPE_CHAR' => '',
    'KEYWORDS' => array(
        1 => array(
            'alias', 'menu', 'dialog'
        ),
        2 => array(
            'if', 'elseif', 'else', 'while', 'return', 'goto'
        ),
        3 => array(
            'action', 'ajinvite', 'alias', 'aline', 'amsg', 'ame', 'anick',
            'aop','auser', 'avoice', 'auto', 'autojoin', 'away', 'background',
            'ban', 'beep', 'channel', 'clear', 'clearall', 'clipboard',
            'close', 'closemsg', 'color', 'copy', 'creq', 'ctcp', 'ctcpreply',
            'ctcps', 'dcc', 'dde', 'ddeserver', 'debug', 'describe', 'disable',
            'disconnect', 'dlevel', 'dll', 'dns', 'dqwindow', 'ebeeps', 'echo',
            'editbox', 'emailaddr', 'enable', 'events', 'exit', 'filter',
            'findtext', 'finger', 'flash', 'flood', 'flush', 'flushini',
            'font', 'fsend', 'fserve', 'fullname', 'ghide', 'gload', 'gmove',
            'gopts', 'gplay', 'gpoint', 'gqreq', 'groups', 'gshow', 'gsize',
            'gstop', 'gtalk', 'gunload', 'guser', 'halt', 'haltdef', 'help',
            'hop', 'ignore', 'inc', 'invite', 'join', 'kick', 'linesep',
            'links', 'list', 'load', 'loadbuf', 'localinfo', 'log', 'me',
            'mdi', 'mkdir', 'mnick', 'mode', 'msg', 'names', 'nick', 'noop',
            'notice', 'notify', 'omsg', 'onotice', 'part', 'partall', 'pdcc',
            'perform', 'ping', 'play', 'pop', 'protect', 'pvoice', 'qmsg',
            'qme', 'query', 'queryrn', 'quit', 'raw', 'remini', 'remote',
            'remove', 'rename', 'renwin', 'resetidle', 'rlevel', 'rmdir',
            'run', 'ruser', 'save', 'savebuf', 'save', 'saveini', 'say',
            'server', 'set', 'showmirc', 'sline', 'sound', 'speak', 'splay',
            'sreq', 'strip', 'time', 'timers', 'timestamp', 'titlebar',
            'tnick', 'tokenize', 'topic', 'ulist', 'unload', 'updatenl', 'url',
            'uwho', 'var', 'window', 'winhelp', 'write', 'writeini', 'who',
            'whois', 'whowas'
        )
    ),
    'SYMBOLS' => array(
        '(', ')', '{', '}', '[', ']', '|'
    ),
    'CASE_SENSITIVE' => array(
        GESHI_COMMENTS => true,
        1 => false,
        2 => false
    ),
    'STYLES' => array(
        'KEYWORDS' => array(
            1 => 'color: #994444;',
            2 => 'color: #000000; font-weight: bold;',
            3 => 'color: #990000; font-weight: bold;'
        ),
        'COMMENTS' => array(
            1 => 'color: #808080; font-style: italic;'
        ),
        'ESCAPE_CHAR' => array(),
        'BRACKETS' => array(
            0 => 'color: #FF0000;'
        ),
        'STRINGS' => array(),
        'NUMBERS' => array(
            0 => ''
        ),
        'METHODS' => array(),
        'SYMBOLS' => array(
            0 => 'color: #FF0000;'
        ),
        'REGEXPS' => array(
            0 => 'color: #000099;',
            1 => 'color: #990000;',
            2 => 'color: #888800;',
            3 => 'color: #888800;',
            4 => 'color: #000099;',
            5 => 'color: #000099;',
            6 => 'color: #990000; font-weight: bold;'
        ),
        'SCRIPT' => array()
    ),
    'URLS' => array(
        1 => '',
        2 => '',
        3 => '',
        4 => ''
    ),
    'OOLANG' => false,
    'OBJECT_SPLITTERS' => array(),
    'REGEXPS' => array(
        0 => '\$[^$][^ ,\(\)]*',
        1 => '(%|&).+?[^ ,\)]*',
        2 => '(#|@).+?[^ ,\)]*',
        3 => '-[a-z\d]+',
        4 => '(on|ctcp) (!|@|&)?(\d|\*):[a-zA-Z]+:',
        /*
        4 => array(
        GESHI_SEARCH => '((on|ctcp) (!|@|&)?(\d|\*):(Action|Active|Agent|AppActive|Ban|Chat|Close|Connect|Ctcp|CtcpReply|DccServer|DeHelp|DeOp|DeVoice|Dialog|Dns|Error|Exit|FileRcvd|FileSent|GetFail|Help|Hotlink|Input|Invite|Join|KeyDown|KeyUp|Kick|Load|Logon|MidiEnd|Mode|Mp3End|Nick|NoSound|Notice|Notify|Op|Open|Part|Ping|Pong|PlayEnd|Quit|Raw|RawMode|SendFail|Serv|ServerMode|ServerOp|Signal|Snotice|Start|Text|Topic|UnBan|Unload|Unotify|User|Mode|Voice|Wallops|WaveEnd):)',
        GESHI_REPLACE => '\\1',
        GESHI_MODIFIERS => 'i',
        GESHI_BEFORE => '',
        GESHI_AFTER => ''
        ),
        */

        5 => 'raw (\d|\*):',
        6 => 'timer(?!s\b)[0-9a-zA-Z_]+'
    ),
    'STRICT_MODE_APPLIES' => GESHI_NEVER,
    'SCRIPT_DELIMITERS' => array(),
    'HIGHLIGHT_STRICT_BLOCK' => array()
);
?>
Categories: Code Tags: , , , ,

antispam.mrc – Block spammers

;;;; Anti Spam v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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.                                        ;;
;;                                                                            ;;
;; Very simple spamblocking script, blocks private message if they contain a  ;;
;; word (usually urls) that are stored in it's dbfile.                        ;;
;;                                                                            ;;
;; Right click in a query window, or click the custom menu in the menubar to  ;;
;; configure it/enable it.                                                    ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

;; Make sure the variable, with the file containing the list of blocked strings
;; are set at script start.
on *:START:{
    set %_antispam_dbfile spamdb.txt
    echo -tc info *** Anti-Spam by Brian Schmidt loaded..
}

alias antispam {
    if ($1 == add || $1 == a) {
        if (!$read(%_antispam_dbfile,w,$$2)) {
            write %_antispam_dbfile $encode($$2)
            echo -tac info *** Adding $$2 to %_antispam_dbfile
        }
        else {
            echo -tac info *** $$2 allready in %_antispam_dbfile
        }
    }
    elseif ($1 == remove || $1 == rem || $1 == r || $1 == delete || $1 == del || $1 == d) {
        if ($read(%_antispam_dbfile,w,$encode($$2))) {
            write -dw $encode($$2) %_antispam_dbfile
            echo -tac info *** Removed $$2 from %_antispam_dbfile
        }
        else {
            echo -tac info *** $$2 not in %_antispam_dbfile
        }
    }
    elseif ($1 == check || $1 == c) {
        if (%_antispam_status != $null && %_antispam_status != 0 && %_antispam_status != off) {
            var %i 1
            while (%i <= $numtok($2-,32)) {
                if ($read(%_antispam_dbfile,w,$encode($gettok($2-,%i,32)))) {
                    if ($line($nick,0) == 0) {
                        window -c $window($nick)
                    }
                    halt
                }
                inc %i
            }
        }
    }
    elseif ($1 == status) {
        if ($2 == 1 || $2 == on) {
            set %_antispam_status 1
            echo -tac info *** Anti-Spam enabled.
        }
        elseif ($2 == 0 || $2 == off) {
            set %_antispam_status 0
            echo -tac info *** Anti-Spam disabled.
        }
    }
    elseif ($1 == list || $1 == l) {
        window -dClk0 @Anti-Spam
        var %c = $lines(%_antispam_dbfile)
        if (%c > 0) {
            var %i = 1
            while (%i <= %c) {
                aline -p @Anti-Spam $decode($read(%_antispam_dbfile,t,%i))
                inc %i
            }
        }
    }
}

;; The popup menus.
menu query,menubar {
    -
    Anti-Spam
    .$iif(%_antispam_status == 0 || %_antispam_status == $null,Enable):antispam status on
    .$iif(%_antispam_status == 1,Disable):antispam status off
    .Configure:antispam list
    -
}
menu @Anti-Spam {
    dclick:if ($input(Delete $line(@Anti-Spam,$1),y,Confirm delete)) { antispam rem $line(@Anti-Spam,$1) | dline @Anti-Spam $1 }
    Add..:var %antispam_tmp_add $input(Add spamline,e) | antispam add %antispam_tmp_add | aline @Anti-Spam %antispam_tmp_add
}

;; Catch all (private) text and check it for spam.
on ^&*:TEXT:*:?:{
    antispam check $1-
}
on ^&*:ACTION:*:?:{
    antispam check $1-
}
Categories: Code Tags: , ,

age.mrc – Calculate Your Age

;;;; My Age v1.1.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 tell how old you are in seconds, or minutes etc.          ;;
;;                                                                            ;;
;; Commands available:                                                        ;;
;;   /myage                                                                   ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.0                                                                     ;;
;; + Added possibility to only say your age in one format (hour/sec etc.).    ;;
;; * Changed the actual trigger alias from /age to /myage. The age alias is   ;;
;;   only used as an identifier that returns the value to the calling script. ;;
;; + Will now ask for your birthdate when run, if it isn't set. Then store it ;;
;;   in a variable for later use.                                             ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias age {
    var %unix = $ctime($$1-)
    var %now = $ctime
    var %seconds = $calc( %now - %unix )
    var %minutes = $calc( %seconds / 60 )
    var %hours = $calc( %minutes / 60 )
    var %days = $calc( %hours / 24 )
    var %weeks = $calc( %days / 7 )
    var %years = $calc( %days / 365.22222222222 )
    var %months = $calc( %years * 12 )

    if ($prop == seconds) return %seconds
    elseif ($prop == minutes) return %minutes
    elseif ($prop == hours) return %hours
    elseif ($prop == days) return %days
    elseif ($prop == weeks) return %weeks
    elseif ($prop == months) return %months
    elseif ($prop == years) return %years
    else return %years
}

alias myage {
    if (%myage.birthday == $null || $1 == set) {
        set %myage.birthday $$input(What is your birth date? $+ $crlf $+ Example: $+ $crlf 13.12.1976 23:59:59,e,Birth date?)
    }
    if ($1 == sec) msg $active I am $age(%myage.birthday).seconds seconds old.
    elseif ($1 == min || $1 == minute || $1 == minutes) msg $active I am $age(%myage.birthday).minutes minutes old.
    elseif ($1 == hrs || $1 == hour || $1 == hours) msg $active I am $age(%myage.birthday).hours hours old.
    elseif ($1 == day || $1 == days) msg $active I am $age(%myage.birthday).days days old.
    elseif ($1 == wek || $1 == week || $1 == weeks) msg $active I am $age(%myage.birthday).weeks weeks old.
    elseif ($1 == mth || $1 == month || $1 == months) msg $active I am $age(%myage.birthday).months months old.
    elseif ($1 == yrs || $1 == year || $1 == years) msg $active I am $age(%myage.birthday).years years old.
    else msg $active My age in: Seconds: $age(%myage.birthday).seconds $+ . Minutes: $age(%myage.birthday).minutes $+ . Hours: $age(%myage.birthday).hours $+ . Days: $age(%myage.birthday).days $+ . Weeks: $age(%myage.birthday).weeks $+ . Months: $age(%myage.birthday).months $+ . Years: $age(%myage.birthday).years $+ .
}
Categories: Code Tags: , ,

csize.mrc – Convert Size

;;;; Convert Size v1.1.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.                                        ;;
;;                                                                            ;;
;; This script is used to convert size in bytes to a nice to KB/MB/GB etc.    ;;
;;                                                                            ;;
;; There are 2 ways to use this scripts:                                      ;;
;; 1. Message to active window with /csize:                                   ;;
;;      "/csize /csize 54653875238"                                           ;;
;;    Will output:                                                            ;;
;;      "50.9 GB"                                                             ;;
;; 2. Can also be used for in-line reverse with $rev in scripts etc.          ;;
;;      "//echo -a Converting 54653875238 bytes to $csize(54653875238).ext    ;;
;;       gives $csize(54653875238) $csize(54653875238).ext"                   ;;
;;    Will output:                                                            ;;
;;      "Converting 54653875238 bytes to GB gives 50.900388 GB"               ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.1.1                                                                     ;;
;; * Fixed $csize().ext always returning YiB                                  ;;
;;                                                                            ;;
;; v1.1.0                                                                     ;;
;; + Added posiblitiy to convert to a specific type with identifiers.         ;;
;;   $csize(50000000) returns 47.683716 (MiB)                                 ;;
;;   $csize(50000000).gib returns 0.046566 (GiB)                              ;;
;;   This can't be done with the "b" property, wich is also irrelevant, since ;;
;;   the Bytes is allready what you have.                                     ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias csize {
    if ($len($$1) <= 3) {
        var %csize $$1
        var %csize.ext B
    }
    if ($len($$1) > 3 || ($prop != $null && $prop == kib)) {
        var %csize $calc( $$1 / 1024 )
        var %csize.ext KiB
        if ($prop == kib) return %csize
    }
    if ($len($$1) > 6 || ($prop != $null && $prop == mib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext MiB
        if ($prop == mib) return %csize
    }
    if ($len($$1) > 9 || ($prop != $null && $prop == gib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext GiB
        if ($prop == gib) return %csize
    }
    if ($len($$1) > 12 || ($prop != $null && $prop == tib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext TiB
        if ($prop == tib) return %csize
    }
    if ($len($$1) > 15 || ($prop != $null && $prop == pib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext PiB
        if ($prop == pib) return %csize
    }
    if ($len($$1) > 18 || ($prop != $null && $prop == eib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext EiB
        if ($prop == eib) return %csize
    }
    if ($len($$1) > 21 || ($prop != $null && $prop == zib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext ZiB
        if ($prop == zib) return %csize
    }
    if ($len($$1) > 24 || ($prop != $null && $prop == yib)) {
        var %csize $calc( %csize / 1024 )
        var %csize.ext YiB
        if ($prop == yib) return %csize
    }
    if ($isid == $true) {
        if ($prop == ext) {
            return %csize.ext
        }
        return %csize
    }
    else {
        msg $active $round(%csize,2) %csize.ext
    }
}
Categories: Code Tags: , ,

everyone.mrc – Greet everyone in a channel

;;;; Everyone 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.                                        ;;
;;                                                                            ;;
;; Return all nicks (except your own) for use in fun/annoying scripts.        ;;
;;                                                                            ;;
;; Identifiers available:                                                     ;;
;;   $everyone                                                                ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

alias everyone {
    var %i = 1
    var %c = 0
    var %total = $nick($chan,0)
    while (%i <= %total) {
        if (%i < %total) var %seperator = , $chr(32)
        else var %seperator = $chr(32) and $chr(32)
        if ($nick($chan,%i) != $me) {
            if (%c == 0) var %out = $nick($chan,%i)
            else var %out = %out $+ %seperator $+ $nick($chan,%i)
            inc %c
        }
        inc %i
    }
    return %out
}
Categories: Code Tags: , ,

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-
        }
    }
}
Categories: Code Tags: , ,

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-)
}
Categories: Code Tags: , ,

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( [,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
}
Categories: Code Tags: , ,

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)
}
Categories: Code Tags: , ,

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
}
Categories: Code Tags: , ,