mIRC Home    About    Download    Register    News    Help

Print Thread
Add users to a game list - twitch #244150 27/01/14 12:49 AM
Joined: Jan 2014
Posts: 4
I
insaneteddie Offline OP
Self-satisified door
OP Offline
Self-satisified door
I
Joined: Jan 2014
Posts: 4
Hi, I'm new to this Mirc Bot writing, have used Mirc for years though.
I am trying to write a script for a chat bot, that will enable users in a twitch chat room,(!joinlist IGNGOESHERE) to join a queue with their IGN(in game name),
(!list) to display the list of people currently in the queue , (!del IGN) enable a mod to delete a user from the list.
any ideas where to start even, I am so lost,
also a good tutorial site would be useful as I would like to add other features to this eventually.
Thanks in advance.
Steve

Re: Add users to a game list - twitch [Re: insaneteddie] #244151 27/01/14 01:31 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
on *:text:!listjoin:#: { 
  if ($read(list.txt,nw,$nick)) { msg $chan $nick is already in the list. | return }
  else write list.txt $nick 
  msg $chan Added $nick to the list
}
	
	
on *:text:!del *:#: { 
if ($nick isop #) {
 if (!$read(list.txt,nw,$2)) { msg $chan $2 is not in the list. | return }
 elseif ($read(list.txt,nw,$2)) { msg $chan deleted $2 from the list. 
  write -dl $+ $readn list.txt }
  }
  }
  

I suggest you do not read every name in the file since it's one of the easiest ways to get chat banned from twitch.

Lots of info can be found by typing "/help /write" in the mIRC application, I suggest you do so as well.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Add users to a game list - twitch [Re: Nillen] #244152 27/01/14 01:34 AM
Joined: Jan 2014
Posts: 4
I
insaneteddie Offline OP
Self-satisified door
OP Offline
Self-satisified door
I
Joined: Jan 2014
Posts: 4
Thanks very much, yeah been working my way through the help files,
smile very kind good sir smile

Re: Add users to a game list - twitch [Re: insaneteddie] #244153 27/01/14 02:05 AM
Joined: Jan 2014
Posts: 4
I
insaneteddie Offline OP
Self-satisified door
OP Offline
Self-satisified door
I
Joined: Jan 2014
Posts: 4
so trying to write the list,
on the usage of !list,
is there a way to limit how many are written as in if i want to write the first 5 people on the list?
still not definite on getting it to write the list when someone, ( even if i have to limit to a mod) does the !list

Re: Add users to a game list - twitch [Re: insaneteddie] #244154 27/01/14 02:42 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
There's probably an easier way to do this, but this works.

Code:
on *:text:!listjoin:#: { 
  if ($read(list.txt,nw,$nick)) { msg $chan $nick is already in the list. | return }
  else write list.txt $nick 
  msg $chan Added $nick to the list
}

on *:text:!del *:#: { 
  if ($nick isop #) {
    if (!$read(list.txt,nw,$2)) { msg $chan $2 is not in the list. | return }
    elseif ($read(list.txt,nw,$2)) { msg $chan deleted $2 from the list. 
    write -dl $+ $readn list.txt }
  }
}

on *:text:!list:#: {
  if ($nick isop #) { 
    var %t1 $read(list.txt,1) 
    var %t2 $read(list.txt,2)
    var %t3 $read(list.txt,3) 
    var %t4 $read(list.txt,4) 
    var %t5 $read(list.txt,5) 
  msg $chan %t1 %t2 %t3 %t4 %t5 }
}

on *:text:!listreset:#: {
  if ($nick isop #) { write -c list.txt 
  msg $chan list reset. }
}


This will display the first 5 who joined. If you want the 5 latest, replace
Code:
 else write list.txt $nick 
with
Code:
 else write -il1 list.txt $nick 



Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Add users to a game list - twitch [Re: Nillen] #244155 27/01/14 02:45 AM
Joined: Jan 2014
Posts: 4
I
insaneteddie Offline OP
Self-satisified door
OP Offline
Self-satisified door
I
Joined: Jan 2014
Posts: 4
omg thanks, Thats huge help, i was no-where near close on my version smile
lol,
found some good tutorials for mirc scripting etc, so reading through them slowly thanks again for the help, and speedy response.
steve

Re: Add users to a game list - twitch [Re: Nillen] #247847 31/08/14 04:07 PM
Joined: Aug 2014
Posts: 2
Z
Zlaymon Offline
Bowl of petunias
Offline
Bowl of petunias
Z
Joined: Aug 2014
Posts: 2
For some reason this does not work for me,any idea why?

Re: Add users to a game list - twitch [Re: Zlaymon] #247849 31/08/14 05:05 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
If it's not working for you, your event is likely getting grabbed by some other event. Try adding a new file and paste it in there.

This code is very ineffective however, it's likely that I copied it from somewhere else due to laziness as it does not look like my style of scripting.
I recommend scripting something similar yourself, you can use it as a template with your original ideas to make it easy on yourself. This is the best way to learning and you will be able to debug and understand what it is you're creating yourself far better as well.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Add users to a game list - twitch [Re: Nillen] #247850 31/08/14 07:37 PM
Joined: Aug 2014
Posts: 2
Z
Zlaymon Offline
Bowl of petunias
Offline
Bowl of petunias
Z
Joined: Aug 2014
Posts: 2
I got it to work, but do you know how I can make it so that only subscribers to the channel can use the "join" command? That would be golden :P