;url_code downloaded from http://www.mircscripts.org/showdoc.php?type=code&id=4448
alias url_encode {
var %i = 1, %len = $len($1), %str
while (%i <= %len) {
var %char = $asc($mid($1,%i,1)), %i = %i + 1
if (%char isnum 33-47) || (%char isnum 48-57) || (%char isnum 58-64) || (%char isnum 65-90) || (%char isnum 97-122) var %str = $+(%str,$chr(%char))
elseif (%char < 128) var %str = $+(%str,%,$base(%char,10,16,2))
elseif (%char < 2048) var %str = $+(%str,%,$base($calc(192 + $int($calc(%char / 64))),10,16,2),%,$base($calc(128 + (%char % 64)),10,16,2))
elseif (%char < 65536) var %str = $+(%str,%,$base($calc(224 + $int($calc(%char / 4096))),10,16,2),%,$base($calc(128 + ($int($calc(%char / 64)) % 64)),10,16,2),%,$base($calc(128 + (%char % 64)),10,16,2))
elseif (%char < 2097152) var %str = $+(%str,%,$base($calc(240 + $int($calc(%char / 262144))),10,16,2),%,$base($calc(128 + ($int($calc(%char / 4096)) % 64)),10,16,2),%,$base($calc(128 + ($int($calc(%char / 64)) % 64)),10,16,2),%,$base($calc(128 + (%char % 64)),10,16,2))
}
return %str
}
;example
on *:text:!lmgtfy ?*:#mark_paintball:{
tokenize 32 $2-
var %i = 1, %string = http://lmgtfy.com/?q=
while ( [ $ $+ [ %i ] ] != $null) {
%string = %string $+ $&
$url_encode($replacex([ $ $+ [ %i ] ],$,% $+ 24,%,% $+ 25)) $+ $iif(%i < $0,+)
inc %i
}
msg $chan %string
}