mIRC Home    About    Download    Register    News    Help

Print Thread
Making a command user-specific only [TWITCH] #251212 11/02/15 10:04 PM
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
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.

Re: Making a command user-specific only [TWITCH] [Re: Majeye] #251213 11/02/15 10:08 PM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
You could do

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

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


You can also use $iff

Re: Making a command user-specific only [TWITCH] [Re: Majeye] #251214 11/02/15 10:10 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #251216 11/02/15 11:01 PM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
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
}


Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251217 11/02/15 11:21 PM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline
Ameglian cow
Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
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

Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251222 12/02/15 12:42 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #251223 12/02/15 01:26 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
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.

Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251225 12/02/15 01:44 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #251228 12/02/15 03:53 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Hm... why $mod? Would you just want to call out the script?
Also, RAWMODE?

Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251229 12/02/15 04:03 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #251230 12/02/15 04:10 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
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

Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251231 12/02/15 04:15 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
$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


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #251232 12/02/15 04:17 AM
Joined: Nov 2014
Posts: 79
N
Newbie Offline
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Oh, alright thank you! Didn't really know aliases could do that.

Re: Making a command user-specific only [TWITCH] [Re: Newbie] #251233 12/02/15 04:19 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Aliases will likely become a major part of your own scripting when you learn how to use them.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Making a command user-specific only [TWITCH] [Re: Nillen] #254745 29/08/15 02:16 AM
Joined: Aug 2015
Posts: 13
D
Despized Offline
Pikka bird
Offline
Pikka bird
D
Joined: Aug 2015
Posts: 13
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.

Re: Making a command user-specific only [TWITCH] [Re: Nillen] #254750 30/08/15 04:51 PM
Joined: Feb 2015
Posts: 243
O
OrFeAsGr Offline
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
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?

Re: Making a command user-specific only [TWITCH] [Re: OrFeAsGr] #254751 30/08/15 06:14 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net