mIRC Home    About    Download    Register    News    Help

Print Thread
Custom Operators #93752 12/08/04 03:16 AM
Joined: Aug 2004
Posts: 147
N
nalAAlan Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
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.

Re: Custom Operators #93753 12/08/04 07:47 AM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: Custom Operators #93754 12/08/04 04:04 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Lack of $v1/2 support for one thing.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Custom Operators #93755 12/08/04 04:06 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Suppose but it wouldnt kill you to use an alternative.

Eamonn.

Re: Custom Operators #93756 12/08/04 04:19 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Custom Operators #93757 12/08/04 04:38 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
*pokes the Devil's advocate repeatly*

Eamonn.

Re: Custom Operators #93758 12/08/04 05:53 PM
Joined: Aug 2004
Posts: 147
N
nalAAlan Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
Quote:
Has the exact same effect just a different layout.

Well, isn't that what programming about, different ways to do things?

Re: Custom Operators #93759 12/08/04 09:31 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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!!!!


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Custom Operators #93760 13/08/04 07:16 AM
Joined: Apr 2003
Posts: 426
neophyte Offline
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 426
Doesn't mean you can't ask for improvements to be made to the language :P


--------
mIRC - fun for all the family (except grandma and grandpa)
Re: Custom Operators #93761 13/08/04 02:48 PM
Joined: Apr 2004
Posts: 218
P
PhantasyX Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 218
Boo, I'm also sugesting you can edit /if
alias if blah blah blah
smile


Live to Dream & Dream for Life