mIRC Home    About    Download    Register    News    Help

Print Thread
Check for $chr before continue #135981 20/11/05 03:47 PM
Joined: Mar 2005
Posts: 39
B
bapplander Offline OP
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?

Re: Check for $chr before continue #135982 20/11/05 03:57 PM
Joined: Oct 2005
Posts: 54
B
benjy355 Offline
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
Re: Check for $chr before continue #135983 20/11/05 04:04 PM
Joined: Mar 2005
Posts: 39
B
bapplander Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
huh, whats %char now if u removed it? smile

Re: Check for $chr before continue #135984 20/11/05 07:05 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
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

Re: Check for $chr before continue #135985 20/11/05 07:27 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
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
Re: Check for $chr before continue #135986 20/11/05 09:03 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
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.