mIRC Homepage
Posted By: Wolfie isnull - 06/05/04 05:15 AM
Instead of "%x == $null" be able to do "%x isnull" just because it might make it easier to script some grin

If not, then a reminder of that other suggestion I made about being able to write your own operators like...
Code:
OPERATOR isnull { return $iif($1 == $null,$true,$false) }


smile
Posted By: Seifer Re: isnull - 07/05/04 12:15 AM
How about just using !%x?
Posted By: zack Re: isnull - 07/05/04 05:01 AM
That'll react when %x is 0, 0 != $null.
Posted By: zack Re: isnull - 07/05/04 05:03 AM
Making your own operators would be so handy. Really, REALLY, handy.

* zack pleads to Khaled.
Posted By: FiberOPtics Re: isnull - 07/05/04 09:09 AM
Hi,

I don't see why you need to create your own operators when you can create custom identifiers.

Typing if %x isnull doesn't seem to be more convenient than typing if $isnull(%x)

So just make the custom identifier (which you would also have to do if creating operators was enabled), and then simply use it in the if condition, like if $myidentifier(...) { do stuff }

Note that even though I replied to you, it doesn't necessarily mean it was directed to you, just a general comment.


Greetz
Posted By: starbucks_mafia Re: isnull - 07/05/04 10:57 AM
Well I don't really agree with %x isnull over %x == $null since it doesn't change anything, however the difference between using an operator and an identifier is that with an operator you can use $ifmatch later.
Posted By: FiberOPtics Re: isnull - 07/05/04 11:06 AM
Hello,

no, you can perfectly use $ifmatch, just by making the custom identifier return the v1 in a case where it matches.

As a (stupid) example:
Code:
  

alias test { if $checklol($1) { echo -a $ifmatch } }

alias checklol { if $1 == lol { return matched lol } }

When typing /test lol, it will echo: matched lol


Greetz


Posted By: Wolfie Re: isnull - 07/05/04 02:28 PM
The idea is more for readability than for thinking that it can't be done as an identifier, because personally, I think it looks easier to read...
Code:
if ($v1 isnull) { }
if ($isnull($v1)) { }
if ($v1 != $null)) { }

...shorter (not the point though) and is a lot easier to read. Making identifiers isn't hard at all, I'll admit that, however, for readability, it would be nice...and I'm sure that others would find other uses in it (besides readability) or at least like that idea.

Still isnull would be a nice simple addition. cool
Posted By: FiberOPtics Re: isnull - 07/05/04 02:37 PM
Hehe,

just lose the brackets, that'll give more readability :tongue:
Code:
 
if v1 isnull {
if $isnull(v1) {
if v1 != $null {
 


Anyway, I'm not against it, as for me it wouldnt make a difference, but if it helps other people to read it better, well then who am I to oppose that?

Greetz @Wolfie

Posted By: Wolfie Re: isnull - 07/05/04 03:56 PM
I actually like the ()'s and {}'s - to me that's easier to read because things are grouped off.
cool

And I know you weren't being opposed to it. Just responding to why I didn't like the identifier idea as a solution.
Posted By: zack Re: isnull - 08/05/04 04:53 AM
Having something like:

if ($1 isbad) { } - For perhaps a bad word kicker.

Or:

if ($chan notalkie) {} - For a custom /amsg

Then it'll be beneficial because it's not only easier to read, but looks cool too!
© mIRC Discussion Forums