mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 6
M
myggan_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2006
Posts: 6
I have two questions:

A $calc() without an argument seems to halt the script processing, instead of returning $null or throw an error in the status window. Is this intented?

I also wonder why C-style variable assignments (%var = value) does not work on the command line.


void main
Joined: Mar 2004
Posts: 526
Fjord artisan
Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
not sure on item 1.
but for 2.. its //set %variable value

remember, from the command line, the interpreter needs 2 forward slashes to do its thing
and mirc uses /set its not exactly like c code


Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Joined: Mar 2006
Posts: 6
M
myggan_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2006
Posts: 6
Quote:
but for 2.. its //set %variable value


I know /set works, but since the %var = value statement is some sort of macro for /set, I don't see a reason for it not to work.
Try the following and you'll know what I mean:

Code:
//echo -a $(%var = value)


Using double slashes or not has nothing to do with it either, try:

Code:
//var %i | %i = 5 | echo -a %i


This will stop executing when it hits %i = 5, which leads to not producing the /echo.


void main
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You probably already know this, but the format for setting a variable using the /set command is /set %variable <value>
This sets a global variable.
Using the /var command the format is /var %variable = <value>
This sets a local variable.

While I have seen variables set using the format that you have used in your command line sequence, the only time I've seen it done is in a script format, not in a direct command line.

I tested this out, and while your command line code does work as you say, if you put in the var before the %i after the first pipe, then it does give the proper output.

I suspect that using %variable = <value> without the var command will only work in a scripted situation, but not in a direct command line.

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
I suspect that using %variable = <value> without the var command will only work in a scripted situation, but not in a direct command line.


That's his point.


Gone.
Joined: Mar 2006
Posts: 6
M
myggan_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2006
Posts: 6
Quote:
I suspect that using %variable = <value> without the var command will only work in a scripted situation, but not in a direct command line.


This was the point of my post, I wonder why %var = value does not work on the command line, while in remote it does. I use these kind of statements in my scripts, and I find it inconvenient that it does not work for the command line, when I want to write something quick in the editbox.

Also note that /var is NOT the same as %var = value (rather a collection of /set -l). There is also a noticable speed difference when using /var comparred to /set in loops.


void main
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
%var = value doesn't work in command line because any command that starts with a variable/identifier in the command line is blocked for security reasons ($decode stuff). Unfortunately, at the moment, mirc can't distinguish between a variable being a command name or part of a variable assignment.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Mar 2006
Posts: 6
M
myggan_ Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Mar 2006
Posts: 6
Quote:
%var = value doesn't work in command line because any command that starts with a variable/identifier in the command line is blocked for security reasons ($decode stuff). Unfortunately, at the moment, mirc can't distinguish between a variable being a command name or part of a variable assignment.


That's too bad. I hope Khaled will make an option to unlock these restrictions (being disabled by default as $decode, of course) or in some other way letting you set the security level.


void main

Link Copied to Clipboard