mIRC Homepage

Add users to a game list - twitch

Posted By: insaneteddie

Add users to a game list - twitch - 27/01/14 12:49 AM

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
Posted By: Nillen

Re: Add users to a game list - twitch - 27/01/14 01:31 AM

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.
Posted By: insaneteddie

Re: Add users to a game list - twitch - 27/01/14 01:34 AM

Thanks very much, yeah been working my way through the help files,
smile very kind good sir smile
Posted By: insaneteddie

Re: Add users to a game list - twitch - 27/01/14 02:05 AM

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
Posted By: Nillen

Re: Add users to a game list - twitch - 27/01/14 02:42 AM

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 

Posted By: insaneteddie

Re: Add users to a game list - twitch - 27/01/14 02:45 AM

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
Posted By: Zlaymon

Re: Add users to a game list - twitch - 31/08/14 04:07 PM

For some reason this does not work for me,any idea why?
Posted By: Nillen

Re: Add users to a game list - twitch - 31/08/14 05:05 PM

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.
Posted By: Zlaymon

Re: Add users to a game list - twitch - 31/08/14 07:37 PM

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
© 2021 mIRC Discussion Forums