Revision as of 23:23, 24 March 2015 by KrIsMa (talk | contribs)

Template:Wiki Standard A countdown is something which would explain how many days (or another time form) are left until a certain event starts. Projects can also have countdowns too. Here's how to make one.

List

First, you need a list. A list is a feature which allows you too stall multiple values at once. Create a list called Dates or anything you want to call it.

Okay, for each item in the list (except the last), it need to be the last date of the months before the month of the event. The first item will have the last date of the current month and the last one will have the date of the event. For example, we're making a countdown to Scratch Day 2015 and it's currently March.

when gf clicked
delete (all v) of [Dates v]
add [31] to [Dates v]
add [30] to [Dates v]
add [9] to [Dates v]

Computing the countdown

Here, we now have the list but the countdown isn't complete! Create a variable called Days left (since we're using days) or whatever you want to call it.

Back to our list, we need to have this script which completes the countdown. The first month will be the current month and the last month will be the month of the event. We'll use March (3) as the first one and May (5) as the last one.

when gf clicked
if <(current [month v]) = (3)>
replace item (1 v) of [Dates v] with ((item (1 v) of [Dates v]) - (current [date v]))
else
replace item (1 v) of [Dates v] with (0)
if <(current [month v]) = (4)>
replace item (2 v) of [Dates v] with ((item (2 v) of [Dates v]) - (current [date v]))
else
replace item (2 v) of [Dates v] with (0)
if <(current [month v]) = (5)>
replace item (3 v) of [Dates v] with ((item (3 v) of [Dates v]) - (current [date v]))
end
end
end
set [Days left v] to ((item (1 v) of [Dates v]) + ((item (2 v) of [Dates v]) + (item (3 v) of [Dates v])))

Congratulations! You created your own countdown!

Cookies help us deliver our services. By using our services, you agree to our use of cookies.