newbie requires help

Douglas Mackay DouglasMackay at blueyonder.co.uk
Sat Jan 24 19:27:45 EST 2004


I am trying to learn from other people's scrips so I downloaded the age calculator on from the web. It comes p continually with the same "bug" i dont know how to fix. The line in question is 
put (item 1 of enddate - item 1 of startdate) into diffan and the full script is :

ask "Date of Birth? (eg. 23/9/1987)"

put it into firstDate

ask "Date of Assessment? (eg. 18/3/2001)"

put it into secondDate

put whichage (firstDate, secondDate) into dateholder

if Gbox = 1

then put "year" into field "nameYear"

else

put "years" into field "nameYear"

end if

put Gbox into field "year2"

if item 2 of dateholder = 1

then put "month" into field "nameMonth"

else

put "months" into field "nameMonth"

end if

put item 2 of dateholder into field "month"

if item 3 of dateholder = 1

then put "day" into field "nameDay"

else

put "days" into field "nameDay"

end if

put item 3 of dateholder into field "day"

also a script for                         :

set the centuryCutoff to 35

set useSystemDate to true

if param(1) = "" then exit to top

put param(1) into startdate

put param(2) into enddate

set the itemDelimiter to "/"

put item 3 of startdate into GsYear

put item 3 of enddate into GeYear

set the itemDelimiter to comma

convert startdate to dateitems

convert enddate to dateitems

put item 3 of enddate into bbmsg

put (item 3 of enddate - item 3 of startdate) into diffjour

if diffjour < 0 then

add "1" to item 2 of startdate

get item 2 of enddate

if (it is in "1,3,5,7,8,10") or (it= "12") then put "31" into correction

else if (it is in "4,6,9,11") then put "30" into correction

else if item 1 of enddate mod 4 = 0 then put "29" into correction

else put "28" into correction

add correction to item 3 of enddate

put (item 3 of enddate - item 3 of startdate) into diffjour

end if

put (item 2 of enddate - item 2 of startdate) into diffmois

if diffmois < 0 then

add "1" to item 1 of startdate

put (item 2 of enddate) + 12 into item 2 of enddate

put (item 2 of enddate - item 2 of startdate) into diffmois

add "1" to GsYear

end if

put (item 1 of enddate - item 1 of startdate) into diffan

put (GeYear - GsYear) into Gbox

return diffan&","&diffmois&","&diffjour

can anyone help ? 




More information about the use-livecode mailing list