mIRC Home    About    Download    Register    News    Help

Print Thread
O
oddvent
oddvent
O
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!

R
RusselB
RusselB
R
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

D
Darwin_Koala
Darwin_Koala
D
(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

R
RusselB
RusselB
R
Corrected version of your code
Code:
on *:text:!test*:#:{
  tokenize 32 $2-
  msg # $*
}


D
Darwin_Koala
Darwin_Koala
D
Thanks.

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

Cheers,

DK

Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
He was fixing your spelling of tokenize and adding the separator character (32 = space). smile

D
Darwin_Koala
Darwin_Koala
D
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

C
chacha
chacha
C
what about flood?

better to youse /timer with alias or /play file



Link Copied to Clipboard