mIRC Homepage
Posted By: oddvent What identifier for multiple words? - 03/04/10 05:06 AM
I want the user to be able to type '!test [some text here]'

this works fine as its only 3 words:

on *:text:!test & & &:#: {
msg # $2
msg # $3
msg # $4
}

but what if the line entered has a varying amount of words that i do not know. it could be anything from 1 to anything!!

please help!
Posted By: RusselB Re: What identifier for multiple words? - 03/04/10 06:05 AM
Use the * wildcard rather than the & wildcard in your event
Code:
on *:text:!test*:#:{
  var %a = 1, %b = $0
  while %a <= %b {
    echo -a Word %a is $($+($,%a),2)
    inc %a
  }
}


This will simply echo in your active screen what is typed when someone else types !test <other words>

Please note that the above will trigger for any combination that starts with !test
Thus !testing 1 2 3 would trigger the code as well as !test 1 2 3
Posted By: Darwin_Koala Re: What identifier for multiple words? - 03/04/10 06:46 AM
(not tested)

What about the undocumented identifier?

Code:
on *:text:!test *:#: {
tokenise $2-
msg # $*
}
 


I don't have mIRC openn, so my syntax for tokenise may be out. This step is needed to ensure the first word is not picked up.

Cheers,

DK
Posted By: RusselB Re: What identifier for multiple words? - 03/04/10 09:06 AM
Corrected version of your code
Code:
on *:text:!test*:#:{
  tokenize 32 $2-
  msg # $*
}

Posted By: Darwin_Koala Re: What identifier for multiple words? - 03/04/10 08:28 PM
Thanks.

I had a deliberate space after "!test" (i.e. "!test *") so it wouldn't trigger on "!testme" "!testy" etc.

Cheers,

DK
Posted By: Riamus2 Re: What identifier for multiple words? - 03/04/10 08:30 PM
He was fixing your spelling of tokenize and adding the separator character (32 = space). smile
Posted By: Darwin_Koala Re: What identifier for multiple words? - 03/04/10 08:45 PM
Originally Posted By: Riamus2
He was fixing your spelling of tokenize and adding the separator character (32 = space). smile


Had noted that :-) I was picking up on another subtle difference that could affect the outcome of the event.

Cheers,

DK
Posted By: chacha Re: What identifier for multiple words? - 03/04/10 09:53 PM
what about flood?

better to youse /timer with alias or /play file

© mIRC Discussion Forums