Hello everyone,
I had completed my first scripted object and all was working well when lo and behold I received a Heap error message. In hindsight it is obvious that the length of my single script plus all the data being added will easily overflow my 16kb allocation.
Based on other postings it appears that I can resolve this by partitioning my code into multiple scripts but I am hoping the community can help confirm my assumptions before I begin to refactor my code.
1. Does each script have it's own 16kb allocation?
1a Does this remain true for multiple scripts on a single object?
2. If I have a separate script that handles my linked message calls and within my processing from the main script I set data (via globals in the linked script) will that data be retained for subsequent LM calls. My thinking is that the script comes alive due to its listener when the object is created and that it will be persistent throughout the life of the object.
3. At a high level I am creating a game and in my main script is my state handler, game rules engine and interface. This script will be fairly constant in size (script plus set of constants and data that does not significantly grow).
As players interact with the game I am thinking of passing these activities off to a separate script via a linked message. This can generate a fair amount of dynamic data that I'm hoping will grow in a separate script that has most of it's 16kb available to data. However, I will need this data to be retained until the game engine determines it is time to process the results. At that time I will reset the player data via a linked messgae into the player data script that resets the global variables.
Does this approach to partitioning make sense? will it work? Also, does the new patch make it more likely that latency may bite me in the *ss. Since Im recording players activities via asynchronous calls how likely is it that a players activity will not have been registered in time once the engine tries to process the result? How long should I wait for those threads to complete?
Sorry for the big post, I'm hoping that the detail makes my scenario more understandable.
Thanks for any advice you may have, as a new scripter I have found this forum extremely valuable.
- JP
I think it'll work. The new patch will likely have zero impact on your scripts, but depending on what events you are using to monitor player activity, it may miss something 