mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2015
Posts: 42
A
Artiiz Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Apr 2015
Posts: 42
Hello,

I need just some little help with a script I've made.
It's supposed to let people vote for a game with !vote in chat, and then the game should be saved into a file in my mIRC folder.

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

ON *:text:!vote *:#yznb: {
  if ($msgtags(subscriber).key) {
    write SUBTEST.txt Game: ( $+ $2- $+ ) Requested by: ( $+ $nick $+ )
  }
  else {
    $isin(HIGHLIGHT.txt) {
      msg $chan @ $+ $nick You've already placed your vote.
    }
  }
}


What I've been trying to do is that if the user who wrote !vote already is in the SUBTEST.txt file, the message
"You've already placed your vote." shall appear, and the game that the person has voted for should not be saved into the file.

I tried to like this, but it doesn't work:
Code:
ON *:text:!vote *:#yznb: {
  if ($msgtags(subscriber).key) {
    write SUBTEST.txt Game: ( $+ $2- $+ ) Requested by: ( $+ $nick $+ )
  }
  else {
    if $nick == $isin(HIGHLIGHT.txt) {
      msg $chan @ $+ $nick You've already placed your vote.
    }
  }
}


Anyone that know what's wrong or what I should replace it with, for making it work?
I've also tried the "else" that's stated in the first Code, but that didn't seem to work either.

Thanks!

Last edited by Artiiz; 10/02/16 08:48 PM.
Joined: Jul 2015
Posts: 13
S
Pikka bird
Offline
Pikka bird
S
Joined: Jul 2015
Posts: 13
You have inverted the if and the else.

IF the person is in the highlight.txt => msg xxx
ELSE write xxx

For me it's like that ^^

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try use this code:

Restart the bot after you place the new code!

NOTE: The !vote command is only working if the user is subscriber.

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

ON *:TEXT:!vote *:#yznb: {
  if ($msgtags(subscriber).key) { 
    var %r = $read(HIGHLIGHT.txt,nw,* $+ $nick $+ *)
    if (%r) { msg $chan @ $+ $nick You've already placed your vote. | return }
    write SUBTEST.txt Game: ( $+ $2- $+ ) Requested by: ( $+ $nick $+ )
  }
}

Last edited by westor; 11/02/16 04:30 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard