mIRC Home    About    Download    Register    News    Help

Print Thread
New commands that i add to my bot dont work #264786 12/01/19 05:02 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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?

Re: New commands that i add to my bot dont work [Re: TroyL] #264787 12/01/19 05:31 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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?

Re: New commands that i add to my bot dont work [Re: maroon] #264788 12/01/19 05:35 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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.

Re: New commands that i add to my bot dont work [Re: TroyL] #264789 12/01/19 06:56 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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.

Re: New commands that i add to my bot dont work [Re: maroon] #264797 12/01/19 10:01 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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

Re: New commands that i add to my bot dont work [Re: TroyL] #264798 13/01/19 01:33 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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)

Re: New commands that i add to my bot dont work [Re: maroon] #264801 13/01/19 04:58 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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?

Re: New commands that i add to my bot dont work [Re: TroyL] #264802 13/01/19 06:00 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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-)

Re: New commands that i add to my bot dont work [Re: maroon] #264804 13/01/19 08:02 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
i tried all of those, still not working.

Re: New commands that i add to my bot dont work [Re: TroyL] #264805 13/01/19 08:17 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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?

Re: New commands that i add to my bot dont work [Re: maroon] #264854 18/01/19 05:40 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
Never mind man i got it working thanks for the help!

Re: New commands that i add to my bot dont work [Re: TroyL] #264870 21/01/19 02:17 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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?

Re: New commands that i add to my bot dont work [Re: TroyL] #264871 21/01/19 04:10 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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.

Re: New commands that i add to my bot dont work [Re: maroon] #264877 22/01/19 08:17 PM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
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?

Re: New commands that i add to my bot dont work [Re: TroyL] #264880 23/01/19 02:26 AM
Joined: Jan 2004
Posts: 1,181
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,181
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?