- 0
Absolute Newbie Need Help - Real Time Sunrise/Sunset mod assistance - ChatGPT generated content and guide script included
-
Similar Content
-
- 0 replies
- 11 views
-
- 5 answers
- 110 views
-
- 1 reply
- 181 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
Question
RossDoesntCare
Hi all, newbie here.
I have been looking for a mod that adjusts the ingame sunrise, sunset and daytime hours based upon real life information for the Boston area. I have collated all of the realworld information and have been planning out what a script would need to do, however, I have very little to no scripting experince and even less in creation kit.
I have roped in ChatGPT for assistance and had it create a python script that would update my enbseries.ini file with the information based upon a csv file containing the relevant information that would update the ini based upon my system date. This was purely for testing as I wanted to know how well ChatGPT scripts work - after some tweaks and stuff, it turns out it works really well.
So I was wondering, is there a way to set the sunrise, sunset and daytime (I think those are the section in the TIMEOFDAY section of the enbseries.ini) using the infromation if i include an array containing the data into the script using this command:
Get the current in-game time
Float currentGameTime = Utility.GetCurrentGameTime()
I had ChatGPT write a script based upon some prompts I gave it and it recognised it was papyrus and using commands from CK.
This is the guide script it wrote:
ScriptName RealTimeSunriseSunset extends ObjectReference
Event OnInit()
RegisterForSingleUpdate(0.0)
EndEvent
Event OnUpdate()
UnregisterForSingleUpdate()
; Define the array of sunrise, sunset, and daytime data
Const Array[] ReferenceData[] = [
; Get the current in-game time
Float currentGameTime = Utility.GetCurrentGameTime()
; Convert the current in-game time to a formatted string
String currentTimeString = Utility.GameTimeToString(currentGameTime)
; Extract the date from the formatted time string
String currentDate = currentTimeString.Split(" ")[0]
; Search for a matching date in the reference data array
Bool foundMatch = false
Int index = 0
While index < Array.Length(ReferenceData)
String date = ReferenceData[index][0]
If date == currentDate
foundMatch = true
Break
EndIf
index += 1
EndWhile
; If a matching date is found, set the sunrise, sunset, and daytime
If foundMatch
String sunriseTime = ReferenceData[index][1]
String sunsetTime = ReferenceData[index][2]
String dayTime = ReferenceData[index][3]
; Set the sunrise time
Game.SetSunriseTime(sunriseTime)
; Set the sunset time
Game.SetSunsetTime(sunsetTime)
; Set the daytime
Game.SetDaytime(dayTime)
Debug.Notification("RealTimeSunriseSunset set successfully! Sun will rise at " + sunriseTime + " and set at " + sunsetTime)
Else
Debug.Notification("RealTimeSunriseSunset could not be set")
EndIf
EndEvent
I've excluded the array data since its just [date, sunrisetime, sunsettime, daytime] data.
Apologies if this is nonsensical, or if I have included too much information and text. I hope there's a simpler way to do this, but I was hoping a holotape could be created as part of the mod, you enable it, it then runs at 00:00 in game daily and sets the aforementioned sunrise/set/daylight times and also displays the message whether successful or unsuccessful. It's something I have wanted in game for a long time since NACX seems to do a good job of seasonal weather.
Huge thanks for reading and even more thanks if anyone can help out!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now