mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
Ok so when i add a command in one stream it doesnt work, but when i do it in other chats it works perfectly so is there a reason why its doing that?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Not sure what your terminology means. Is 'stream' the same thing as 'chats'? And they both mean what real IRC calls "channels"? Or does one of them refer to having multiple mirc connections, and you're trying to get a script to respond to things typed from that same mirc?

And by 'doesnt work', does that mean it acts like it doesn't see the command, or it tries to do the command but fails?

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
So by 'stream' i mean a twitch channel. But anyways whenever i add a new filter to my bot for 1 channel it doesn't work but when i use it in another channel it works. It's like i have too much code for that one specific channel.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Ah, now you're describing your problem differently. Though I've never tested it, the limit for script size is 1 meg. Before it sounded like a :TEXT: handler that worked in some situations but not others. Now it sounds like you're trying to put 2 :TEXT: handlers in the same script where both are matching the same text but in different channels.

When not using the ^ prefix, which you don't want to do here, you can have multiple :TEXT: handlers, but anything that matches the matchtext:location of a handler won't get handled by :SAMEEVENT: below it. You can have a matchtext for !command1 in one handler and for !command2 in a different handler, because they don't compete with each other.

You need to either place the handlers in separate scriptfiles per channel, or change

on *:TEXT:matchwildtext:#channel1:{ code }

into

on *:TEXT:matchwildtext:#channel1,#channel2:{ code for both }

or

Code:
on *:TEXT:matchwildtext:#channel1,#channel2:{

code shared by both channels

  if ($chan == #channel1) {
    code for #channel1
  }
  if ($chan == #channel2) {
    code for #channel2
    return
  }
:end
  code shared by both channels
}


You could also do the same kind of thing to have several !commands share the same event handler.

if ($1 == !command1) { code }
if ($1 == !command2) { code }

If you have matchtext :*: below :!command1: then the below handles everything that didn't get intercepted by one of the earlier handlers.

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
I'm still having the same issue, whenever i add a new on *:text: event it just doesnt respond for this one specific channel even though im modded in it. Here's an example:

Code:
on *:text:*shout me out*:#troyl, #agony:{ 
; check if user is not warned yet 
      if !$istok(%fd.warned,$nick,32) { 
 
 
        ; warning user       
        describe $chan @ $+ $nick -> rooBot No Asking For Shoutouts! [warning]  
        msg $chan /timeout $nick 5 asking for shoutout [warning] [Automated By TroyBot] 
        ; add user to %caps.warned, so we can check it later 
        set -e %fd.warned $addtok(%fd.warned,$nick,32) 
         
        ; set timer to remove user from %caps.warned after 300s 
        .timer 1 120 /unset %fd.warned $nick  
      } 
      else { 
        ; so user is already warned..  
        describe $chan @ $+ $nick No Asking for shoutouts. bingMad 
        msg $chan /timeout $nick 300 Asking For shoutouts After Being Warned [Automated By TroyBot] 
      } 
    } 

so it works in troyl but not agony its like i added too much stuff to it

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
put a debugging echo at the top of your handler, to see whether it really "isn't working", or whether it's just not matching your if() statement.

Your timer is unsetting the variable you so carefully created. If you want to delete the token you just addtok'ened, you should use $!deltok in the timer to keep it from being evaluated at launch time. What you're actually doing is making %fd.warned go away completely after 120 seconds.

Code:
.timer 1 120 set -e %fd.warned $!deltok(%fd.warned,$nick,32)

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
Ok everything works now for some reason. But i need help with something else, someone in a channel on Twitch the other night tried to spell the n word so how would i make it time out the user when they only put "N" in chat?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Welcome to the wonderful world of whack-a-mole. Where people get more creative in avoiding badword filters, and you end up banning someone who uses the word 'class' because it contains a bad word. And then your list of bad words grows and grows.

if you want to match using only the word:

if ($1- == nintendo)

to match using the word as a discrete word:

if ($istok($1-,nintendo,32))

to match the string appearing anywhere in the message:

if (nintendo isin $1-)

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
i tried all of those, still not working.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
what's your :matchtext: parameter look like?
if you have an debugging echo to status window at the top of the event handler, does it show anything?

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
Never mind man i got it working thanks for the help!

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
Ok so how would i go about something like this "!sub 10" and the sub command that i have would spam 10 times, how would i code something like this?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Can you rephrase yourself? It almost seems like you're wanting to learn how to spam. So unless you're looking for this _Script_for_Subscr#Post264618]thread it's not clear what you want.

Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
I found out how to do it but a new problem has came up

Code:
on *:text:*follow me*:#troyl:{
  ; check if user is not warned yet
  if ($nick isOP #) { return } 
      if !$istok(%fm.warned,$nick,32) {
 
 
        ; warning user 
        var %w $rand(1,5)   
        if (%w == 1) describe $chan @ $+ $nick -> rooBot No Self Promo! [warning] 
        elseif (%w == 2) describe $chan @ $+ $nick -> rooBot Hey! I can do this all day pal [warning]
        elseif (%w == 3) describe $chan @ $+ $nick -> rooBot What are you on about? [stop self promoting] [warning]
        elseif (%w == 4) describe $chan @ $+ $nick -> rooBot You're mistaken [stop self promoting] [warning]
        elseif (%w == 5) describe $chan @ $+ $nick -> cmonBruh [stop self promoting] [warning]
        msg $chan /timeout $nick 1 Self Promo [warning] [Automated By TroyBot] 
        ; add user to %caps.warned, so we can check it later 
        set -e %fm.warned $addtok(%fm.warned,$nick,32) 
         
        ; set timer to remove user from %caps.warned after 300s 
        .timer 1 120 /unset %fm.warned $nick  
      } 
      else { 
        ; so user is already warned.. 
        var %b $rand(1,5)
        if (%b == 1) describe $chan @ $+ $nick -> I tried to warn you [stop self promoting]
        elseif (%b == 2) describe $chan @ $+ $nick -> Maybe you should just sit out for a bit [stop self promoting]
        elseif (%b == 3) describe $chan @ $+ $nick -> Come back in 5 minutes [stop self promoting]
        elseif (%b == 4) describe $chan @ $+ $nick -> Ya, lets not do that. Enjoy your timeout [stop self promoting]
        elseif (%b == 5) describe $chan @ $+ $nick -> I can do this all day buddy [stop self promoting] 
        msg $chan /timeout $nick 300 Self Promoting After Being Warned [Automated By TroyBot] 
      } 
    } 

so this is to stop self promotion in my stream but when a moderator says "follow me" the automated message pops up and i dont want that happening. So how do I make this where when a moderator says it it doesnt have the message pop up?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
If moderator means 'Op' then this should not be causing your problem, because the 1st command is checking if the $nick is an Op in $chan and exiting the event handler if they are an Op. Perhaps you have another :TEXT: event in another script doing stuff too?


Link Copied to Clipboard