mIRC Home    About    Download    Register    News    Help

Print Thread
detecting words #248452 08/10/14 03:56 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
hi
idk how to explain :p

i want a script block that detects a word and then increases a counter.

basically like this:
Code:
on *:text:*count*:#: {
inc %count
}


but i want it like that: when someone writes "count blub count", %count should be increased by 2 and when someones types count three times, %count should be increased by 3 and so on..

thanks smile

Re: detecting words [Re: patrickplays] #248453 08/10/14 04:14 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:*count*:#: {
var %n $wildtok($1-,*count*,0,32)
inc %count %n
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: detecting words [Re: Nillen] #248454 08/10/14 04:22 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
ohh great! laugh
can we do this case sensitive too? :0
like only "Count" should increase the var, and "count" not


nvm got it!
$wildtokcs

Last edited by patrickplays; 08/10/14 04:25 PM.
Re: detecting words [Re: patrickplays] #248456 08/10/14 05:08 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Nillen's script is fine, but if someone typed "countcount count" it would increase the counter by two because there are only two "tokens" that contain the word "count."

Is that what you want? If you would rather it increased by 3 then you can use:

Code:
on *:text:*count*:#: {
  inc %count $countcs($1-,count)
}

Re: detecting words [Re: hixxy] #248457 08/10/14 05:42 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
the space thing is what i needed :p

but thanks for your post tho, probably going to use that for something else :3

Re: detecting words [Re: Nillen] #248459 08/10/14 06:15 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline OP
Babel fish
OP Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
weird thing: if i post 10 or more "keyword" in the chat it wont work :0

Re: detecting words [Re: patrickplays] #248460 08/10/14 06:19 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Confirmed on my client as well, a bit higher than 10, but it hits a wall at 17. Confirmed using both scripts, same limit.
Click to reveal..
Quote:
[20:18] <@nillens> test test test
[20:18] <@nillensbot> Counted test 3 times
[20:18] <@nillens> test test test test test test test test
[20:18] <@nillensbot> Counted test 8 times
[20:18] <@nillens> test test test test test test test test test test test test
[20:18] <@nillensbot> Counted test 12 times
[20:18] <@nillens> test test test test test test test test test test test test test test test test test test test test
[20:18] <@nillens> test test test test test test test test test test test test test test test test
[20:18] <@nillensbot> Counted test 16 times
[20:19] <@nillens> test test test test test test test test test test test test test test test test test test


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: detecting words [Re: Nillen] #248463 08/10/14 06:53 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Click to reveal..
(19:53:10) <@hixxy> test test test test
(19:53:10) <hixxy_> counted 'test' 4 times.
(19:53:10) <@hixxy> counted 'test' 5 times.
(19:53:10) <hixxy_> counted 'test' 6 times.
(19:53:10) <@hixxy> counted 'test' 7 times.
(19:53:10) <hixxy_> counted 'test' 8 times.
(19:53:10) <@hixxy> counted 'test' 9 times.
(19:53:10) <hixxy_> counted 'test' 10 times.
(19:53:10) <@hixxy> counted 'test' 11 times.
(19:53:10) <hixxy_> counted 'test' 12 times.
(19:53:10) <@hixxy> counted 'test' 13 times.
(19:53:11) <hixxy_> counted 'test' 14 times.
(19:53:11) <@hixxy> counted 'test' 15 times.
(19:53:11) <hixxy_> counted 'test' 16 times.
(19:53:11) <@hixxy> counted 'test' 17 times.
(19:53:11) <hixxy_> counted 'test' 18 times.
(19:53:11) <@hixxy> counted 'test' 19 times.
(19:53:11) <hixxy_> counted 'test' 20 times.
(19:53:11) <@hixxy> counted 'test' 21 times.
(19:53:11) <hixxy_> counted 'test' 22 times.
(19:53:11) <@hixxy> counted 'test' 23 times.
(19:53:12) <hixxy_> counted 'test' 24 times.
(19:53:12) <@hixxy> counted 'test' 25 times.
(19:53:13) <hixxy_> counted 'test' 26 times.
(19:53:13) <@hixxy> counted 'test' 27 times.
(19:53:14) <hixxy_> counted 'test' 28 times.
(19:53:14) <@hixxy> counted 'test' 29 times.
(19:53:15) <hixxy_> counted 'test' 30 times.
(19:53:15) <@hixxy> counted 'test' 31 times.
(19:53:16) <hixxy_> counted 'test' 32 times.
(19:53:16) <@hixxy> counted 'test' 33 times.
(19:53:18) <hixxy_> counted 'test' 34 times.
(19:53:18) <@hixxy> counted 'test' 35 times.
(19:53:18) <hixxy_> counted 'test' 36 times.
(19:53:18) <@hixxy> counted 'test' 37 times.
(19:53:18) <hixxy_> counted 'test' 38 times.
(19:53:18) <@hixxy> counted 'test' 39 times.
(19:53:20) <hixxy_> counted 'test' 40 times.
(19:53:20) <@hixxy> counted 'test' 41 times.
(19:53:20) <hixxy_> counted 'test' 42 times.
(19:53:20) <@hixxy> counted 'test' 43 times.


Seems to work fine here. On this computer I'm still on 7.32.

Edit:

Never mind, I see what you're saying... 17 or more in one line. Lemme try that, one sec.

Edit 2:

Click to reveal..
(19:57:20) <hixxy_> test test test
(19:57:20) <@hixxy> counted 'test' 3 times.
(19:57:23) <hixxy_> test test test test
(19:57:23) <@hixxy> counted 'test' 4 times.
(19:57:30) <hixxy_> test test test test test test test test test test test test test test test test test test
(19:57:30) <@hixxy> counted 'test' 18 times.
(19:57:36) <hixxy_> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
(19:57:36) <@hixxy> counted 'test' 79 times.
(19:57:37) <@hixxy> counted 'test' 11 times.
(19:57:43) <hixxy_> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
(19:57:43) <@hixxy> counted 'test' 79 times.
(19:57:43) <@hixxy> counted 'test' 11 times.
* /debug: invalid parameters
* Debug output on (@debug)
(19:58:05) <hixxy_> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
(19:58:05) <@hixxy> counted 'test' 79 times.
(19:58:05) <@hixxy> counted 'test' 11 times.


Still seems fine. This is using $wildtok()

Edit 3:

This is splitting the long message into two messages hence why it says 79 and then 11 times, in case you were wondering.

Last edited by hixxy; 08/10/14 06:58 PM.
Re: detecting words [Re: hixxy] #248464 08/10/14 07:03 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Another attempt on another server. Earlier test was done on irc.twitch.tv, this test is done on irc.rizon.net and this one shows no signs of a limit.
Click to reveal..
[21:02] <~Nillen> test
[21:02] <nillensbot> Counted test 1 times
[21:02] <~Nillen> test test
[21:02] <nillensbot> Counted test 2 times
[21:02] <~Nillen> test test test test test test test test test test test test test test test test
[21:02] <nillensbot> Counted test 16 times
[21:02] <~Nillen> test test test test test test test test test test test test test test test test test
[21:02] <nillensbot> Counted test 17 times
[21:02] <~Nillen> test test test test test test test test test test test test test test test test test test
[21:02] <nillensbot> Counted test 18 times
[21:02] <~Nillen> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
[21:02] <nillensbot> Counted test 79 times
[21:02] <nillensbot> Counted test 79 times
[21:02] <nillensbot> Counted test 22 times
[21:03] <~Nillen> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
[21:03] <nillensbot> Counted test 54 times


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net