Xs scripting: `main` called on saved game load and save chapter

:play_button: GAME INFORMATION

:backhand_index_pointing_down: These details are CRITICAL; DO NOT skip them or your issue may not be reviewed.

  • GAME BUILD #: 101.103.48987.0 (#180059) 24094652, and (1.1.2RC1) on mac
  • GAME PLATFORM: Steam
  • OPERATING SYSTEM: Windows 10 and Mac (same behavior)

:play_button: ISSUE EXPERIENCED

:backhand_index_pointing_down: DESCRIBE THE ISSUE IN DETAIL (below). LIMIT TO ONE BUG PER THREAD.

The xs function main gets called when a saved game is loaded, or when the “save chapter” button is pressed.

There is already an old unresolved post on save chapter: https://forums.ageofempires.com/t/save-chapter-glitch/. But there may be multiple separate issues. Save chapter/game load also resets xs variables, but only when the xs code is inside triggers and not as a separate xs file. But main gets called in both cases.

:play_button: FREQUENCY OF ISSUE

:backhand_index_pointing_down: How often does the issue occur? CHOSE ONE; DELETE THE REST !

  • 100% of the time / matches I play (ALWAYS)

:play_button: REPRODUCTION STEPS

:backhand_index_pointing_down: List CLEAR and DETAILED STEPS we can take to reproduce the issue ourselves… Be descriptiv e!

Here’s the steps to reproduce the issue:

  1. Test the attached scenario.

    • maingets called.
  2. Press “save chapter” or save and load the game.

    • maingets called again. There is a counter but it starts again from 1, because the code is inside a trigger and xs variables reset (as discussed in that other thread).
  3. Move the xs code from the trigger into a separate xs file, include it and test again.

    • maingets called.
  4. Press “save chapter” or save and load the game.

    • main gets called again. The counter now does not reset. This is in the screenshot.

:play_button: EXPECTED RESULT

:backhand_index_pointing_down: What was SUPPOSED to happen if the bug you encountered were not prese nt?

mainshould only be called once, when the game starts.

:play_button: IMAGE

:backhand_index_pointing_down: ALWAYS attach a PICTURE (.jpg, .png, .gif) or VIDEO (.mp4, YouTube link) that highlights the prob lem.

:play_button: GAME FILES (SAVE / RECORDING)

:backhand_index_pointing_down: Attach a SAVE GAME (.aoe2spgame) or GAME RECORDING (.aoe2record) of the match where you encountered the issue. Link it below if using an external file ser vice.