mIRC Homepage
I am trying to make a script for twitch, for when a viewer would like to know something like when they joined the stream, and how long that have spent watching the stream.

I am at a loss for what direction to take with this task, and have spent time going through forums looking for anything that mite lead me in the right direction, I have come up with a few ideas on how to get this to work, but I am a total noob at this kind of thing, if anyone has some suggestions I would greatly appreciate it.

this is what I have come up with, I know its not in proper code format, its just what i've jotted down while I've been scouring the forums.

On join #
write $nick & $ctime ddmmyyyy to .txt file

on txt !joined
read .txt /msg $chan $nick joined $ctime ddmmyyyy

on txt !viewtime
read .txt $duration
/msg $chan has watched XX hours XX minutes XX seconds


thank you in advance for any great suggestions that may arise from this mess of a task lol cheers
Code:
on *:join:#: {
if (!$readini(joins.ini,#,$nick)) writeini joins.ini # $nick $ctime
}
on *:text:!joined:#: {
var %date $readini(joins.ini,#,$nick) 
if (!%date) var %msg Error: No data.
else var %msg You joined $asctime(%date) $+ , $duration(%date) ago.
msg # %msg
}
Be careful however, these kinds of scripts will fill an ini file quite quick and will turn extremely slow towards the end. If you want it to show how long a user has been in the channel lately, since last join that is, you just remove the IF check on the join event and leave it with only writeini.
Legendary, thank you so much!!! this is exactly what i was trying to find!
I have a question about this script. I added it to my bot, and it just says the error message. Do I need to add anything else to make it work?
As you can tell, it uses a join event. You need to see the join event to be able to trigger it first.
If you have seen a join event in the channel, make sure that the script does not have another join event triggering prior to this script.
You'll need to open a new file in the scripts editor and paste the script in there for it to work in this case.
This is very likely the case if for example you're using a points system that uses a join event.
Originally Posted By: Blondemoscow
I have a question about this script. I added it to my bot, and it just says the error message. Do I need to add anything else to make it work?


Be in mind that this code MUST be into alt+r -> Remote place and on an new file (via: alt+r -> File -> New)
© mIRC Discussion Forums