mIRC Homepage
Posted By: Stealth Custom IF operators. - 22/10/03 07:11 PM
It would be nice if there were a way to script a custom IF operator in the remotes section. Something like:

Code:
 
;This would reflect a post i just read on "isuop" and "ishop"
;using: if ($1 operator $2)

IF isuop {
  if (- isin $nick($2,$1).pnick) { return $true }
  else { return $false }
}


The IF using the custom operator will use $true and $false respectively.

Addition:
This operator would be used like:
if (nick isuop chan) { commands }

If the statement returns $true (meaning true) it would proceed with the commands, if not ($false) it will skip that command block exactly like if it were a built-in operator.
Posted By: cold Re: Custom IF operators. - 22/10/03 07:52 PM
Wouldn't this be the same as using a custom $isuop() identifier, since mIRC would have to refer to a third-part code anyway? Unless it referred to the "if" block in a different, faster way than how it refers to custom identifiers, but still, I don't see how much improvement this feature would offer as a whole..
Posted By: Stealth Re: Custom IF operators. - 22/10/03 08:07 PM
It would make scrippting a bit faster and simpler than typing the $isup all the time, because you would need to type

if ($isuop(nick,chan) == $true)

Instead of

if (nick isuop chan)

In this example it is not much, but in some of my scripts it would save alot of space and alot of time.

For example, I have:
Code:
 
if ($1 isvo %mychan) || ($1 isop %mychan) || ($me !isop %mychan) { HALT }


repeated alot in one of my scripts. It would be a whole lot easier if i can just have if ($1 noop %mychan).
I thought alot about of using an identifier, but that would still take a bit more time to type.
Posted By: cold Re: Custom IF operators. - 22/10/03 09:03 PM
But this behaviour wouldn't be changed, since mIRC would need to know what does "isuop" mean, just like it does with identifiers, making this really just a cosmetic change.. this is what I'm talking about.
Posted By: cold Re: Custom IF operators. - 22/10/03 11:43 PM
(I think I'm a little crazy, just thought you replied again, then replied this back. Sorry. Anyway, I think what's below clears my point..)

You don't need the " == $true" part, just ($isuop(nick,chan)).

And, as I said, mIRC would need to know what "isuop" means, since it wouldn't be built-in, so it would need to get its value and parse its script code, which is exactly what it does with identifiers already. Again, what I meant is, AFAIK, unless mIRC used a different way to store that information so it could get it faster, it would be just a cosmetic change with no speed difference.

Plus, anyway, if mIRC had the possibility to get it any faster then, why wouldn't it apply the method to identifiers either? It's the same process: parse, interpret the code and return.
Posted By: Adrenalin Re: Custom IF operators. - 25/10/03 05:46 PM
I like this idea ..

if (a operator b)

alias operator {
;$1 = a
;$2 = b
dosmthink $1 $2
return 1
}
Posted By: KingTomato Re: Custom IF operators. - 25/10/03 06:33 PM
if ($operator(a, b))

You already have the capability.. Like cold mentioned, it wouldn't make anything faster. All it would do is give you the abilty t say "I made my own operator"
© mIRC Discussion Forums