mIRC Homepage
Posted By: MaxEvans Need help with a warning script - 06/04/17 08:11 PM
Okay, so I'm not sure where to start, but I have an idea of what I want. Basically, I want a script that warns users in a channel if they don't abide by the rules. And each user will have a different variable as to how many warning or infractions against them. And on the third, will ban the user(s) from the channel. I know quite a bit of MSL, but not entirely sure where to start on this kind of idea.
Posted By: OrFeAsGr Re: Need help with a warning script - 06/04/17 08:19 PM
Well, seems like you need to define the rules that you want the script to check for, and then see if it's possible to be checked.. e.g bad words, flood, join/part flood.
And then apply the counting variables to each case.
Posted By: Bramzee Re: Need help with a warning script - 08/04/17 08:04 PM
Generally, when I try to work out a script I throw something like this together to keep my mind on what exactly I should be doing... Then I go through and put in the actual script and give it a few tests with some echo's or something...

Code:
on *:text:*:#: {
  ;if they broke the rules:
    ;check if on warn2
      if yes:
        ;remove from warn2
        ;ban.
      if no:
        ;check warn1
    ;check if on warn1
      if yes:
        ;warn again
        ;remove from warn1
        ;add to warn2
      if no warn
        ;warn
        ;add to warn1
}


You COULD use variables to keep users on the list, but I'd go with a file of some sort (txt would be easiest probably). Check if they broke the rules, if not then { return } If they did, then simply check if their username is in that file. If it is, do the appropriate action... I put in the "remove from..." bit just to prevent double messages and whatnot. But you could also just add a return after the "add to..." parts I think? Someone more knowledgeable might be able to verify if that would work. But, adding the remove also allows you to keep the files cleaned up a bit.


Also, this is just a quick thing I threw together. Obviously. Don't judge it for not checking the right way. The idea was to get you moving in the right direction.
Posted By: MaxEvans Re: Need help with a warning script - 14/04/17 01:38 AM
Basically what I want is to set rules such as flooding, caps, etc... and have the bot detect it and set a variable or text file with how many warnings they get. First warning would be a five minute ban, second would be 24 hour ban, and third permaban. Like the three strikes rule. Is this possible? And if so, how would I do it?
Posted By: KubosKube Re: Need help with a warning script - 14/04/17 05:03 AM
I made a script way-back-when. I'll post it here because it's slightly relevant.

Quote:
on *:TEXT:*:#: {
;#### ROBOT BOUNCER ####
if (%BouncerOn == True) {
if (%AmHuman. [ $+ [ $nick ] ] == $null) {
set %AmHuman. [ $+ [ $nick ] ] False
}
if (%RaidCountdown <= 0 && %AmHuman. [ $+ [ $nick ] ] == False) {
if (%BotWarningCount. [ $+ [ $nick ] ] >= 5) {
msg $chan /ban $nick
msg $chan /me &#10071; $nick [ $+ [ , ] ] message @KubosKube with "/w KubosKube Unban $nick $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) " to be unbanned. Robots won't follow these directions.
set %BotWarningCount. [ $+ [ $nick ] ] 0
}
else {
if (%BotWarningCount. [ $+ [ $nick ] ] == $null) {
set %BotWarningCount. [ $+ [ $nick ] ] 0
}
inc %BotWarningCount. [ $+ [ $nick ] ]
msg $chan /me &#10071; Type !human in Chat, $nick . Warning %BotWarningCount. [ $+ [ $nick ] ] / 5.
}
}
}
}


It uses a couple of variables.
%BouncerOn is a toggle so I can turn this feature off.
%AmHuman "determines" if a user is a robot or not. If this value is false, then the user is "breaking the rules".
%BotWarningCount.$nick is used for counting how many times a particular user has been warned. When this reaches a certain limit, it bans the user.
%RaidCountDown is set in a separate part of my script to bypass this whole block of text so I don't timeout/ban 20 new members in my Twitch stream during a raid.

I know it's not exactly what you asked for, but it's close to what you wanted, I think, so I hope it helps you out.
Posted By: MaxEvans Re: Need help with a warning script - 14/04/17 11:55 PM
That works. I'll take that and run with it. Thanks for that!
© mIRC Discussion Forums