$fltok & $rmtok

By Scakk on Sep 17, 2008

The alias $fltok will return either the first token or last token.

Usage: $fltok(TEXT,C) = last token
Usage: $fltok(TEXT,C).f = first token

The alias $rmtok will return either a random token or the middle token.

Usage: $rmtok(TEXT,C) = middle token
Usage: $rmtok(TEXT,C).r = random token

/*
Will return either the first token or last token.
Usage: $fltok(TEXT,C) = last token
Usage: $fltok(TEXT,C).f = first token
*/

alias fltok { 
  if ($1 && $2 isnum && $isid) { return $gettok($1,$iif($prop == f,1,-1),$2) } 
  else { return Usage: $!fltok(TEXT,C) = last token $chr(124) Usage: $!fltok(TEXT,C).f = first token }
}

====================================================

/*
Will return either a random token or the middle token.
Usage: $rmtok(TEXT,C) = middle token
Usage: $rmtok(TEXT,C).r = random token
*/

alias rmtok { 
  if ($1 && $2 isnum && $isid) { return $gettok($1,$iif($prop == r, $rand(1,$numtok($1,$2)), $round($calc($numtok($1,$2) / 2),0)),$2) } 
  else { return Usage: $!rmtok(TEXT,C) = middle token $chr(124) Usage: $!rmtok(TEXT,C).r = random token }
}

Comments

Sign in to comment.
RusselB   -  Sep 20, 2008

My mistake on the code, and the alias, imo, is a waste, since you can get the same information with a few extra characters and using mIRC's built-in identifiers, rather than having all that extra code.

 Respond  
Scakk   -  Sep 20, 2008

RusselB.. You have that backwards.

$fltok(text,c) = $gettok(text,-1,c)
$fltok(text,c).f = $gettok(text,1,c)

Which is the way it is done in the above alias.

 Respond  
RusselB   -  Sep 20, 2008

$fltok(text,c) = $gettok(text,1,c)
$fltok(text,c).f = $gettok(text,-1,c)

 Respond  
vaseline28   -  Sep 18, 2008

+Like
Works really nicely and is useful :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.