View previous topic :: View next topic |
Author |
Message |
zxuiji Advanced Cheater Reputation: 1
Joined: 26 Sep 2016 Posts: 70
|
Posted: Mon Feb 05, 2018 12:18 pm Post subject: Trouble with changing time |
|
|
Time based script is from lines 600 to 768, I've tried for several days now to fix the problem myself but still can't so I can only assume that something is being understood wrongly. The script translates from the original number just fine but translating back to said number is proving to be an issue I cannot solve. I have been starting with just setting the whole value to 0 then setting day to 8 (which doesn't get set correctly), the symbols to look at the values of are pTimeFromDay0 (and it's children representing Day, Hour, Minute). Incidentally you only have to boot the game to retrieve the addresses, you can load or start a new game after doing so if you prefer.
https://drive.google.com/file/d/1ZQ0EKpwNLBqRsSSakchVs_Iv76poBdwc/view?usp=sharing _________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel. |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Mon Feb 05, 2018 12:26 pm Post subject: |
|
|
If the time is just stored as seconds then this is what I use.
Code: | {$lua}
if syntaxcheck then return end
------------------------------ ENABLE ------------------------------
[ENABLE]
MGSV_TIME_MR = nil
local text = 'MGSV - Time of Day'
local address = '[ptrTimeHook]+4C'
local dropDownList = ''
.. '00000:00:00:00\r\n'
.. '10800:03:00:00\r\n'
.. '21600:06:00:00\r\n'
.. '32400:09:00:00\r\n'
.. '43200:12:00:00\r\n'
.. '54000:15:00:00\r\n'
.. '64800:18:00:00\r\n'
.. '75600:21:00:00\r\n'
local function setupMR()
if memrec ~= nil then
MGSV_TIME_MR = AddressList.getMemoryRecordByDescription(text)
if MGSV_TIME_MR == nil then
MGSV_TIME_MR = AddressList.createMemoryRecord()
end
MGSV_TIME_MR.Description = text
MGSV_TIME_MR.Type = vtDword
MGSV_TIME_MR.DontSave = true
MGSV_TIME_MR.Address = address
MGSV_TIME_MR.OnGetDisplayValue = function(memoryrecord, valuestring)
if type(valuestring) == 'string' and tonumber(valuestring) ~= nil then
local secs = tonumber(valuestring)
local h = math.floor(secs / (60 * 60))
local m = math.floor(secs / 60 % 60)
local s = math.floor(secs % 60)
return true, string.format("%.2d:%.2d:%.2d", h, m, s)
else
return false, valuestring
end
end
MGSV_TIME_MR.DropDownList.Text = dropDownList
MGSV_TIME_MR.DisplayAsDropDownListItem = true
MGSV_TIME_MR.DropDownDescriptionOnly = true
MGSV_TIME_MR.appendToEntry(memrec)
end
end
if syntaxcheck then return end
setupMR()
------------------------------ DISABLE ------------------------------
[DISABLE]
if syntaxcheck then return end
if MGSV_TIME_MR ~= nil then
MGSV_TIME_MR.delete()
end |
_________________
|
|
Back to top |
|
|
zxuiji Advanced Cheater Reputation: 1
Joined: 26 Sep 2016 Posts: 70
|
Posted: Mon Feb 05, 2018 12:55 pm Post subject: Re: Trouble with changing time |
|
|
Thanks for trying but that's not the issue as I mentioned here:
zxuiji wrote: | ...The script translates from the original number just fine but translating back... |
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel. |
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Mon Feb 05, 2018 2:41 pm Post subject: |
|
|
Just use Lua time class and REGEX, but you will have to modify to match your format.
Code: | local pattern = "(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)"
local timeToConvert = "2011-01-01 01:30:33"
local runyear, runmonth, runday, runhour, runminute, runseconds = timeToConvert:match(pattern)
local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday, hour = runhour, min = runminute, sec = runseconds}) |
_________________
|
|
Back to top |
|
|
zxuiji Advanced Cheater Reputation: 1
Joined: 26 Sep 2016 Posts: 70
|
Posted: Mon Feb 05, 2018 4:48 pm Post subject: |
|
|
Given that this is a game value I don't think that would work, on the bright side I finally managed to fix it, turned out the reason the values were displaying correctly was because they were being floored behind the scenes and I never noticed it, I just finished editing my GetHour() function to floor the individual values and everything went swimmingly after that. My next goal is finding the base data for all my gear and creating a function that will set it all to whatever nice value I like :D, on the other hand 4 weeks from now I start again with FFXV for windows, no pre-made table to help me start that one (BTW I have actually completed that game around 6 times on the PS4). _________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel. |
|
Back to top |
|
|
|