mIRC Home    About    Download    Register    News    Help

Print Thread
#256086 17/12/15 05:39 AM
Joined: Oct 2015
Posts: 8
E
ekwag Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
E
Joined: Oct 2015
Posts: 8
So, I want to make a script for my twitch bot that will take a .ini file full of user's birthdays and compare it with the current day. I get the back idea that I have to run a while loop and compare it to $date, but I am not sure how I would return the user's name.
Essentially the goal is to be able to do !birthday and check if there are any regular viewers' birthdays on that day.

Can anyone help me out with the best to do this? I am open to making the format of the .ini file whatever the best format is

Joined: Dec 2015
Posts: 147
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2015
Posts: 147
Doing this on my phone, so expect typos and stuff.

The format could be as simple as "nick=ctime". In this case, let's call the INI section "birthdays" and let's store the info in birthdays.ini file.

Code:
hfree -w bdays
hmake bdays
hload -i bdays birthdays.ini birthdays
var %x = 1,%n,%d $asctime(mmdd)
while ($hget(bdays,%x).item) {
tokenize 32 $v1 $hget(bdays,$v1)
if ($asctime($2,mmdd) == %d) var %n = %n $1
inc %x
}


If it's anyone's birthday, their name will be in %n variable when the loop finishes.

You can make it even easier and simpler if you don't need/want to store the birth year. You can just store the data in "nick=mmdd" format and compare it to $asctime(mmdd) directly, without the asctime conversion in the loop.

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
Why not to store it like YYYYMMDD=nick1,nick2,nick3, looks easier. So you just need to check if today`s YYYYMMDD exists in .ini\hash\else.

Last edited by splinny; 17/12/15 07:49 AM.
Joined: Dec 2015
Posts: 147
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2015
Posts: 147
+1 to this idea, ignore my earlier post.


Link Copied to Clipboard