mIRC Homepage
Posted By: BoredNL set %var %var $+ $chr(32) - 20/07/03 07:54 AM
this does not add a space to the end of the variable.

I have a script that does something like this:
alias example { var %c 1 | var %var
while ( %c <= 50) { set %var %var $+ $chr($whatever)
inc %c }
return %var }

what happens is that when the $chr($whatever) spits out a space, it doesn't add it to the end of the variable. frown
Posted By: pheonix Re: set %var %var $+ $chr(32) - 20/07/03 08:12 AM
use the search feature, this has been expained many times, and also why it cant be fixed.
if mirc was allowed spaces on the end of a var and at the start of a var look what would happen when using tokenize:

var %x hello person
;space at end and start of var
tokenize 32 %x
$1 = hello
$2 =
$3 =
Posted By: lumpy_com Re: set %var %var $+ $chr(32) - 20/07/03 09:49 AM
Dont use $chr(32) .. but use $chr(255) or $chr(160) depending on font ..
One of them will return a hard space
Posted By: qwerty Re: set %var %var $+ $chr(32) - 20/07/03 11:23 AM
mirc cannot add a space to the end of a variable. Here is a thread related to this, with a few interesting approaches.
Posted By: lammkott Re: set %var %var $+ $chr(32) - 20/07/03 11:25 AM
I don't even know why you need to use $chr() at all...

Code:
alias test {
  var %x = 1,%result
  while (%x &lt;= 20) { var %result = %result %x | inc %x }
  echo -a %result
}


This alias will return:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Posted By: KingTomato Re: set %var %var $+ $chr(32) - 20/07/03 07:53 PM
mirc treats the space as a delimiter, i e it sees a space, and looks for somthing preceding it, or something after it. This means if you did

/did -ra $dname 1 (space)
(Just example)

The space would be ignored How is mirc to know you want the space? We already know consecutive spaces are killed, and here is another example. You have a space after the command, and another space for what is to be added.

The reason we use $chr() is that will fill up the parmter specifically with that vale, because now its being sent a value "$chr(32)" not just a deliimiter.
Posted By: lammkott Re: set %var %var $+ $chr(32) - 20/07/03 11:03 PM
The point I'm getting at is that with the alias I have shown, mIRC will still use $chr(32) to seperate each token, therefore there is no need to use something along the lines of %x $+ $chr(32), however, if a person does want to use $chr() in that way, it's best to use something like $chr(44) because mIRC will not add a space to the end of a variable which is not followed immediately by more text, like: %x $+ $chr(32) $+ %y
Posted By: ScatMan Re: set %var %var $+ $chr(32) - 21/07/03 07:29 AM
u can add to the variable more then one space at once and it will store one space at the end in the variable
for example:
//var %x = a $+ $str($chr(32),2) | var %x = %x $+ b | echo -a %x
will work fine

Posted By: sengehest Re: set %var %var $+ $chr(32) - 24/07/03 10:43 AM
I had the same problem.
Then I tried to use binary variables instead, and the problem went away.
© mIRC Discussion Forums