mIRC Home    About    Download    Register    News    Help

Print Thread
#37307 20/07/03 07:54 AM
Joined: Jan 2003
Posts: 154
B
BoredNL Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Jan 2003
Posts: 154
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


- Wherever you go there you are.[color:lightgreen]
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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 =


new username: tidy_trax
Joined: Feb 2003
Posts: 7
L
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2003
Posts: 7
Dont use $chr(32) .. but use $chr(255) or $chr(160) depending on font ..
One of them will return a hard space

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
mirc cannot add a space to the end of a variable. Here is a thread related to this, with a few interesting approaches.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: May 2003
Posts: 215
Fjord artisan
Offline
Fjord artisan
Joined: May 2003
Posts: 215
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


- Jason
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
Joined: May 2003
Posts: 215
Fjord artisan
Offline
Fjord artisan
Joined: May 2003
Posts: 215
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


- Jason
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
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


Joined: Jul 2003
Posts: 2
S
Bowl of petunias
Offline
Bowl of petunias
S
Joined: Jul 2003
Posts: 2
I had the same problem.
Then I tried to use binary variables instead, and the problem went away.


Link Copied to Clipboard