Top

Deathclock


mIRC Code
+ 2 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.0 (of 3 scores)
Date Added  Mar 26, 2009
Last Updated  Mar 27, 2009
Tags  deathclock 

Introduction

this was requested on the forums so i thought id bring it here

Syntax:
~deathclock <date> <month> <year> <sex> <mode> <body mass index> <smoker>
- modes can be < normal | pessimistic | sadistic | optimistic >
- sex can be < male | female >
- smoker can be < yes | no >

Example:
~deathclock 25 7 1984 male optimistic 25 yes


edit:
added a bit more error checking

Grab the Code

/*
DeathClock By PuNkTuReD
 
Syntax:
~deathclock <date> <month> <year> <sex> <mode> <body mass index> <smoker>
- modes can be < normal | pessimistic | sadistic | optimistic >
- sex can be < male | female >
- smoker can be < yes | no >
 
Example:
~deathclock 25 7 1984 male optimistic 25 yes
 
*/
on *:text:*:#: {
  if ($1 == ~deathclock) {
    set %dc.targ #
    if (!$2) { 
      msg %dc.targ Syntax: ~deathclock <date> <month> <year> <sex> <mode> <body mass index> <smoker>
      msg %dc.targ - modes can be < normal OR pessimistic OR sadistic OR optimistic >
      msg %dc.targ - sex can be < male OR female >
      msg %dc.targ - smoker can be < yes OR no >
    }
    else {
      ; date
      if ($2 isnum) { set %dc.date $2 }
      elseif ($2 !isnum) { msg # date has to be a number. | halt }
      ; month
      if ($3 isnum) { set %dc.month $3 }
      elseif ($3 !isnum) { msg # month has to be a number. | halt }
      ; year
      if ($4 isnum) { set %dc.year $4 }
      elseif ($4 !isnum) { msg # year has to be a number. | halt }
      ; sex
      if ($5 == male) || ($5 == female) { set %dc.sex $5 }
      elseif ($5 !== male) || ($5 !== female) { msg # sex has to be <male OR female> | halt }
      ; mode
      if ($6 == normal) || ($6 == pessimistic) || ($6 == sadistic) || ($6 == optimistic) { set %dc.mode $6 }
      elseif ($6 !== normal) || ($6 !== pessimistic) || ($6 !== sadistic) || ($6 !== optimistic) { msg # mode can be any of the following < normal OR pessimistic OR sadistic OR optimistic > | halt }
      ; body mass index
      if ($7 isnum) { set %dc.bmi $7 }
      elseif ($7 !isnum) { msg # body mass index has to be a number. | halt }
      ; smoker
      if ($8 == yes) || ($8 == no) { 
        if ($8 == yes) { set %dc.smoker 1 }
        if ($8 == no) { set %dc.smoker 0 }
      }
      elseif ($8 !== yes) && ($8 !== no) { msg # smoker has to be < yes OR no > | halt }
      sockopen deathclock www.deathclock.com 80
    }
  }
}
on *:sockopen:deathclock: {
  sockwrite -n $sockname GET $+($chr(47),dw.cfm,$chr(63),Day=,%dc.date,&Month=,%dc.month,&Year=,%dc.year,&Sex=,%dc.sex,&Mode=,%dc.mode,&bmi=,%dc.bmi,&Smoker=,%dc.smoker) HTTP/1.1
  sockwrite -n $sockname Host: deathclock.com 
  sockwrite -n $sockname $crlf 
}
on *:sockread:deathclock: {
  var %sockread | sockread %sockread
  if ($regex(%sockread,/&nbsp;<b>(.+)<\/b>/g)) { msg %dc.targ Your Personal Day of Death is... $remove($regml(1),&nbsp;) | unset %dc.* }
}

Comments

  (9)  RSS
a careful warchild
Comments: 243
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 11:57 am
What if your an hermaphrodite like Jonesy? What would you put then?

And the 'Smoking' part, does that cover bongs?
PunkTuReD
Comments: 458
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 12:02 pm
"What if your an hermaphrodite like Jonesy? What would you put then?"
unfortunatley they cant use this snippet. :-(

"And the 'Smoking' part, does that cover bongs?"
yea, why not.
a careful warchild
Comments: 243
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 12:07 pm
lol, good to have that cleared up.

Just spent 10 minutes looking over the script, looks good, haven't had a chance to test it yet, but for the layout, i'll give you a 4/10, when i've tested it, i'll update the rating accordingly :)
Fossa
Comments: 13
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 12:51 pm
Nice Job PunkTuReD ! Only the results are in difference (+- 13 years) when using the same info but thats not a scripting fault :) Well done man 7/10
Aucun50
Comments: 548
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 2:43 pm
I saw someone wanting one of these on forums nice work as always
Slickone
Comments: 10
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 3:33 pm
you should look over the code again.
Code:
if ($3 isnum) { set %dc.month $3 }
      elseif ($4 !isnum) { msg # month has to be a number. | halt }

on the elseif line you used $4 instead of $3


on the output you could make it like this
Code:
on *:sockread:deathclock: {
  var %sockread | sockread %sockread
  if ($regex(%sockread,/&nbsp;<b>(.+)<\/b>/g)) { msg %dc.targ Your Personal Day of Death is... $remove($regml(1),&nbsp;) | unset %dc.* }
}


anyways nice work
FordLawnmower
Comments: 387
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 8:01 pm
Ha! I was just getting ready to post the same script Only mine has different syntax.
DeathClock mm/dd/yyyy m|f s|n bmi. s|n, bmi optional. Then I just had !pessimistic
!sadistic !optimistic to refer to the last call. Here is my bmi alias anyway ;/
Code:
;Syntax $1 = weight in lbs $2 = height in inches
alias bmi {
  return $round($calc(($1 * 703) / ($2 * $2)),0)
}

At least I looked first this time ;/
uneek
Comments: 26
 
mIRC Snippet:  Deathclock
Posted on Mar 26, 2009 11:29 pm
Excellent work! Thanks so much..will be a lot of fun!

PunkTuReD
Comments: 458
 
mIRC Snippet:  Deathclock
Posted on Mar 27, 2009 12:18 am
@Slickone ahh shoot cheers, fixed. and updated the output to Slickone's.

@Aucun yea i put in the description, it was a request but i thought it had a place here too.

@EveryoneElse cheers glad u like.

yea i might add some more checks on to check month etc
dont want people putting 13 for month for example.

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom