mIRC Home    About    Download    Register    News    Help

Print Thread
Can't get channel name when doing !raid #246049 20/05/14 02:14 PM
Joined: Feb 2014
Posts: 9
F
FlyingPotatoes Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2014
Posts: 9
So I want to create this command so I can redirect my viewers to another channel. I want to make it so when I type !raid channel it will show up with a message. I just can't get that channel name to show when doing the command.

Code:
on *:TEXT:!raid:#: {
  if ($nick == flyingpotatos) { if ($$0 < 2) { msg # Insufficient parameters, use !raid [channel name] }
    else { msg # The stream is over everyone. Let's raid someone! Go to http://www.twitch.tv/ $2 and say in the chat 'FlyingPotatoes Mini-Raid!!!' }
    else { msg # Only the streamer has acces to the raid command! }
  }
}

Re: Can't get channel name when doing !raid [Re: FlyingPotatoes] #246050 20/05/14 02:16 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
If you're looking to use the $2 identifier, you need to specify in the event to allow wildcards.
Code:
on *:TEXT:!raid *:#: {

Your other else statement is placed wrong btw. You need to place it after the ending bracket from the first if statement.
And you want to use $+ before $2 as well, since otherwise it will look like this: twitch.tv/ whatever instead of twitch.tv/whatever


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Can't get channel name when doing !raid [Re: FlyingPotatoes] #246051 20/05/14 02:27 PM
Joined: Feb 2014
Posts: 9
F
FlyingPotatoes Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
F
Joined: Feb 2014
Posts: 9
So now I have
Code:
on *:TEXT:!raid *:#: {
  if ($nick == flyingpotatos) { if ($$0 < 2) { msg # Insufficient parameters, use !raid [channel name] }
    else { msg # The stream is over everyone. Let's raid someone! Go to http://www.twitch.tv/$2 and say in the chat 'FlyingPotatoes Mini-Raid!!!' }
    else { msg # Only the streamer has acces to the raid command! }
  }
}

But I get The stream is over everyone. Let's raid someone! Go to http://www.twitch.tv/$2 and say in the chat 'FlyingPotatoes Mini-Raid!!!'. How can I include $2 and still make it a link?



Did it, if anyone wants the code, here you go:
Code:
on *:TEXT:!raid *:#: {
  if ($nick == flyingpotatos) { if ($$0 < 2) { msg # Insufficient parameters, use !raid [channel name] }
    else { msg # The stream is over everyone. Let's raid someone! Go to http://www.twitch.tv/ $+ $2 and say in the chat 'FlyingPotatoes Mini-Raid!!!' }
    else { msg # Only the streamer has acces to the raid command! }
  }
}

Last edited by FlyingPotatoes; 20/05/14 02:29 PM.
Re: Can't get channel name when doing !raid [Re: FlyingPotatoes] #246052 20/05/14 02:42 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
It's still wrong.
Try getting someone else that isn't nicked flyingpotatos to try it and you'll see.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Can't get channel name when doing !raid [Re: Nillen] #246053 20/05/14 10:43 PM
Joined: Apr 2014
Posts: 170
Bramzee Offline
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
after messing around with this, I found it was easier to just add the !raid command into the commands.ini file (!commandadd !raid) Don't laugh at me, but I re-wrote an entire code that was basically (after checking) my !commandadd/!commandremove script lol. So, I would suggest if you don't already have this for your bot to add it in CLICK HERE FOR THAT and just use !commandadd !raid Message here.

Then only op's can edit this and anyone can do the !raid. If that's not exactly what you're looking for, sorry smirk But I just wanted to point out that it's easier to just use that rather than re-doing the entire script when it's basically the same thing.

Re: Can't get channel name when doing !raid [Re: FlyingPotatoes] #246057 21/05/14 03:22 PM
Joined: May 2014
Posts: 10
startgame Offline
Pikka bird
Offline
Pikka bird
Joined: May 2014
Posts: 10
Code:
on *:text:!raid *:#:{
  if ($len($2) >= 3) && ($2 != $null) {
    msg $chan The stream is over everyone. Let's raid someone! Go to http://www.twitch.tv/ $+ $2 and say in the chat 'Custom text here'
  }
}


Just a more simple, less spammy way of doing this. I added a check to ensure the character count of the inputted channel is 3 or more since twitch does not seem to hold any accounts below 3 characters, and if they do they are most likely not accessible by the community as I have spent a fair time looking.

Of course if you want it only to be used by operators just use ($nick isop $chan), read from a file, or create a hash to read the users from that are moderators in the channel.

Good luck to whoever makes use of this.

Re: Can't get channel name when doing !raid [Re: startgame] #246060 21/05/14 06:12 PM
Joined: Apr 2014
Posts: 170
Bramzee Offline
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
I went back and looked into this some more, because it peaked my interest a bit, and it helped me to learn a few things as well (as someone who's new to this) This IS tested AND working 100% however, after the raid is over, you will need to clear the raid.txt file manually (really you could add in a clear command as well, but I didn't mind just clearing it manually. If you want it, it's really not that hard to add in.

With this, only YOU will be able to add a raid.
Everyone in chat can use the !raid command.
And flood control is on (obviously) to protect your bot from getting banned for 20 messages in 30 seconds smile Hope this helped, startgame thanks for posting in here and reminding me I did this, as well as for helping out people that need it smile


Code:
on *:TEXT:!raid*:#: {
  if ((%floodraid) || ($($+(%,floodraid.,$2),2))) { return }
  set -u10 %floodraid On
  set -u30 %floodraid. $+ $nick On
  if ($2 == $null) msg # $read(raid.txt)
  if ($nick == yourchannelname) {
    write raid.txt Stream is over, be sure to go check out twitch.tv/ $+ $$2 add more message here
    msg $chan Stream is over, be sure to go check out twitch.tv/ $+ $$2 add more message here
  }
}

Re: Can't get channel name when doing !raid [Re: Bramzee] #246068 22/05/14 12:47 AM
Joined: May 2014
Posts: 10
startgame Offline
Pikka bird
Offline
Pikka bird
Joined: May 2014
Posts: 10
Originally Posted By: Bramzee
I went back and looked into this some more, because it peaked my interest a bit, and it helped me to learn a few things as well (as someone who's new to this) This IS tested AND working 100% however, after the raid is over, you will need to clear the raid.txt file manually (really you could add in a clear command as well, but I didn't mind just clearing it manually. If you want it, it's really not that hard to add in.

With this, only YOU will be able to add a raid.
Everyone in chat can use the !raid command.
And flood control is on (obviously) to protect your bot from getting banned for 20 messages in 30 seconds smile Hope this helped, startgame thanks for posting in here and reminding me I did this, as well as for helping out people that need it smile


Code:
on *:TEXT:!raid*:#: {
  if ((%floodraid) || ($($+(%,floodraid.,$2),2))) { return }
  set -u10 %floodraid On
  set -u30 %floodraid. $+ $nick On
  if ($2 == $null) msg # $read(raid.txt)
  if ($nick == yourchannelname) {
    write raid.txt Stream is over, be sure to go check out twitch.tv/ $+ $$2 add more message here
    msg $chan Stream is over, be sure to go check out twitch.tv/ $+ $$2 add more message here
  }
}


I am honestly not a fan of the method you use. Mainly because streamers enjoy choosing the person they wish to raid. Chances are too high that it would hit the same channel multiple times as I doubt that most broadcasters would fill it with random channels.

Also for your flood protection I'd recommend just putting it inside of an alias and calling from remote. This way you save the time of typing too much or copy/paste'ing all of that.

Here is the flood protection I made for my newest bot:
Code:
alias -l floodcheck {
if ((%flood.) || ($($+(%,flood.,$nick),2))) { echo -a Stopped | halt }
  else {
    set -z %flood. $+ $chan $1 
    set -z %flood. $+ $nick $2 
  } 
}


You can call that in an event by using:
Code:
floodwatch <channel time> <user time>

channel time = time before others can execute
user time = time before previous user can execute

Quick example:
Code:
on *:text:Flood:#:{
  floodcheck 5 10
  var %n = 1, %o = 5
  while (%n <= %o) {
    echo -a Current: %n
    inc %n
  }
}


Will halt the script from continuing with the command as usual.

Feel free to take and use as you please

Re: Can't get channel name when doing !raid [Re: startgame] #246072 22/05/14 02:27 AM
Joined: Apr 2014
Posts: 170
Bramzee Offline
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Appreciate the knowledge man smile Enjoy learning new ways of doing stuff smile