[Logged] Is ScenEdit_CurrentTime meant to work outside events?

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

[Logged] Is ScenEdit_CurrentTime meant to work outside events?

Post by KnightHawk75 »

So in the attached testing .scen file I have:
1 - An event that fires every 5 seconds printing the current time in seconds to the user and the logs.
2 - A special action that prints the current time in seconds to the user and the logs.

1 - Works as expecting printing the current current time in seconds and updates.
2 - Does not print the current time but the time set at some point in the editor in the past and does not update.

If one manually changes the current time via the editor the process will repeat where 2 will always show whatever you change the time to and never update. I tried adding Tool_EmulateNoConsole(true) setting in the SA, but it made no difference. How is it even saving that old # between saves,and restarts of the game itself btw?

What am I doing wrong? If nothing, is this by design|design limitation for some reason?

As a workaround I have global var get updated with the correct time every second to reference from outside events but it would be nice to not have to have that overhead.
Attachments
TimeFubar5.zip
(18.04 KiB) Downloaded 8 times
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Is ScenEdit_CurrentTime meant to work outside events?

Post by michaelm75au »

It should always return the current scenario time regardless in event or not.
I'll have a look as soon as I can.
Michael
User avatar
michaelm75au
Posts: 12464
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Is ScenEdit_CurrentTime meant to work outside events?

Post by michaelm75au »

Very strange. It runs the exact same code, but get a different result when run thru Special Action. Which is handled differently to background and console Lua.
I'll have deep look when I have the time.


Logged 0013835
Michael
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Is ScenEdit_CurrentTime meant to work outside events?

Post by KnightHawk75 »

Thank you sir!
Post Reply

Return to “Lua Legion”