mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 107
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 107
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.

Joined: Nov 2014
Posts: 79
N
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

Joined: Dec 2013
Posts: 779
N
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
Joined: Nov 2014
Posts: 79
N
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
}


Joined: Mar 2014
Posts: 42
S
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

Joined: Dec 2013
Posts: 779
N
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
Joined: Nov 2014
Posts: 79
N
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.

Joined: Dec 2013
Posts: 779
N
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
Joined: Nov 2014
Posts: 79
N
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?

Joined: Dec 2013
Posts: 779
N
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
Joined: Nov 2014
Posts: 79
N
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

Joined: Dec 2013
Posts: 779
N
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
Joined: Nov 2014
Posts: 79
N
Babel fish
Offline
Babel fish
N
Joined: Nov 2014
Posts: 79
Oh, alright thank you! Didn't really know aliases could do that.

Joined: Dec 2013
Posts: 779
N
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
Joined: Aug 2015
Posts: 13
D
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.

Joined: Feb 2015
Posts: 243
O
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?

Joined: Dec 2013
Posts: 779
N
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

Link Copied to Clipboard