You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.16.1 built from tag 1.16.1. Debian cmake clang++
Describe the bug
[store_time_of_day] throws a lua error when called from inside a time over event.
20211119 11:50:41 error scripting/lua: lua/wml/store_time_of_day.lua:17: bad argument #2 to 'get_time_of_day' (turn number out of range)
stack traceback:
[C]: in field 'get_time_of_day'
lua/wml/store_time_of_day.lua:17: in local 'cmd'
lua/wml-utils.lua:144: in field 'handle_event_commands'
lua/wml-flow.lua:5: in function <lua/wml-flow.lua:4>
To Reproduce
Add the following to a dummy scenario and click end turn twice.
turns = 2
[event]
name=time over
[store_time_of_day]
[/store_time_of_day]
[/event]
The text was updated successfully, but these errors were encountered:
Sounds like an off-by-one error somewhere. Either that, or the turn number actually advances to turn 3 during the time over event.
The second possibility could probably be tested by replacing the store_time_of_day tag with something that allows you to determine the current turn number, for example inspect or perhaps a message tag.
Sounds like an off-by-one error somewhere. Either that, or the turn number actually advances to turn 3 during the time over event.
turn_number does become 3 in time over. This happens in 1.14 as well, but [store_time_of_day] won't throw a lua error there. I'm not sure what time it stores in that case.
Hmm. The time of day API doesn't allow checking the time in a turn greater than the turn limit. We could allow one turn after, but… we could also just remove that limitation entirely? I don't think there's any actual reason to disallow extrapolating the schedule beyond the turn limit… especially since the turn limit can be changed.
stevecotton
changed the title
[store_time_of_day] throws a lua error
[store_time_of_day] throws a lua error in "time over" event, or querying a turn after the scenario's turn limit
Feb 13, 2023
Game and System Information
1.16.1 built from tag 1.16.1. Debian cmake clang++
Describe the bug
[store_time_of_day] throws a lua error when called from inside a time over event.
To Reproduce
Add the following to a dummy scenario and click end turn twice.
The text was updated successfully, but these errors were encountered: