mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2010
Posts: 10
O
oddvent Offline OP
Pikka bird
OP Offline
Pikka bird
O
Joined: Jan 2010
Posts: 10
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!

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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

Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
(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


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Corrected version of your code
Code:
on *:text:!test*:#:{
  tokenize 32 $2-
  msg # $*
}


Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Thanks.

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

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
He was fixing your spelling of tokenize and adding the separator character (32 = space). smile


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
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


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
what about flood?

better to youse /timer with alias or /play file



WorldDMT

Link Copied to Clipboard