mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 4
T
timmyd Offline OP
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2006
Posts: 4
I have the following birthdays script, but want to add a !today command that will cause it to scan the list and respond "The following people are having a birthday today: name1, name2 etc"

I know this is probably very easy to do, but beyond my limited abilities. I'd appreciate some help!

Code:
on *:TEXT:!addbirth *:#:{ 
  If ($2 isnum) && ($3 isalpha) { 
    if $read(birthday.txt,s,$nick) { msg $chan $nick your birthday has already been recorded } 
    else { 
    msg #  $nick your birthday has been saved. | .write birthday.txt $nick $2- } 
  } 
  else { 
    msg $chan Please use this format:  !addbirth day month - e.g. !addbirth 28 February 
  } 
} 
on *:TEXT:!birthday *:#:{ If ($read(birthday.txt,s,$2)) { msg # $2 was born on $ifmatch } | else { msg # No Birthday details for $2 } }
on *:join:#:{ 
  var %bday = $read(birthday.txt,s,$nick) 
  if ($gettok(%bday,1,32) == $date(dd)) && ($left($gettok(%bday,2,32),3) == $date(mmm)) { 
    .timer 1 6 describe # wishes $nick a Happy Birthday!!!
  } 
}  

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
on *:text:!today:#:{
var %a = 1, %b = $lines(birthday.txt)
while %a <= %b {
var %bday = $read(birthday.txt,nt,%a)
if ($gettok(%bday,1,32) == $date(dd)) && ($left($gettok(%bday,2,32),3) == $date(mmm)) {
set %today $addtok(%today,$gettok(%bday,-1,32),32)
}
inc %a
}
.msg $chan The following people are celebrating their birthday's today $replace(%today,$chr(32),$+($chr(44),$chr(32)))
}
  


that should work based upon the information given in your post. I know it's not the greatest, but I'm not feeling well enough to do better at this time.

Joined: Mar 2006
Posts: 4
T
timmyd Offline OP
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2006
Posts: 4
Thanks for your effort. Unfortunately, whether there is a birthday or not for "today" I get the response " The following people are celebrating their birthdays today" with no names appended, so there is something wrong.

the birthday.txt file is in the format:

name1 7 March
name2 28 February
name3 7 March
etc

..if that helps. i really am useless at this.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Simply modify the last line like this:

if (%today) .msg $chan The following [...]

-genius_at_work

Joined: Mar 2006
Posts: 4
T
timmyd Offline OP
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2006
Posts: 4
Nope, no go at all now on !today.

Any other ideas?

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
You must have been sick mate, thats a pretty bad effort for you, yours are normally well better than that! (ps:

Anyway using your code i think this should work.

Code:
on *:text:!today:#:{
  var %a = 1, %b = $lines(birthday.txt), %today
  while %a <= %b {
    var %bday = $read(birthday.txt,nt,%a)
    if ($gettok(%bday,2,32) == $date(dd)) && ($left($gettok(%bday,3,32),3) == $date(mmm)) {
      var %today = $addtok(%today,$gettok(%bday,1,32),32)
    }
    inc %a
  }
  .msg $chan The following people are celebrating their birthday's today $iif(%today,$replace(%today,$chr(32),$+($chr(44),$chr(32))),knowone!)
}


QUICK NOTE to the person who wants this, since the MSG to channel has a . on the front, you well never acctually see it.

Last edited by DaveC; 08/03/06 07:08 AM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I've been fighting pneumonia for the past month, and I'd like to see anyone script up to par when they've been doing that.

Joined: Mar 2006
Posts: 4
T
timmyd Offline OP
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Mar 2006
Posts: 4
Thank you guys so much, that is perfect. I think it improves the existing script, because some people stay in channel even when they are away, so the onjoin message won't catch them. This way, ops can check and see if it is anyone's birthday and put a greeting in the topic or whatever.

Cheers! smile


Link Copied to Clipboard