Showalias:
This will do what the name says, it echo's out the alias source or a specified line if used as an identifier.
Usage:
/Showalias == Will echo out the alias source into @showalias
$showalias([ , <Line #> ])[.len] == Will return either the line specified or length of the line, depends if you used property .len
F-Keys:
With these 2 aliases you can navigate through your IRC channels using F4 and F5
Especially made this for the people that lay in bed with their laptop and are lazy to use mouse/touchpad to change channels :)
Update 26/8:
Added len $prop for $showalias to display the length of the specified line or the whole alias if no line is specified:
$showalias(showalias).len == Bytesize of showalias alias
$showalias(nohtml, 1).len == length of the first line of the alias 'nohtml'
/*
100% by FelicianoX (#mSL @ irc.swiftirc.net)
*/
/*
Showalias
*/
alias showalias {
var %win $+(@,showalias), %l $script($isalias($1).fname), %bytes
if (!$window(%win)) window $iif($isid,-ehz,-eza) %win
clear %win
if (!$1) echo %win Please enter an alias name, Syntax: /showalias <aliasName>
elseif ($read(%l, rn, /^alias (-l )?( $+ $1) /i) == $null) echo %win Alias $qt($1) not found
else {
echo %win Start of / $+ $1
var %a $readn, %d %a, %br 0
while (%a <= $lines(%l)) {
var %line $read(%l, n, %a)
inc %bytes $len(%line)
inc %br $findtok(%line, $chr(123), 0, 32)
dec %br $findtok(%line, $chr(125), 0, 32)
if (%br == 0) {
var %lastline $calc($lines($script($nopath(%l))) - ($lines($script($nopath(%l))) - %d) + (%a - %d)))
echo %win %bytes Bytes
echo %win -
loadbuf $+(%d,-,%lastline) -pi %win $qt(%l)
echo %win -
echo %win End of / $+ $1
echo %win Total lines: $calc((%a - %d) +1)
break
}
inc %a
}
if ($isid) {
var %line = $iif($2 != $null,$2,1)
if ($calc((%a - %d) +1) < %line) {
var %return = Alias $qt($1) only consists of $v1 lines
}
if ($prop == len) {
var %text = $regsubex($line(%win, $calc(%line + 3)), /\s+/g, $chr(32))
var %text = $mid(%text, $iif($left(%text, 1) == $chr(32), 2, 1))
var %return = $iif($2, $len(%text), %bytes)
}
if (%return == $null) {
var %return = $line(%win, $calc(%line + 3))
}
window -c %win
return %return
}
}
}
/*
F4, F5
*/
alias f4 window -a $chan($calc($iif($findtok($regsubex($str(.,$chan(0)),/./g,$chan(\n) $chr(32)),$active,1,32) != $chan(0),$v1,0)+1))
alias f5 window -a $chan($calc($iif($findtok($regsubex($str(.,$chan(0)),/./g,$chan(\n) $chr(32)),$active,1,32) != 1,$v1,$chan(0) +1)-1))