mIRC Home    About    Download    Register    News    Help

Print Thread
What identifier for multiple words? #219952 03/04/10 05:06 AM
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!

Re: What identifier for multiple words? [Re: oddvent] #219955 03/04/10 06:05 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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

Re: What identifier for multiple words? [Re: oddvent] #219958 03/04/10 06:46 AM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
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!
Re: What identifier for multiple words? [Re: Darwin_Koala] #219959 03/04/10 09:06 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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 # $*
}


Re: What identifier for multiple words? [Re: RusselB] #219992 03/04/10 08:28 PM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
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!
Re: What identifier for multiple words? [Re: Darwin_Koala] #219993 03/04/10 08:30 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
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
Re: What identifier for multiple words? [Re: Riamus2] #219995 03/04/10 08:45 PM
Joined: Feb 2004
Posts: 206
D
Darwin_Koala Offline
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!
Re: What identifier for multiple words? [Re: RusselB] #219996 03/04/10 09:53 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
what about flood?

better to youse /timer with alias or /play file



WorldDMT