| Time changing script - Loops forever | |
|
|
Author | Message |
---|
Prodigy Administrator
Posts : 58 Join date : 2010-07-28
| Subject: Time changing script - Loops forever August 3rd 2010, 12:33 pm | |
| - Code:
-
speed = 2 --Sets the speed of the time changing. sec = 0 min = 0 hour = 0 while true do game.Lighting.TimeOfDay = ""..hour..":"..min..":"..sec.."" --The time of day is equal to the amount of hours, minutes, and seconds. sec = sec + (5*speed) --Add 5*Speed to the seconds value. Meaning, add 10 seconds to the time.
if sec >= 60 then --If the seconds value is equal to or more than 60 sec = 0 --make seconds equal to zero and min = min + 1 --Add a minute to the minute value end
if min >= 60 then --If the minutes value is equal to or more than 60 min = 0 --make the amount of minutes equal to zero and hour = hour + 1 --add one hour to the hour value end
if hour >= 24 then --if the hours value is equal to or more than 24 hour = 0 --make the ammount of hours equal to zero and restart the script end
wait(0.05) --Run the script every 5 mili-seconds end | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever August 3rd 2010, 10:21 pm | |
| You could make it slightly more effeicent.... - Code:
-
speed = 2 --Sets the speed of the time changing. local sec = 0 local min = 0 local hour = 0 while wait(.05) do game.Lighting.TimeOfDay = ""..hour..":"..min..":"..sec.."" --The time of day is equal to the amount of hours, minutes, and seconds. sec = sec + (5*speed) --Add 5*Speed to the seconds value. Meaning, add 10 seconds to the time.
if sec >= 60 then --If the seconds value is equal to or more than 60 sec = 0 --make seconds equal to zero and min = min + 1 --Add a minute to the minute value end
if min >= 60 then --If the minutes value is equal to or more than 60 min = 0 --make the amount of minutes equal to zero and hour = hour + 1 --add one hour to the hour value end
if hour >= 24 then --if the hours value is equal to or more than 24 hour = 0 --make the ammount of hours equal to zero and restart the script end end | |
|
| |
Prodigy Administrator
Posts : 58 Join date : 2010-07-28
| Subject: Re: Time changing script - Loops forever August 7th 2010, 3:32 pm | |
| It's the same exact thing... It doesn't make it more efficient or less efficient. | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever August 8th 2010, 1:02 am | |
| you would save more time and effort my way... | |
|
| |
Prodigy Administrator
Posts : 58 Join date : 2010-07-28
| Subject: Re: Time changing script - Loops forever August 8th 2010, 10:26 am | |
| - naknak wrote:
- you would save more time and effort my way...
Okay... but typing four extra letters isn't time consuming and doesn't take any effort. | |
|
| |
Guest Guest
| Subject: Re: Time changing script - Loops forever August 8th 2010, 8:12 pm | |
| You can not only shorten it, but make it MUCH neater and efficent. - Code:
-
--I remembered the block xD Speed = 2 while true do game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight() + Speed / 60) wait(0.05) end
|
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever August 9th 2010, 10:14 pm | |
| | |
|
| |
Guest Guest
| Subject: Re: Time changing script - Loops forever August 10th 2010, 3:15 pm | |
| I think I win also. I remembered the code for adding code xD |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: Time changing script - Loops forever January 18th 2011, 10:10 pm | |
| is this just a time changing thing for the lighting? if it is, who would want to use it? | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever January 18th 2011, 10:15 pm | |
| To make your map have day and night. | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: Time changing script - Loops forever January 18th 2011, 10:21 pm | |
| the point is that i do not want a day and night script | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Time changing script - Loops forever January 20th 2011, 6:53 pm | |
| the point is that others might want it. | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever January 20th 2011, 7:10 pm | |
| | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Time changing script - Loops forever January 24th 2011, 9:04 am | |
| | |
|
| |
slayer9365 Expert Scripter
Posts : 233 Join date : 2010-07-31 Age : 29
| Subject: Re: Time changing script - Loops forever January 24th 2011, 9:08 pm | |
| Actually voidhack still wins. | |
|
| |
naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Time changing script - Loops forever January 24th 2011, 10:08 pm | |
| - Code:
-
S = 2 while wait(.05) do game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+S/60) end hmm... | |
|
| |
Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: Time changing script - Loops forever January 24th 2011, 10:37 pm | |
| - Code:
-
while wait(0.05) do game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+%Speed%/60) end you don't need a variable, that saves time and, for this exception, space | |
|
| |
blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Time changing script - Loops forever January 26th 2011, 10:40 am | |
| lol, why would make a fuss over the smallest things? =P | |
|
| |
Sponsored content
| Subject: Re: Time changing script - Loops forever | |
| |
|
| |
| Time changing script - Loops forever | |
|