mIRC Homepage
Posted By: nalAAlan Custom Operators - 12/08/04 03:16 AM
Everyone knows mIRC wouldn't be what it is today if it weren't for the if-statement. However, we as mIRC scripters are limited to about 33 different operators. I was thinking, we have custom commands, identifers, why not custom operators? I was thinking it would be something like this:
Code:
operator -l isin3 {
  ;$v1 is the first part of the if-statement
  ;$v2 is the seconds part of the if-statement
  if (($gettok($v1,0,32) == 3) && ($v1 isin $v2)) return $true
  return $false
}
on *:text:*:#my1337channel:{
  if ($1- isin3 I AM A 1337 H4X0R!!!) msg $chan CORRECT PASSWORD, YOU ARE A REAL H4X0R!!!
}
on *:text:*:#another1337channel:{
  if ($1- !isin3 Y HELO THAR MR H4X0R!!) inc %lines.#another1337channel
  else msg $chan SECRET PASSWORD HAS BEEN DISCOVERED!!!
}

That example sucks, but I think you get the idea. I know you could easily do this with code, but by that logic, what's the point of $iif.
Posted By: Coolkill Re: Custom Operators - 12/08/04 07:47 AM
Whats to stop you doing,


alias isin3 {
if ($1 == $2) { return $true }
return $false
}

On *:Text:*:#:{
if ($isin3($1,$2)) { command }
}

or,

On *:Text:*:#:{
if (!$isin3($1,$2)) { command }
}


Has the exact same effect just a different layout.

Eamonn.
Posted By: starbucks_mafia Re: Custom Operators - 12/08/04 04:04 PM
Lack of $v1/2 support for one thing.
Posted By: Coolkill Re: Custom Operators - 12/08/04 04:06 PM
Suppose but it wouldnt kill you to use an alternative.

Eamonn.
Posted By: starbucks_mafia Re: Custom Operators - 12/08/04 04:19 PM
Well no it wouldn't kill me, but then I'm highly trained for such situations thanks to Kurt Rhoder's Geek Survival: Contingencies for Programmatic Emergencies.


...Or to put that another way: I was only playing Devil's advocate. You asked what the difference was. I answered.
Posted By: Coolkill Re: Custom Operators - 12/08/04 04:38 PM
*pokes the Devil's advocate repeatly*

Eamonn.
Posted By: nalAAlan Re: Custom Operators - 12/08/04 05:53 PM
Quote:
Has the exact same effect just a different layout.

Well, isn't that what programming about, different ways to do things?
Posted By: argv0 Re: Custom Operators - 12/08/04 09:31 PM
Quote:
Well, isn't that what programming about, different ways to do things?


err wow silly me
i always thought programming was about getting the job done within the constraints of the language, period.

and all this time!!!!
Posted By: neophyte Re: Custom Operators - 13/08/04 07:16 AM
Doesn't mean you can't ask for improvements to be made to the language :P
Posted By: PhantasyX Re: Custom Operators - 13/08/04 02:48 PM
Boo, I'm also sugesting you can edit /if
alias if blah blah blah
smile
© mIRC Discussion Forums