Luxiel
|
  |
| Joined: 16 Jan 2013 |
| Total Posts: 139 |
|
|
| 31 Jul 2013 10:52 AM |
local D = game.Lighting.TimeOfDay
if D == "18:00:00" then game.Lighting.Brightness = 0.5 end
if D == "19:00:00" then game.Lighting.Brightness = 0 end
if D == "06:00:00" then game.Lighting.Brightness = 0.5 end
if D == "07:00:00" then game.Lighting.Brightness = 1 end
|
|
|
| Report Abuse |
|
|
|
| 31 Jul 2013 03:19 PM |
| The fact that TimeOfDay is not a variable in the "lighting" part of the script. |
|
|
| Report Abuse |
|
|
Luxiel
|
  |
| Joined: 16 Jan 2013 |
| Total Posts: 139 |
|
|
| 31 Jul 2013 07:50 PM |
| Not a variable? What do you mean? It's a valid property inside the "Lighting" service, so I don't see what the problem is. |
|
|
| Report Abuse |
|
|
shawnyg
|
  |
| Joined: 21 Apr 2011 |
| Total Posts: 1428 |
|
|
| 31 Jul 2013 07:52 PM |
| Add .Value for D and the last line you have. |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Jul 2013 07:53 PM |
| Also I'm not sure if this will help but you might need to start the last 3 if statements with elseif |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 09:58 AM |
local D = game.Lighting.TimeOfDay
if D == "18:00:00" then
game.Lighting.Brightness = 0.5
elseif D == "19:00:00" then
game.Lighting.Brightness = 0
elseif D == "06:00:00" then
game.Lighting.Brightness = 0.5
elseif D == "07:00:00" then
game.Lighting.Brightness = 1
end |
|
|
| Report Abuse |
|
|
Luxiel
|
  |
| Joined: 16 Jan 2013 |
| Total Posts: 139 |
|
|
| 01 Aug 2013 10:02 AM |
| Substituting "if" with "elseif" rarely ever has an effect on code. I can tell you that that does nothing. |
|
|
| Report Abuse |
|
|
ricorick
|
  |
| Joined: 28 May 2010 |
| Total Posts: 42 |
|
|
| 01 Aug 2013 10:07 AM |
| I think you need a value for D but im not so sure... |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:17 AM |
@rickorick
local D = game.Lighting.TimeOfDay
That's the value for D. |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:19 AM |
| And Lux what do you mean by 'isn't working' what IS and ISN'T happening? I've never dabbled in lighting but I'll give it a go, for me in solo mode the time does not change, it doesn't progress. Is it changing for you? |
|
|
| Report Abuse |
|
|
ricorick
|
  |
| Joined: 28 May 2010 |
| Total Posts: 42 |
|
| |
|
Luxiel
|
  |
| Joined: 16 Jan 2013 |
| Total Posts: 139 |
|
|
| 01 Aug 2013 10:24 AM |
| For it to change, you must use a script. The script adds to the time and emulates progression. What isn't happening is that when it reaches the designated time, it doesn't change the brightness. |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:25 AM |
| Hm. Also you probably want to optimize it later on to change gradually xD I'll look again and post another (most likely useless) solution! |
|
|
| Report Abuse |
|
|
Luxiel
|
  |
| Joined: 16 Jan 2013 |
| Total Posts: 139 |
|
|
| 01 Aug 2013 10:27 AM |
| Yeah, I know. This is just a test script, not the real final product. I wanted to see if I could make this work...if I can't, I'll just keep the brightness at an automatic 0. |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:30 AM |
time = 1 day_night_ratio = 5 night_start = 6
minute = 0 while true do minute = minute+time game.Lighting.TimeOfDay = night_start..":"..minute..":00" if minute > 1440 then minute = 0 end if minute > 720 then minute = minute+day_night_ratio*time-time end wait() wait() wait() end |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 01 Aug 2013 10:32 AM |
Extremely inefficient and I feel bad giving you this but, hey it'll work.
local D = game.Lighting.TimeOfDay while wait(.5) do if D == "18:00:00" then game.Lighting.Brightness = 0.5 end
if D == "19:00:00" then game.Lighting.Brightness = 0 end
if D == "06:00:00" then game.Lighting.Brightness = 0.5 end
if D == "07:00:00" then game.Lighting.Brightness = 1 end end |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:37 AM |
Put this in one script:
local D = game.Lighting.TimeOfDay
if D == "18:00:00" then game.Lighting.Brightness = 0.5 end
if D == "19:00:00" then game.Lighting.Brightness = 0 end
if D == "06:00:00" then game.Lighting.Brightness = 0.5 end
if D == "07:00:00" then game.Lighting.Brightness = 1 end
put this in another script:
time = 1 --rate of time progression; lower is slower day_night_ratio = 5 --minutes per day = 1 minute per night night_start = 6 --hour when night/day start
minute = 0 while true do minute = minute+time game.Lighting.TimeOfDay = night_start..":"..minute..":00" if minute > 1440 then minute = 0 end if minute > 720 then minute = minute+day_night_ratio*time-time end wait() wait() wait() end |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 01 Aug 2013 10:42 AM |
Or just this..
times = {} times["18:00:00"] = 0.5 times["19:00:00"] = 0 times["06:00:00"] = 0.5 times["07:00:00"] = 1 while wait() do game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight()+1) if times[game.Lighting.TimeOfDay] then game.Lighting.Brightness = times[game.Lighting.TimeOfDay] end end |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 10:44 AM |
Oh my goodness, oh my goodness...
local D = game.Lighting.TimeOfDay D.Changed:connect(function() if D == "18:00:00" or D == "06:00:00" then game.Lighting.Brightness = 0.5 elseif D == "19:00:00" then game.Lighting.Brightness = 0 elseif D == "07:00:00" then game.Lighting.Brightness = 1 end end)
--That SHOULD work.
*Tell me about the rabbits, George* |
|
|
| Report Abuse |
|
|
9HB
|
  |
| Joined: 11 Dec 2012 |
| Total Posts: 2461 |
|
|
| 01 Aug 2013 10:47 AM |
| I'm using Luxiels time changer and light changer script and they both work. |
|
|
| Report Abuse |
|
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 01 Aug 2013 10:48 AM |
hot potato
local RealSecondToGameMinute = ( 1/2 ) local DayMinutes = 0
while true do wait( RealSecondToGameMinute ) DayMinutes = math.fmod( DayMinutes + 1, 1440 ) local Hour = math.floor( DayMinutes / 60 ) game.Lighting:SetMinutesAfterMidnight( DayMinutes ) if Hour == 7 then game.Lighting.Brightness = 1 elseif Hour == 18 or Hour == 6 then game.Lighting.Brightness = 0.5 elseif Hour == 19 then game.Lighting.Brightness = 0 end end
|
|
|
| Report Abuse |
|
|