mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2016
Posts: 5
A
arhsj Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2016
Posts: 5
I'm relatively new to mIRC and I'm mainly using it for a simple Twitch chat bot. Sometimes, a channel I moderate for likes to do riots where people spam the chat as much as possible. Below are instructions on what I'm looking to do.

1) !startriot to start the counter
2) counter to count how many lines of chat each user says and saves to a file or immediately retrievable place
3) !endriot to end the counter and possibly display top rioters.

If this is possible in mIRC, it would be great! Other possible solution ideas would could be great!

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
This seems like a very bad idea. Twitch has protections in place that will globally ban a user who sends too many messages to chat in a short period of time. The script that you are asking for is essentially encouraging users to get globally banned from Twitch.

Joined: Mar 2016
Posts: 5
A
arhsj Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2016
Posts: 5
Riots are a special thing in the channel I moderate for and I know the limits of Twitch (as I have personally been globally banned before). It's not the script that's encouraging, it's the riots themselves. The riots are just something fun we like to do and it's a time where spamming is encouraged (but try not to get globalled). I honestly don't need judgement on the idea, I would just like to know of a possible solution.

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I was not judging your request. I was simply informing you of the possibility of global bans in case you were not aware of them, as you stated that you are fairly new to Twitch. It was not my intention to come across as being rude. smile

Having said that, I imagine that someone would be able to write a script that does what you are requesting. Good luck. smile

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Actually, you can auto-timeout those "rioters" who are too close to exceed limits.


Dont give a fish - teach to fish!
Joined: Mar 2016
Posts: 5
A
arhsj Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2016
Posts: 5
Can anyone help me create a script for this?

Joined: Mar 2016
Posts: 5
A
arhsj Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2016
Posts: 5
Anyone at all? I really want to be able to get a script for this!

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259



1) Make a text event for !startriot that sets a global variable that will be cleared after X seconds. Let's call that variable %riot. In this event you also make a hashtable that stores nicknames and points

2) Make another text event that triggers on any text, but make this event /halt if %riot is not set. Here you add +1 to score of that $nick in the hashtable

3) Make an event for !endriot that unsets %riot and frees the hashtable, but first use this to sort the table so you get a top list

Code:
  // Sort table in descending order into a temp file (this can also be done in a custom window)
  hsave -n table file.tmp
  filter -ffcuten 2 32 file.tmp file.tmp

  // Get the Nth top value
  echo -a $hget(table,$gettok($read(file.tmp,N),1,32)).item

Joined: Mar 2016
Posts: 5
A
arhsj Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Mar 2016
Posts: 5
I have the current code below. I'm not sure if it's all correct or working or not but I'm not sure how I'm supposed to increment their score in the hash table. If you could also check through the code to see if it's right, that would be appreciated.

Code:
set %riot false
on *:text:!startriot:#: {
  if ($hasModPowers) { 
    msg $chan The RIOT has BEGUN! Spam your way to the top!
    set %riot true
    hmake table
  }
}
on *:text:*:#: {
  if (%riot == true) { 
    hadd table $nick ;HOW CAN I INCREMENT THEIR SCORE
  }
  else {
    halt
  }
}
on *:text:!endriot:#: {
  if ($hasModPowers) { 
    msg $chan The RIOT has ENDED! Calm your spam!

    hsave -n table file.tmp
    filter -ffcuten 2 32 file.tmp file.tmp

    echo -a $hget(table,$gettok($read(file.tmp,N),1,32)).item

    set %riot false
    hfree table
  }
}


Cheers!

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
This works well when I tried it

Code:
on *:text:!endriot:#: {
  if ($nick !isop #) { return }
  msg $chan The RIOT has ENDED! Calm your spam!
  hsave -n table file.tmp
  filter -ffcuten 2 32 file.tmp file.tmp
  var %i = 10
  var %y = 1
  msg # The top 10 spammers:
  while (%i) {
    if ($hget(table,$gettok($read(file.tmp,%i),1,32)).item) {
      .timer 1 %y msg # %i $+ : $hget(table,$gettok($read(file.tmp,%i),1,32)).item    
    }
    dec %i
    inc %y   
  }
  set %riot false
  hfree table
}

on *:text:!startriot:#: {
  if ($nick !isop #) { return }
  msg $chan The RIOT has BEGUN! Spam your way to the top!
  set %riot true
  hmake table
}
on *:text:*:#:{
  if (%riot != true) { return } 
  if (!$hget(table,$nick)) {
    hadd table $nick 1
  }
  else {
    hadd table $nick $calc($hget(table,$nick)+1)
  }
}

Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
Just because I'm bored:
Code:
on *:text:*:#: {
  if ($nick isop #) && ($1 == !startriot) {
    hfree -w riot
    hmake riot
    msg # The RIOT has BEGUN! Spam your way to the top!
  }
  elseif ($nick isop #) && ($1 == !endriot) {
    msg # The RIOT has ENDED! Calm your spam!
    window -h @riot
    clear @riot
    noop $hfind(riot,*,0,w,aline @riot $1 $hget(riot,$1))
    filter -cwwtue 2 32 @riot @riot
    var %x = 1,%m
    while (%x <= 10) && ($line(@riot,%x)) {
      tokenize 32 $v1
      var %m = %m $chr(35) $+ %x $1 $bytes($2,b)
      inc %x
    }
    hfree -w riot
    window -c @riot
    msg # Top 10 spammers: %m
  }
  elseif ($hget(riot)) hinc riot $nick
}


Link Copied to Clipboard