mIRC Home    About    Download    Register    News    Help

Print Thread
Please help with birthday script #253249
05/06/15 08:21 PM
05/06/15 08:21 PM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
raycomp  Offline OP
Vogon poet
R

Joined: May 2013
Posts: 109
Please help improving this:
Quote:
on *:text:!birthday *:#:{
var %nick = $iif($2,$2,$nick)
if ($isbday(%nick) == 1) {
msg # 13Today is $+(%nick,'s) birthday! 5Jayyy!!!
}
elseif ($v1 == 0) {
var %bday = $readini(bday.ini,nicks,%nick)
var %month = $gettok(%bday,1,45)
var %day = $gettok(%bday,2,45)

msg # 5 $+(%nick,'s) birthday is on day %day of %month : He must wait $duration($todate(%month,%day))) from now!!!
}
else {
msg # No birthday recorded for %nick
}
}


That returns message: Nick's birthday is on day 12 of month 2 : He must wait 35wks 6days 2hrs 9mins 5secs from now!!!

would like to replace the %month with the name something like:
if %month = 1 then %name = January | if %month = 2 then %name = February etc

To return: Nick's birthday is on day 12 of February : He must wait 35wks 6days 2hrs 9mins 5secs from now!!!

Last edited by raycomp; 05/06/15 08:22 PM.
Re: Please help with birthday script [Re: raycomp] #253256
06/06/15 05:17 AM
06/06/15 05:17 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
splinny  Offline
Fjord artisan

Joined: May 2015
Posts: 249
Well, you can use $asctime($calc($ctime + 21694145),mmmm)
where 21694145 is you $duration($todate)) reply.


Dont give a fish - teach to fish!
Re: Please help with birthday script [Re: splinny] #253258
06/06/15 06:46 AM
06/06/15 06:46 AM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
raycomp  Offline OP
Vogon poet
R

Joined: May 2013
Posts: 109
not working that returns today's date and time: Sat Jun 06 08:40:33 2015 unless I am using it incorrectly in my code

in the ini file the date stored is 2 12 2=month 12=day

my code returns 2 12 in msg - would like to return February 12

Last edited by raycomp; 06/06/15 06:47 AM.
Re: Please help with birthday script [Re: raycomp] #253259
06/06/15 07:05 AM
06/06/15 07:05 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
splinny  Offline
Fjord artisan

Joined: May 2015
Posts: 249
Try this: msg # 5 $+(%nick,'s) birthday is on day %day of $asctime($calc($ctime + $todate(%month,%day)),mmmm) : He must wait $duration($todate(%month,%day))) from now!!!


Dont give a fish - teach to fish!
Re: Please help with birthday script [Re: splinny] #253262
06/06/15 08:27 AM
06/06/15 08:27 AM
Joined: May 2013
Posts: 109
R
raycomp Offline OP
Vogon poet
raycomp  Offline OP
Vogon poet
R

Joined: May 2013
Posts: 109
thanks. Works perfectly

Last edited by raycomp; 06/06/15 08:46 AM.
Re: Please help with birthday script [Re: raycomp] #253266
06/06/15 09:02 AM
06/06/15 09:02 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
splinny  Offline
Fjord artisan

Joined: May 2015
Posts: 249
Ok, what is your $todate alias then?


Dont give a fish - teach to fish!