mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2005
Posts: 39
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
How can i check if char ! or ? is in $2 before i continue? I'd figure it would be something like this, but it doesnt seem to work..
Code:
  var %char = $chr(33) ||  $chr(63)
  if (%char !isin $2) { halt }

And should i be using halt or return?

Joined: Oct 2005
Posts: 54
B
Babel fish
Offline
Babel fish
B
Joined: Oct 2005
Posts: 54
Code:
var %char1 = $chr(33)
var %char2 = $chr(63)
 if (%char !isin $2[color:green]-[/color]) || (%char2 !isin $2[color:green]-[/color]) && (%char !isin $2[color:green]-[/color]) { halt }


Chat NSN
My Server: sleepystickman.ircxpro.com
Joined: Mar 2005
Posts: 39
B
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
huh, whats %char now if u removed it? smile

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You don't need to set a variable in that case:

if (($chr(33) isin $2) || ($chr(63) isin $2)) return

In fact, in that specific case, you don't even need to use the $chr identifier:

if ((! isin $2) || (? isin $2)) return

If you have a very long list of characters to check, you could use this method (this example would detect !?@%^& in $2):

if ($remove($2,!,?,@,%,^,&) != $2) return

In the above 2 examples, remember that the # character cannot be used because it is a shortcut to $chan. Use $chr(35) instead.

-genius_at_work

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Or just if ($count($2,!,?,@,%,^,&)) return


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
very nice, can always count on you for a slick, simple way to do something.


Link Copied to Clipboard