Quote:
//echo -a Blahblhablha $hide(LOL) blahblha
Code:
alias hide {
return $replace($1,$1,$str($chr(42),$len($1)))
}


And what if the text contains spaces, punctuation or other non-word characters?

//echo -a $hide(It's some text!) --> ***************

Technically, that result is correct, but for the sake of a trivia bot should be **'* **** ****!


You could correct that by modifying the code similar to the following:

Code:
alias hide {
  var %t = $replace($1,$chr(32),$chr(160)), %i = 1, %l = $len(%t), %h
  while (%i <= %l) {
    if ($mid(%t,%i,1) isalnum) %h = $+(%h,*)
    else %h = $+(%h,$mid(%t,%i,1))
    inc %i
  }
  return $replace(%h,$chr(160),$chr(32))
}


//echo -a $hide(It's some text!) --> **'* **** ****!

However, that's slow and ugly. It can be reduced to a simple regsubex that accomplishes the same task much faster, especially when dealing with long strings of text.

Code:
alias hide return $regsubex($1,/([^\W_]+)/g,$str(*,$len(\t)))


//echo -a $hide(#1 trivia superstar!) --> #* ****** *********!

Note: mIRC 6.17 is required to use $regsubex.