Suspect there probably some issue with initialisation somewhere internally.
[This message has been edited by nottud (edited 12-11-2020 @ 05:28 AM).]
WarriorMario Mortal
posted 11 December 2020 05:42 AM
EDT (US)
2 / 7
Looks like I made an off by 1 mistake when calculating where the search should end. It stops when the current index >= searched string length - find string length which means it stops 1 index too early. Appending an extra character at the end fixes this problem for now.
We cannot rely on luck to be successful.
TwentyOneScore Mortal
posted 12 December 2020 03:58 AM
EDT (US)
3 / 7
Thanks for the reply! These string functions open up so much for coding in triggers and being able to create pseudo-arrays via lists:
string listAdd(string list="", string item="", string delim="|") string listGet(string list="", int at=1, string delim="|") int listLen(string list="", string delim="|") string listSet(string list="", int at=1, string value="", string delim="|")
The biggest limitation now is the 127 character limit on strings and going over crashing the game (at least on windows). Any chance that will ever increase?
I'm not sure how trivial it would be to increase the maximum size of the strings as that could break anywhere basically. A workaround would be using an aiplan to store data in.
Also what reproduces the crash? Just appending strings that are too long?
We cannot rely on luck to be successful.
nottud Demigod
posted 12 December 2020 07:51 AM
EDT (US)
5 / 7
The biggest limitation now is the 127 character limit on strings and going over crashing the game (at least on windows). Any chance that will ever increase?
Probably almost certainly my biggest frustration working with random maps - I really would like to see that increasing also. I lose a lot of time to crashes and unexpected behaviour due to this.
Also what reproduces the crash? Just appending strings that are too long?
Yea basically - I define trigger and effects using:
Not only does the map not load the game will outright crash to the desktop!
As a general aside - I am wondering if it be better if the game got array support which would resolve all this - @WarriorMario could you port over the xs array functionality in Age of Empires III? https://eso-community.net/viewtopic.php?p=436182
[This message has been edited by nottud (edited 12-12-2020 @ 08:14 AM).]
TwentyOneScore Mortal
posted 12 December 2020 08:23 AM
EDT (US)
6 / 7
>As a general aside - I am wondering if it be better if the game got array support which would resolve all this
Yes yes yes. This would make coding triggers and random maps much easier. Having to define functions to dynamically access unique variables is tiresome.
>A workaround would be using an aiplan to store data in.
i was poking around with this a bit but came up short on anything popping out as usable. From what i could tell aiPlanCreate() doesn't work in a trigger (returns -1).
Maybe because you need to switch the xs context to a player with an AI? If you not got one maybe assign "No AI" to a player you need to use it from. (You could do Mother nature)