mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
I have the code below to turn my twitch.tv bot on and off.

Code:
on $*:text:/^!points (on|off)/:#:{
  if $nick !isop # { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
  }
  if $2 == on { 
    unset %point.off 
    msg # Collecting points now.

  }
}



The above code pretty much has to be on top of every other code in my REMOTE tab to work correctly. No idea why, but it works so I'm not gonna question that.

My question is, how do I get it to say a msg to the whole channel if the user is not a mod? Everytime I try to add

else { msg $chan This command is only available to moderators. }

But that doesn't work anywhere in my channel.

Also if I type in
Code:
if $nick == SOMEONE's NAME { return }


They can't do !points on or !points off but I still can. Which is like totally backwards from what I just typed in. It should be if their nick is SOMEONE's Name do the command, But when they type in !points on or !points off it doesn't work, but it works for me


Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
What you're describing is your own fault, you want the code to happen when the $nick is equal to something you put in, but you have it set to return.

Read the help files for reference.
Originally Posted By: Help Files: /return
The Return command
The /return command halts a currently executing script and allows the calling routine to continue processing.
You can also optionally specify a return value which will be stored in the $result identifier. The $result can then be used in the calling routine.
/return [value]
The Halt command
The /halt command halts a script and prevents any further processing. You can use this in remote scripts to prevent mIRC from replying to normal ctcp messages, or in aliases to halt an alias, and any calling aliases, completely.

For basic stuff like this it's better off if you read the help files or read/watch a guide, as these aren't question one would normally have trouble with.
See the help files for reference, type "/help if" in your application and read up on that.

Here's an example for reference:
Code:
on $*:text:/^!points (on|off)/:#:{
 ;!isop means Is NOT an OP (mod) - Do the code:
  if $nick !isop # { msg # You're not a mod so you can't use this. | return }
 ;If $2 (Second word) is OFF, do this code.
  if $2 == off { 
    set -e %point.off 1 
    msg # Not collecting points anymore.
 ;Ending bracket for $2 == off
  }
 ;Otherwise if $2 is ON, do this code.
  elseif $2 == on { 
    unset %point.off 
    msg # Collecting points now.
 ;Ending bracket for $2 == on
  } 
 ;Ending bracket for this whole command.
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: May 2014
Posts: 27
E
Echosyp Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: May 2014
Posts: 27
Thank you very much Nillen! FINALLY!


How much would you charge? I got a SHIT LOAD of questions I would like to ask to someone for help. Me and a friend is building a twitch.tv bot for ourselves and just TRYING to understand mIRC coding. Seems I break sooo much.

Last edited by Echosyp; 26/05/14 01:12 AM.

Link Copied to Clipboard