mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
example:
Code:
OPERATOR isuser {
  if ( $0 < 2 ) { echo -s Invalid isuser format | halt }
  if ( $nick($2,$1,a,ohvr) ) { return $true }
  return $false
}

So that someone could do something like: if ( $nick isuser $chan ) { ; what to do }
Instead of: if ( $isuser($nick,$chan) ) { ; what to do }

Would return $true if the person isn't OP/HOP/VOICE, but has some sort of weird mode so they don't match up as a regular user either. (Conference Room supports a "User" mode, so nicks show up as "-Nick")

Just a thought as it could add features without forcing them to be identifiers. I think that in the long run, if it got implemented, it would only be able to return $true/$false only as results, so as for usefulness, would be used solely for times when a $true/$false result is necessary, and not anything like a nick/#room/text/etc.

The !| (or !||):
Similar to || but with a twist.. Only is true if one codition or the other is true, but not both.
ie..
if ( 1 == 1 !|| 2 == 2 ) { }
Would ONLY be true if 1 == 1 -or- 2 == 2 -but- not if both are true. (Which in this example, both are true).

Perhaps something like this already exists, I dunno, but it would seem to be easier than:
if ( ( 1 == 1 && 2 != 2 ) || ( 1 != 1 && 2 == 2 ) ) { }

I know other languages support the idea I am talking about, not sure if I'm using the right format/symbols, but I think it's called something like an excusive OR or NOR or something. (blah!)

grin

Just thought it would add more functionality.

Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Agreed. The ability to make operators could be useful.

The simplest way currently to implement the exclusive-or (XOR) operator is to use $xor() and a couple of $iif()'s like so:
$xor($iif([color:red]1 == 1,1,0),$iif(2 == 1,1,0))[/color]
Just change the expressions in red to whatever you want.

Of course it's still not ideal so I agree there should be a built-in operator for this. IMO ^^ would make sense since it continues the current pattern of doubling the symbol for the traditional bitwise operator (& => &&, | => ||, ^ => ^^). However I haven't really thought it through so it's possible it would cause syntax problems I haven't considered.

Last edited by starbucks_mafia; 23/04/04 12:37 AM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Aug 2003
Posts: 325
W
Wolfie Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
^^ looks like a happy face (like in anime).. I could see a bunch of scripts now, just smiling away at you at it messes up somehow, as though it's laughing at you because you can't figure out where the mistake is.

And stopping to think about the irony of it.. I'm hoping it gets added in now, and with the ^^ too smile

Joined: Mar 2003
Posts: 187
S
Vogon poet
Offline
Vogon poet
S
Joined: Mar 2003
Posts: 187
Quote:
if ( 1 == 1 !|| 2 == 2 ) { }


if (1 == 1) { cmds }
if (2 == 2) { cmds }


Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
If this is supposed to be an alternative, it's far from it. If you don't know what XOR (exclusive OR) is, look it up.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard