mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Ghozer #186564 23/09/07 08:43 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As starbucks_mafia pointed out, they aren't the same thing. They are very different things. And they follow a specific structure defined in basic logic, so you can't just go and change how it for mIRC or you'll really mess people up. A new operator would work, but as mentioned, $istok works just fine for things like your ON/OFF example if you really didn't want to use the IF's.

Look at it like this:
if ($3) { }

That checks to see if $3 is not $null/$false/0, right?

if ($1 == !game || $3) { }

That checks if either $1 equals !game, or if $3 is not $null/$false/0.

Even combining them:
if ($1 == (!game || $3)) { }

It will still check the same comparison (if $1 equals !game, or if $3 is not $null/$false/0). In logic, that is NOT checking if $1 equals !game, or if $1 equals $3 no matter how you want to place your parentheses.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Originally Posted By: starbucks_mafia
Quote:
if (%a = %b) {
;%a now holds %b
}

Eck, I'd hate to see side-effect assignment in mIRC scripting. It's shady enough in other programming languages, in a supposedly "newb-friendly" language like mIRC's it'd only cause trouble and abuse. It's also redundant since in 99% of cases you can use $v1 instead.


I personally always quite like it in other languages, $v1 loses some of its 'power' with nesting. Nothing that cant be worked around with an extra line of variable assigning just a matter of personal preference and i prefer side-effect assignment smile

I take back what i suggested earlier:
var %a = %b || %c
can easily be achieved with $iif and although i prefer the first in other languages upon reading back i don't think this would be beneficial for mIRC as long as strings are not strictly denoted.
One of those non well thought through brain storm shout outs :p

back on topic:

//if ($1 == (!game || $3)) echo -a what?

is already ambiguous in mIRC it doesn't have to behave as

if ($1 == [ !game || $3 ] )

sort of speaking.

Last edited by Mpdreamz; 23/09/07 09:15 PM.

$maybe
Mpdreamz #186578 23/09/07 09:47 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Quote:
back on topic:

//if ($1 == (!game || $3)) echo -a what?

is already ambiguous in mIRC it doesn't have to behave as

if ($1 == [ !game || $3 ] )

sort of speaking.


Well it doesn't have to, it would just be a bad idea to change the semantics of common operators by making || behave like some kind of list-creation operator and == behave like a contains/is-subset operator in certain circumstances. It's technically feasible of course for mIRC to parse and interpret things any way it chooses. But it would be ugly as sin and confusing to anyone who's ever written anything in any other programming language or who simply understands and expects || and == to remain consistent throughout the language.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Page 2 of 2 1 2

Link Copied to Clipboard