View Full Version : How can I adapt a worldpopulation script to be a cigarettessmoked script
dovidshmuel 03222009, 06:06 PM There is a script offered at http://www.javascriptkit.com/script/cutindex10.shtml that shows the count of the present world population. Can someone tell me how to adapt that script so that it will show the number of cigarettes smoked so far this year. The total number of cigarettes smoked in 2007 was 5.608 trillion and we can use the same number for this year. Does anyone know how to do that. It will be very helpful for an antismoking page on my website. Thanks.
oesxyl 03222009, 06:44 PM There is a script offered at http://www.javascriptkit.com/script/cutindex10.shtml that shows the count of the present world population. Can someone tell me how to adapt that script so that it will show the number of cigarettes smoked so far this year. The total number of cigarettes smoked in 2007 was 5.608 trillion and we can use the same number for this year. Does anyone know how to do that. It will be very helpful for an antismoking page on my website. Thanks.
you talk about this script?
http://www.javascriptkit.com/script/script2/worldpop.shtml
best regards
dovidshmuel 03222009, 06:48 PM Yes. Sorry, my mistake.
oesxyl 03222009, 06:51 PM Yes. Sorry, my mistake.
no problem, it's happend.
What method do you have in mind to compute the numbers?
best regards
dovidshmuel 03222009, 07:01 PM It seems to me that there are 3.1536 billion hundredthsofasecond in one year. There are 5.608 trillion cigarettes smoked in one year. Therefore, for every 1/100th of a second, there are 1778 cigarettes being smoked. Maybe you could check my calculations. So the numbers should spin and calculate to add 1778 every hundredth of a second. Agree?
oesxyl 03222009, 07:25 PM It seems to me that there are 3.1536 billion hundredthsofasecond in one year. There are 5.608 trillion cigarettes smoked in one year. Therefore, for every 1/100th of a second, there are 1778 cigarettes being smoked. Maybe you could check my calculations. So the numbers should spin and calculate to add 1778 every hundredth of a second. Agree?
 you ar from us or uk? if I'm not wrong trillion and billion have different meaning in us and uk.
 what is the source for that, how accurate it is?
 simple division is not too simple?
btw, I don't understand why I try to help you, it's against my interest, I'm smoker, I like it and I pay a lot of taxes and support a lot of "helping" **** for that.
best regards
dovidshmuel 03222009, 07:38 PM I am from the US. The count is: hundreds, thousands, millions, billions, trillions. I got the number from WikiAnswers from a Google search. There is a website: http://www.worldometers.info, which lists, among many other things, the number of cigarettes smoked today. It now shows over 12,000,000,000. That is probably a better way to show the figures anyway. But the figures are the same, each 1/100th second, starting at 12:00 midnight, add 1778.
You can think that you are helping me for any people who might wish they could stop smoking and just need one extra little helpful push to get them over the hurdle.
Thanks for answering and for your help.
oesxyl 03222009, 08:40 PM I am from the US. The count is: hundreds, thousands, millions, billions, trillions. I got the number from WikiAnswers from a Google search. There is a website: http://www.worldometers.info, which lists, among many other things, the number of cigarettes smoked today. It now shows over 12,000,000,000. That is probably a better way to show the figures anyway. But the figures are the same, each 1/100th second, starting at 12:00 midnight, add 1778.
well, I don't trust them, but this is only my opinion, too many people mess with statistics only to increase trafic. I belive in designer responsability for information accuracy and visitors capability to decide what's good for them.
one way is to use setInterval to increase value of a variable. That means to add 1778 each second to the variable and show it in the page.
you can do changes in script to achive that? If not I will try to do it for you.
You can think that you are helping me for any people who might wish they could stop smoking and just need one extra little helpful push to get them over the hurdle.
Thanks for answering and for your help.
yes, this is a reason, I agree, :) Unfortunately is more politics in antismoking then real problem like that. Anyway was just a remark, I don't want to transform your thread, a technical issue, into a pros/cons smoking/antismoking so I'm off this debate and I will stay with technical stuff as far I could help.
best regards
dovidshmuel 03222009, 08:49 PM I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.
Thanks for your help.
oesxyl 03222009, 08:57 PM I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.
Thanks for your help.
I could try, but is not relevant in my opinion. We can see info if is refreshed often then 40 ms, 25 times per second. So 1/10th is probably ok, often is useless and annoying in my opinion.
best regards
dovidshmuel 03222009, 09:03 PM The more often the numbers change, the better, so if you can make it change 25 times per second, that would be great. Therefore, add 7112 every 25th of a second. I would be very appreciative.
TinyScript 03222009, 09:10 PM I don't know how to do any of that, so I would appreciate it if you could do it for me. But instead of changing the numbers every second, could you change them every 1/100th of a second (by adding 1778 every next 1/100th of a second), or, it not, every 1/50th of a second (by adding 3557 every 1/50th of a second), and if not even that, then change the numbers at least every 1/10th of a second (by adding 17,780 every 1/10th of a second). If you look at the link to Worldometers you can see how dramatic it is that they have their numbers changing constantly and very rapidly.
Thanks for your help.
sounds like you know what you need to do, just not how. It's pretty simple.
I didn't look at the script, but you should be able to add a variable and add 1778 to it every iteration and display it in an element.
var num=1778;
in the loop you will add
num+=1778;
where ever it's doing the readout, you have to give it num
dovidshmuel 03222009, 09:17 PM i don't understand any of the script language so for me it's not easy to do at all. Could you look at the script, change the variable and post the script back to me (but not 1778 as you put in your last answer because that is the number for every second changing and the numbers need to change more rapidly than that, as I listed in my last answer).
TinyScript 03222009, 09:34 PM here it's done
http://h1.ripway.com/tinyscript/worldCalculator.html
dovidshmuel 03222009, 09:44 PM Thank you, TinyScript. Just three additional requests: first, how can I enter that (with different captions) on my website; second, can you get the numbers to change faster, so that it looks like they are constantly changing, rather than now that you can see them jumping to each new number; and three, I need it to start automatically at zero at 0:00 on January 1 of each year and the present number should reflect the number since 1/1/09.
dovidshmuel 03222009, 09:47 PM Oh, one more thing. Can you separate every three numbers with a comma so that the number is easier to recognize. Thanks very, very much.

