mIRC Home    About    Download    Register    News    Help

Print Thread
correct use of pipes in query #243034 08/10/13 01:27 PM
Joined: Oct 2013
Posts: 7
R
ricktee76 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Oct 2013
Posts: 7
the script is basically like this right now
Code:
ON *:TEXT:*throw*:#:{

  if ($2 == elephant ) { msg $chan thats impossible !!! | halt }
  if ($2 == ball ) { msg $chan throws ball | halt }
   }



how can i make so i can use different 'throws'

like:
Code:
  if ($2 == elephant | ship | buffalo | etc ) { msg $chan thats impossible !!! | halt }

Re: correct use of pipes in query [Re: ricktee76] #243036 08/10/13 03:16 PM
Joined: Jan 2004
Posts: 1,287
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,287
Here are two different ways: $istok looks for the token in a list of values separated by the specified character (space, ascii 32 in this case), $regex is a more powerful and general purpose matching syntax.

Code:
if ($istok(elephant ship buffalo,$2,32)) { }

if ($regex($2,/elephant|ship|buffalo/iS)) { }

Re: correct use of pipes in query [Re: Loki12583] #243039 08/10/13 08:54 PM
Joined: Oct 2013
Posts: 7
R
ricktee76 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Oct 2013
Posts: 7
Thanks, I used the regex example and it worked perfectly.