|
| 06 Jan 2017 06:52 PM |
Reworded thread because the previous one was filtered for some reason.
I am trying to write a module script that can be called with input. The input has six parameters. Each parameter is an integer. The integer gets concatenated into a string that can be set to the TimeOfDay value. A variable named timeBetween exists to be used in a "wait()"
I have an idea for the structure of the script but I'm not sure how I should do the loop. Here is the script:
local module = {} function transitionTime(A, B, C, D, E, F) -- These parameters are actually integers. print("Running"); --Example Input: (1,7,3,5,3,5) local startTime; local l = game.Lighting; startTime = l.TimeOfDay; -- Current TimeOfDay value is "14:00:00" --Start at: 14:00:00 local endTime; endTime = endTime .. A..B..":"..C..D..":"..E..F; --End at: 17:35:35 local timeBetween = 0.03; --[[ While loop to increment TimeOfDay until it is 17:35:35 --]] print("Finished running"); end return module
|
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:00 PM |
I'm realizing something that might be useful but I'm still not entirely sure what the loop should look like.
A must always be less than 3 B must always be less than 5 C must always be less than 6 D can be anything 0-9 E must always be less than 6 F can be anything 0-9 |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:21 PM |
| Should I create variables to represent each of the six integers in the starting position and use string manipulation to get the values and compare the start time to the end time that way? |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:24 PM |
| I wrote something exactly like this. You're hurting yourself though, use MinutesAfterMidnight and your life will be 9x easier. |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:24 PM |
| I might only need to increment F but I might still need to use a lot of conditions |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:26 PM |
"use MinutesAfterMidnight and your life will be 9x easier."
That probably will make it a lot easier. Will I still need a lot of conditions and string manipulation to check when it's complete? |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2017 07:32 PM |
No. If you're trying to "tween" the time of day (I suppose that's what you're doing) then do something like this:
function tweentime(start, end) local mins = game.Lighting:GetMinutesAfterMidnight() repeat mins = mins + 1 game.Lighting:SetMinutesAfterMidnight(mins) wait() until game.Lihting.TimeOfDay == end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jan 2017 07:43 PM |
| No problem. Good luck with whatever it is you're working on. |
|
|
| Report Abuse |
|
|