mIRC Home    About    Download    Register    News    Help

Print Thread
#27178 31/05/03 06:03 AM
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
I was going through my Aliases.ini which has been accumulating entries since around 97, when I realized how many useful yet simple aliases I have that I use almost every day.

Besides the usual mode/op/kick type aliases, who would like to share something from their toybox? It could be something useful, something fun, or something so elegantly simple that it's a must for everyone's Aliases section.

/i { if ( $1 isnum ) { set %_i $1 | return %_i } | inc %_i | return %_i }
This one is handy for quickly incrimenting things at the command line.
Simply /i 0 to reset it to 0, and each call to $i returns a value and incriments it.

/math echo 2 -a *** MATH: $1- = $calc($1-)
/math 1+1 = simple enough, but I use it every day.

/baton set -u60 %BATON.i $calc(%BATON.i % 4 + 1) | return $gettok(/ - \ |,%BATON.i,32)
I often use this in long processes, like $findfile. Fun/Oldskool value.
/editbox -a $baton Processing... %file

Share yours.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Dec 2002
Posts: 395
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
Code:
q { quit $1- }

wink

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The simple aliases that I use most often:

/calc echo -a $calc($1-)
/asc echo -a $asc($1)

I'm not a big fan of the command line (I have toolbars and menus all over :tongue:), these must be two of the very few aliases I actually type.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
/close if ($1) close $1- | elseif ($chan) part $chan | else window -c $active
/notopic .raw TOPIC $iif($1 !ischan,#,$1) :
/nomode mode $iif($1 ischan,$1,#) - $+ $gettok($remove($chan($iif($1 ischan,$1,#)).mode,+,-),1,32) $chan($iif($1 ischan,$1,#)).key
/ntmode nomode $iif($1 ischan,$1,#) | mode $iif($1 ischan,$1,#) +nt


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
if # { part # | window -h # } smile

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
/updtimer {
did -z mp3 id 0 $inmp3.length
.timer 0 1 did -c mp3 id $!inmp3.pos
}
F1 /.ctcp # TIME
F2 /.ctcp # VERSION
F3 /.ctcp # FINGER
F4 /.ctcp # PING


new username: tidy_trax
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
blah { say blah }
:|

Joined: Jun 2003
Posts: 15
Z
Pikka bird
Offline
Pikka bird
Z
Joined: Jun 2003
Posts: 15
Some script experience assumed here...

Ping out realistically (by occupying mIRC so much that it can't send server pong back)
Code:
/pingout {
  window @pingout
  var %x = 0
  while (%x < 1) { echo @pingout HA HA HA! I'm-a-gonna ping out! }


PI
Code:
/pi { return 3.1415926535897932 }


duration with years support
Code:
/xduration {
  var %seconds = $1
  var %duration = $duration(%seconds)
  var %wks.pos = $pos(%duration,wks)
  if (%wks.pos) {
    var %wks.cnt = $mid(%duration,1,$calc(%wks.pos - 1))
    if (%wks.cnt >= 52) {
      var %years.f = $calc(%wks.cnt / 52)
      var %years.i = $gettok(%years.f,1,46)
      var %years = %years.i $+ $iif(%years.i == 1,yr,yrs)
      var %wks.cnt = $calc(%wks.cnt - (%years.i * 52))
      var %wks = %wks.cnt $+ $iif(%wks.cnt == 1,wk,wks)
      var %result.wo = $gettok(%duration,2-,32)
      var %result = %years %wks %result.wo
      return %result
    }
    else { return %duration }
  }
}


odd (or even)
Code:
/isodd {
  if ($right($1,1) isin 02468) { return $false }
  else { return $true }
}


Read in an html file and display document structure by headers. XHTML 2.0 deprecates the h tags (favoring them for section tags), but here we go anyway.
Code:
/outline {
  var %f = somefile.html
  var %lines = $lines(%f)
  var %l = 1
  while (%l <= %lines) {
    var %line = $read(%f,%l)
    if (<h1 isin %line) { echo -s %line }
    if (<h2 isin %line) { echo -s - $+ %line }
    if (<h3 isin %line) { echo -s -- $+ %line }
    if (<h4 isin %line) { echo -s --- $+ %line }
    if (<h5 isin %line) { echo -s ---- $+ %line }
    if (<h6 isin %line) { echo -s ----- $+ %line }
    inc %l
  }
}


returns what Nth window the given window name is.
e.g.
$windowID(#test)
Code:
alias windowID {
  var %windowname = $1
  var %numwindows = $window(*,0)
  var %x = 1
  while (%x <= %numwindows) {
    var %curwindow = $window(*,%x)
    if (%curwindow == %windowname) { return %x }
    inc %x
  }
  return -1
}


Input length warning. mIRC allows you to type way more text than some servers support.
This alias should be run on a (millisecond) timer.
%maxlen holds the maximum length.
The script will pop up a small flashing custom window which disappears when the length is okay again.

Probably better to capture the string with on:input and split it up into allowed ranges, but anyway.
Code:
alias inputLenWarning {
  var %text = $editbox($active) | var %active = $active
  var %maxlen = 450
  if ($calc($len(%text) + $len($active) - $iif($active ischan,1,0)) > %maxlen) {
    if ($window(@ILW) == $null) {
      set %inputLenWarning 0
      if ($active != $window(*,1)) { window -dhloC +bL @ILW -1 -1 190 16 |  window -a %active }
    }
    if ($active != $window(*,1)) { rline %inputLenWarning @ILW 1 WARNING! LINE TOO LONG! }
    inc %inputLenWarning | if (%inputLenWarning > 15) { set %inputLenWarning 0 }
    beep
  }
  else { unset %inputLenWarning | window -c @ILW
  }
  :_end
}


celsius to fahrenheit
Code:
alias c2f {
  var %f = $round($calc($1 * 9 / 5 + 32),2)
  if ($isid == $true) { return $1 $+ °C ( $+ %f $+ °F) }
  else { say $1 $+ °C is %f $+ °F }
}


and back
Code:
alias f2c {
  var %c = $round($calc(($1 - 32) * 5 / 9),2)
  if ($isid == $true) { return $1 $+ °F ( $+ %c $+ °C) }
  else { say $1 $+ °F is %c $+ °C }
}


backlog - press function key to go back up the log.
Useful if you /cleared a window -just- after somebody said something, and you want to find out what they said.
Repeated pressing moves further back through the log
Code:
alias f5 {
  if (%backlog == $null) { set -u5 %backlog 0 }
  .echo -an BL: $+ $read($window($active).logfile,$calc($lines($window($active).logfile) - %backlog - %backlog))
  inc -u5 %backlog
}


__________
ZeBoxx
¯¯¯¯¯¯¯¯¯¯

Link Copied to Clipboard