generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Time of day transition that accepts input? (thread v2)

Previous Thread :: Next Thread 
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
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
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
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
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
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
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
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
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
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
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
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
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
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
BrendonTheWizard is online. BrendonTheWizard
Joined: 28 Jul 2010
Total Posts: 25709
06 Jan 2017 07:39 PM
That worked, thank you!
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
06 Jan 2017 07:43 PM
No problem. Good luck with whatever it is you're working on.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image