mIRC Home    About    Download    Register    News    Help

Print Thread
#260565 13/05/17 07:06 PM
Joined: May 2017
Posts: 3
J
jaany Offline OP
Self-satisified door
OP Offline
Self-satisified door
J
Joined: May 2017
Posts: 3
Hey there,

New to mIRC, and trying to get an automessage out every time someone subs or resubs. The current code I have works fine for new subs, but does not work for resubs and does not work if they include a message to their share.

I've tried multiple scripts without luck.

My current code is

Code:
on *:connect:{
  if ($server = tmi.twitch.tv) {
    ; Requesting capabilities is necessary to recive the info
    raw CAP REQ :twitch.tv/membership
    raw CAP REQ :twitch.tv/tags
    raw CAP REQ :twitch.tv/commands
  }
}

on 1:text:*subscribed*:#channel: { 
  if ($nick == twitchnotify) && ($istok($1-,subscribed to,32)) halt
  elseif ($nick == twitchnotify) && ( $4 == $null ) { msg $chan /me Thanks for subscribing $1! }
  elseif ($nick == twitchnotify) && ( $4 == with ) { msg $chan /me Thanks for subscribing $1! }
}

raw USERNOTICE:*:{
  if (($msgtags(msg-id).key == resub) && ($1 == #channel)) {
    var %nick $iif($msgtags(display-name).key, $v1, $msgtags(login).key)
    if ($0 == 1) {
      msg $1 /me Thanks %nick for subscribing $msgtags(msg-param-months).key months in a row! 
    }
    else {
      msg $1 /me Thanks %nick for subscribing $msgtags(msg-param-months).key months in a row! 
    }
  } 
}


As I mentioned, this works fine for new subs and prime subs, but not for resubs or subs with a message.

Appreciate all help

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
when you're having trouble getting your code working, it's often very helpful to salt your code with some echo messages sent to status window or to a @test window. The message should contain $scriptline so you know which of them is being displayed, as well as preventing an error if all you're doing is printing an empty variable or a variable that begins with a hyphen.

This should let you see whether your $event is being triggered when it should be, or whether the problem is that your if-statements aren't using correct logic.

something like:
echo -s $scriptline key: $msgtags(msg-id).key 1-: $1-

Joined: May 2017
Posts: 3
J
jaany Offline OP
Self-satisified door
OP Offline
Self-satisified door
J
Joined: May 2017
Posts: 3
Originally Posted By: maroon
when you're having trouble getting your code working, it's often very helpful to salt your code with some echo messages sent to status window or to a @test window. The message should contain $scriptline so you know which of them is being displayed, as well as preventing an error if all you're doing is printing an empty variable or a variable that begins with a hyphen.

This should let you see whether your $event is being triggered when it should be, or whether the problem is that your if-statements aren't using correct logic.

something like:
echo -s $scriptline key: $msgtags(msg-id).key 1-: $1-



Decided to switch to node.js and make something there that works for now! Thanks, though


Link Copied to Clipboard