mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 4
I
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

Joined: Dec 2013
Posts: 779
N
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
Joined: Jan 2014
Posts: 4
I
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

Joined: Jan 2014
Posts: 4
I
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

Joined: Dec 2013
Posts: 779
N
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
Joined: Jan 2014
Posts: 4
I
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

Joined: Aug 2014
Posts: 2
Z
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?

Joined: Dec 2013
Posts: 779
N
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
Joined: Aug 2014
Posts: 2
Z
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


Link Copied to Clipboard