mIRC Homepage
Posted By: bapplander Check for $chr before continue - 20/11/05 03:47 PM
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?
Posted By: benjy355 Re: Check for $chr before continue - 20/11/05 03:57 PM
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 }
Posted By: bapplander Re: Check for $chr before continue - 20/11/05 04:04 PM
huh, whats %char now if u removed it? smile
Posted By: genius_at_work Re: Check for $chr before continue - 20/11/05 07:05 PM
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
Posted By: qwerty Re: Check for $chr before continue - 20/11/05 07:27 PM
Or just if ($count($2,!,?,@,%,^,&)) return
Posted By: MikeChat Re: Check for $chr before continue - 20/11/05 09:03 PM
very nice, can always count on you for a slick, simple way to do something.
© mIRC Discussion Forums