mIRC Homepage
Posted By: Majeye Making a command user-specific only [TWITCH] - 11/02/15 10:04 PM
Trying to make a command user-specific only.. this is what I have, but isn't working.

Code:
  if ( $nick == majeye ) | ( $nick == nekkrolepsy )


I am sure I have it wrong, but not sure how.
You could do

Code:
if ($nick == majeye) {
   ACTION
}

elseif ($nick == nekkrolepsy) [
  OTHER ACTIOn 
}


You can also use $iff
Read the help files of /help if then else
'|' means nothing, (unless it tells mIRC to go to a different line since you didn't include a second opening parentheses in the if statement) '||' means OR.
These is very basic, you will find this in pretty much any language.
Originally Posted By: Nillen
Read the help files of /help if then else
'|' means nothing, (unless it tells mIRC to go to a different line since you didn't include a second opening parentheses in the if statement) '||' means OR.
These is very basic, you will find this in pretty much any language.


Oh that's interesting. Sorry to bother Nillen would this be viable?

Code:

if ($nick == newbie) || ($nick isop #) {
  DO THE THING
}

This would execute something only if your nick is 'newbie' or if the user is a channel moderator.

if thats exactly what you want, then yes :P
Yes, that will work exactly as Sjoepele said.

I recommed using another parentheses, even though it isn't required it helps to make a habit of doing it for future stuff.

Code:
if (($nick == newbie) || ($nick isop#)) { do stuff }

This way you can have other stuff as well.
Thanks guys, that's exactly what I was hoping to happen. Sometimes the program takes forever to realize that I'm a mod and so I have to wait for it to load. This way I can just say any other mod or me can run this task.
Try using a different method.
Code:
on @1:RAWMODE:#: { 
if (($nick == jtv) && ($1 == +o)) writeini mods.ini # $2 1 
}
alias mod { 
if (($readini(mods.ini,$2,$1)) || ($1 isop $2)) return 1 
}
on *:text:!test:#: { 
if ($mod($nick,#)) msg # $nick is a mod
else msg # $nick is not a mod
}
Since twitch is very irregular in keeping clients updated with information such as channel populations and op statuses this works well. It will store all users into a file once they're opped (mod) and then rely on that.
Hm... why $mod? Would you just want to call out the script?
Also, RAWMODE?
Since neither on OP or on SERVEROP will trigger on twitch irc, you have to rely on RAWMODE. '/help on RAWMODE' to read more about that.

Why $mod? It's just an alias, you can change the name of it however you'd like, as long as it doesn't collide with any of the default identifiers or other custom aliases. '/help aliases' to read more.
Thanks I'll look up the rawmode.

As for the alias I was just wondering why you had it as $mod instead of just mod
$mod indicates that it's an identifier that will return a value.
/mod indiscates that it's not an identifier and will perform an action without returning a value

Same as with $nick, $chan, etc.

The actual alias is written as "alias mod" as you can see, it just returns a value
/help aliases
Oh, alright thank you! Didn't really know aliases could do that.
Aliases will likely become a major part of your own scripting when you learn how to use them.
Just wanted to say thank you! This resolved an issue where I wasn't able to see the Moderator icon even after all the raw CAP REQ things in the perform section of the server connection.
I don't really know anything about twitch stuff.. but since you're storing those who get +o shouldn't you remove them from where you store them if they get deoped/quit/part?
But then you're relying on the twitch system again. If you remove them during -o, then there's no point in storing it during +o. $nick isop would work just fine in that case cause +o would be required for both cases.

The workaround here is to look for a single +o and store it for eternity. This would work in cases where +o is not set to users who are supposed to have it on twitch.

Twitch's irc has been known to have had this issue for periods of time.
© mIRC Discussion Forums