mIRC Homepage
Posted By: raycomp Announce Birthday - 03/06/16 08:45 PM
I am using this script in my bot to add users birthdays and to congratulate them on join. It also calculates weeks and days till next birthday. The topic change is not working properly but the rest is pretty good. I would love if be able to display all birthdays for the current date and for specified month if someone can help with that, I have tried to no avail.

Maybe not the neatest code but I am trying. You can use it and if you improve it if you would give me an new copy
Code:
Quote:

;Commands
; !bday nick
; !add nick month day
; !Remove nick

on *:text:\Birthday:#:{
.notice $nick 12...10::7|4 Birthday Corner 7|10::12...
.notice $nick 1Add------------: 4!add nick 1(like John 3 7 )
.notice $nick 1Birthday-------: 4!bday nick 1( nick's birthday)
.notice $nick 1Remove---------: 4!remove nick 1(Ops only)
}

if ($isbday($nick) == 1) /topic #channel 4(¯`·._(¯`·._(¯`·._( 5Channel wishes $+($nick) a happy birthday !!!!!4_.·´¯)_.·´¯)_.·´¯)

alias bday.usage {
if ($prop == add) { return !add nick month day }
if ($prop == bday) { return !bday nick }
return 12Tik4 !add nick month day 5(like !add John 12 25 for 25th December) to add. 12Type4 !bday John 5om to see when his birthday will be.
}

on *:start:{
.timerbday 0 9000 announcebdays #channel
}

on *:join:#: {
if ($isbday($nick) == 1) /topic # 4,0%0,4%4,4 5,4%4,5%5,5 1,5%5,1%1,1 0 channel whishes $+($nick) a happy birthday !!!! 5,1%1,5%5,5 4,5%5,4%4,4 0,4%4,0%
if ($isbday($nick) == 1) msg # 12Happy birthday $+($nick,!)12sings 13 •* happy birthday to you, you look like a monkey and you act like one toooo *• 5 out of tune
}

;-============================
on 1:text:!remove *:#:{
if ($nick isop $chan) {
if (!$readini(bday.ini,nicks,$2)) {
msg $chan 2Sorry no birthday recorded for $2
}
else {
remini bday.ini nicks $2
msg $chan $2 $+ 's 5Birthday for $nick was cancelled in $chan
}
}
else {
msg $nick 12Sorry only OPS van delete a birthday.
}
}


on *:text:!bday *:#:{
var %nick = $iif($2,$2,$nick)
if ($isbday(%nick) == 1) {
msg # 13Today is $+(%nick 's) birthday! 5Jayyy!!!
return
}
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 %day $asctime($calc($ctime + $todate(%month,%day)),mmmm) : 4Must wait $duration($todate(%month,%day))) from this minute!!!
return
}

if (%nick == me) msg # Wake up!!!

else {
msg # 4pffffft?2 %nick 1 is to ashamed to get birthday anounced!
}
}

on *:text:!add *:#:{
var %bdayerror 0
if ($3 < 1) var %bdayerror Month to low: ! (only 1-12 allowed)
if ($3 > 12) var %bdayerror Month to high: ! (only 1-12 allowed)
if ($4 < 1) var %bdayerror Day to low: ! (only 1-31 allowed)
if ($4 > 31) var %bdayerror Day to high: ! (only 1-31 allowed)
if (%bdayerror != 0) {
.msg # [bday] Problem: %bdayerror
halt
}
if ($addbday($2,$3,$4)) {
msg # 12 $2 's birthday recorded 4as month $3 day $4 .
}
else {
msg # $bday.usage().add
}
}

alias addbday {
var %nick = $1
var %month = $2
var %day = $3

if ($0 < 3) || (%day !isnum) return $false

if (%month isalpha) {
var %months = jan feb mar apr may jun jul aug sep oct nov dec
%month = $findtok(%months,$left(%month,3),32)
}
else {
%month = $regsubex(%month,^0+,)
}

var %date = $+(%month,-,%day)

writeini bday.ini nicks %nick %date
writeini bday.ini %date %nick 1
return $true
}

alias announcebdays {
var %chan = $$1
var %date = $+($asctime(m),-,$asctime(d))
var %nick, %nicklist
var %i = 1
var %n = $ini(bday.ini,%date,0)
while (%i <= %n) {
%nick = $ini(bday.ini,%date,%i)
if (%nick ison %chan) %nicklist = %nicklist %nick
inc %i
}
dec %i
if (%i == 2) {
%nicklist = $replace(%nicklist,$chr(32),$+($chr(32),$chr(38),$chr(32)))
}
elseif (%i > 2) {
%nicklist = $replace(%nicklist,$chr(32),$+($chr(44),$chr(32)))
%nicklist = $regsubex(%nicklist,(\S+?$),and \1)
}

if (%nicklist) msg %chan 6 Happy birthday $+(%nicklist,!)
}

alias isbday {
var %nick = $1
var %date = $readini(bday.ini,nicks,%nick)
var %month = $gettok(%date,1,45)
var %day = $gettok(%date,2,45)

if (!%date) return -1
if (%month == $asctime(m)) && (%day == $asctime(d)) return 1
return 0
}

alias todate {
var %month = $1
var %day = $$2
var %year = $asctime(yyyy)

var %todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
if (%todate < 0) {
inc %year
%todate = $calc($ctime($+(%day,-,%month,-,%year) 00:00:00) - $ctime)
}
return %todate
}


The ini file looks like this: Just a portion month first date second

[nicks]
Assemblief=2-12
AbleMan=2-12
Nikita=2-11
Blom=7-11
jenny=3-17
Oulikepop=1-11

[2-11]
Nikita=1

[2-12]
AbleMan=1
Assemblief=1

[1-11]
oulikepop=1

[7-11]
Blom=1
Bomskok=1

[7-11]
Blom=1
Bomskok=1
Posted By: splinny Re: Announce Birthday - 04/06/16 07:01 AM
I`d suggest changing .ini stucture to:
Code:
[1] (for jan)
1=nick1,nick2
15=nick1
28=nick1,nick2,nick3
[2]
bl abla

and use token identifiers.
Posted By: raycomp Re: Announce Birthday - 04/06/16 03:08 PM
that would mean changing most of the code. The way the ini
is structured is that if you use the command:

!bday AbleMan

this is returned:

AbleMan's birthday 12 February : Must wait 36wks 6hrs 53mins 27secs
Posted By: BrokenHeart Re: Announce Birthday - 13/06/16 02:52 PM
very nice script but i would like a change.

As it is now any user can add many users
As it is now a user can use
!add Danny 5 6 .... !add Mary 6 8 ..... !add Jason 5 6 and can add users again and again.
I was thinking it would be better if a user could add only hiself/herself.
for example if my Nickname is Mike i can use only !add Mike

Also i'd like the script to run for the owner
If the script runs on me the script isn't running.
I'd like the script to run for the owner.

The owner also could add/remove users
Posted By: raycomp Re: Announce Birthday - 02/07/16 07:47 PM
Good suggestions. Any expert who could put all this together please?
© mIRC Discussion Forums