Quote:
1. Your problem is "var -s %r = $+(%r,$mid(%t,%a,1))", when it reaches a space in the string, $mid will evalutate to a space and your command will become "var -s %r = $+(%r, )". Obviously you cant $+ a space...

That's not it at all, try "var -s %r = $+(%r,$mid(%t,%a,1),anythinghere)" for example, you'll find it works if $mid() returns a space.

/var and /set can handle any number of consecutive or leading spaces; there only is a problem with a single trailing space. All mirc identifiers (including custom ones, if one uses the undocumented but apparently quite stable /returnex command) can also handle consecutive/leading/trailing spaces fine. Only /commands (other than /var and /set) strip leading/trailing spaces and reduce consecutive spaces to a single one. The interested reader can find lots more about the whole spaces issue in this comprehensive mIRC Internals Wiki article.

Examples:

//var %a = $str($chr(32),3) $+ a | echo -a $len(%a)
echoes "4". 3 consecutive leading spaces, followed by "a", were successfully stored in %a.

//var %a = $str($chr(32),3) | echo -a $len(%a)
echoes "3". 3 consecutive spaces where successfully stored in %a. Since nothing else follows, those are also trailing spaces.

//var %a = a $+ $str($chr(32),3) | echo -a $len(%a)
echoes "4". Similar to above.

//var %a = a $+ $str($chr(32),1) | echo -a $len(%a)
echoes "1". The space was lost in this case, because it was the last character and the character before that was not a space.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com