mIRC Home    About    Download    Register    News    Help

Print Thread
#262441 30/01/18 11:30 PM
Joined: Sep 2016
Posts: 34
F
Furiny Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Sep 2016
Posts: 34
Hello,

Happy New Year 2018 even it's been a while though!

I'm asking for help with my counter coding:

!meow alone works, but when adding a second parameters, it doesn't respond. Like !meow 2 (or any other number).

1. You type !meow X (X = number)
2. Script triggers and sends message in chat "Meows have been given. Use !meowcounter to see how many meows have been given.
3. !meowcounter to see how many meows have been given.

Code:
on *:TEXT:!meow:#: {
  if ($nick isop #) {
    if ($2 isnum)  {
      %meow.times = $calc(%meow.times + $2) | .msg $chan Meows have been given. Use !meowcounter to see how many meows have been given.
      %meowtotal.times = $calc(%meowtotal.times + $2)
      return
    }
    inc %meow.times | .msg $chan A meow has been given. Use !meowcounter to see how many meows have been given.
    inc %meowtotal.times
  }
}


Thank you in advance!

Furiny

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
you can change your match word from :!trigger: to :!trigger*: but that will match all words beginning the same. Or:

Code:
on $*:TEXT:/^!trigger( |$)/i:#channelname:{ echo 4 -s this matches "!trigger" and "!trigger anything" without matching "!triggerzilla" $nick $chan (1) $1 (2-) $2- }


Joined: Sep 2016
Posts: 34
F
Furiny Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Sep 2016
Posts: 34
The idea is that when streamer says "Meow", then we (mods) triggers !meow X (amount of meows he said). It'll keep counting up. Example he said 3 times meow, it'll be !meow 3.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Not sure what you're saying. I thought your issue was that you wanted it to respond both to the trigger word with+without the number following. That's what I did.

Your script is using $calc to add the number, but you're accepting input of any number, including -2.345

You can change
if ($2 isnum)
to
if ($2 isnum 1-)

then instead of
var %variable $calc(%variable + $2)
you can do
inc %variable $int($2)

These ignore numbers less than 1, and shave off any fractions. Since you're not using negative numbers, you don't need to worry about the difference between $int and $floor.

Joined: Sep 2016
Posts: 34
F
Furiny Offline OP
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Sep 2016
Posts: 34
Got it working, thanks! And sorry for not nice word. blush

Furiny


Link Copied to Clipboard