mIRC Home    About    Download    Register    News    Help

Print Thread
Script To Announce Subs On Twitch #263288 03/07/18 01:33 AM
Joined: Jul 2018
Posts: 4
S
SayLoh Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2018
Posts: 4
Hello I am new to mIRC but am trying to set myself up as a bot to announce new subscribers for my friends stream. I have tried pulling scripts from other forums and such but have been unable to get it to work. If anyone could help me out with a working script it would be much appreciated. I basically just need it to automatically respond with a message thanking the user for their sub/resub. Thank you for any help!

Re: Script To Announce Subs On Twitch [Re: SayLoh] #263383 23/07/18 12:57 AM
Joined: Jul 2018
Posts: 4
S
SayLoh Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2018
Posts: 4
I have a script that is working kind of strangely. It is announcing subscriptions without a problem, but it is also announcing the sub message for resubs and gift subs as well. So when someone resubs it triggers the sub message and the resub message. The sub message is also oddly triggered on raids as well.

Code:
ON *:CONNECT: {
  raw CAP REQ :twitch.tv/membership 
  raw CAP REQ :twitch.tv/commands 
  raw CAP REQ :twitch.tv/tags 
} 

raw USERNOTICE:*:{
  if(($msgtags(msg-id).key == sub)&&($1 == #averagemark)){
  var %nick $iif($msgtags(display-name).key,$v1,$msgtags(login).key)
  describe $1 THANK YOU %nick FOR SUBSCRIBING!! Welcome to the AVGFAM!! averag3Sip nickmercsLG nickmercsSUB
}
elseif(($msgtags(msg-id).key == resub)&&($1 == #averagemark)){
var %nick $iif($msgtags(display-name).key,$v1,$msgtags(login).key)
if ($0 == 1) {
  describe $1 THANK YOU %nick FOR THE $msgtags(msg-param-months).key MONTHS IN A ROW! averag3Sip nickmercsLG nickmercsSUB
}
else {
  describe $1 THANK YOU %nick FOR THE $msgtags(msg-param-months).key MONTHS IN A ROW! averag3Sip nickmercsLG nickmercsSUB Left a note: $qt($2-) 
}
}
}

Re: Script To Announce Subs On Twitch [Re: SayLoh] #263384 23/07/18 01:14 AM
Joined: Jul 2006
Posts: 3,807
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,807
all { and } basically have to be spaced out, same for && and ||, your script is not working at all, it's just executing the commands with no logic/condition:

Code:
ON *:CONNECT: {
  raw CAP REQ :twitch.tv/membership 
  raw CAP REQ :twitch.tv/commands 
  raw CAP REQ :twitch.tv/tags 
} 

raw USERNOTICE:*:{
  if ($1 == #averagemark) && ($findtok(resub sub,$msgtags(msg-id).key,32)) {
   var %emot averag3Sip nickmercsLG nickmercsSUB
   describe $1 THANK YOU $iif($msgtags(display-name).key,$v1,$msgtags(login).key) FOR [ $iif($v1 == 2,SUBSCRIBING!! Welcome to the AVGFAM!! %emot,THE $msgtags(msg-param-months).key MONTHS IN A ROW! %emot $iif($0 != 1,Left a note: $qt($2-))) ]
  }
}

I took the liberty to rewrite your script shorter since it's doing the same thing everywhere, if you understand $iif you shouldn't have much troubles understanding it, I added %emot so that you can just edit that variable to apply the emote to all cases, this is untested but should work..



Last edited by Wims; 23/07/18 02:59 AM. Reason: $v1 wouldn't be evaluated correctly so i added [ ] around it to be evaluated earlier

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Script To Announce Subs On Twitch [Re: Wims] #263385 23/07/18 05:51 AM
Joined: Jul 2018
Posts: 4
S
SayLoh Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2018
Posts: 4
Thank you for consolidating the script, I appreciate the help, however there is one issue. I just tested it with a basic subscription, however the resub message was triggered.

Re: Script To Announce Subs On Twitch [Re: SayLoh] #263386 23/07/18 09:44 AM
Joined: Jul 2006
Posts: 3,807
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,807
Yes, the original rewrite had an issue, I didn't realize $v1 would not be the correct value, I edited my post to include a quick fix using [ ]


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Script To Announce Subs On Twitch [Re: Wims] #263387 23/07/18 09:59 AM
Joined: Jul 2018
Posts: 4
S
SayLoh Offline OP
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Jul 2018
Posts: 4
I missed the edit, my bad, thank you so much for the help!