Discuss Scratch

testingscript64
Scratcher
100+ posts

How to make a simple countdown script

Hi, I want to make a simple countdown script that counts how many days are left until it's a specific date. does anyone know how to make one?

EDIT: I mean a countdown for a day on a different month.

Last edited by testingscript64 (Sept. 6, 2014 13:56:12)

Par0dy
Scratcher
100+ posts

How to make a simple countdown script

If it's the same month but the days different just do this:
set [Days Left v] to ((10) - (current [day v]) //you change 10 to whatever day it is

Last edited by Par0dy (Sept. 6, 2014 13:01:01)


MegaApuTurkUltra
Scratcher
1000+ posts

How to make a simple countdown script

if <(current [year v])>(target year)>
// passed
else
if<<(current [year v])=(target year)>and <(current [month v])>(target month)>>
// passed
else
if <<<(current [year v])=(target year)>and <(current [month v])=(target month)>>and <(current [day v])>(target day)>>
// passed
else
set [days left v] to (target day)
set [i v] to (target month)
change [i v] by (((target year)-(current [year v]))*(12))
if<not<(i)=(current [month v])>>
change [i v] by (-1)
repeat until <(i)=(current [month v])>
if <(((i) mod (12)) mod (2))=(1)>
change [days left v] by (31)
else
if <((i) mod (12))=(2)>
change [days left v] by (29) // leap years are complicated so I ignore them
else
change [days left v] by (30)
end
end
change [i v] by (-1)
end
if <(((i) mod (12)) mod (2))=(1)> // we add this month too
change [days left v] by (31)
else
if <((i) mod (12))=(2)>
change [days left v] by (29) // leap years are complicated so I ignore them
else
change [days left v] by (30)
end
end
end
change [days left v] by ((0)-(current [day v]))
say [idk if this worked but]
say (days left)

Ughhh why can't Scratch just have a System.currentTimeMillis() ?

Last edited by MegaApuTurkUltra (Sept. 6, 2014 16:52:14)


$(".box-head")[0].textContent = "committing AT crimes since $whenever"

Powered by DjangoBB