Skell edit: this is a duplicate of this bug http://forum.caravelgames.com/viewtopic.php?TopicID=39045
I get a repoducable runtime error (the application has requested the Runtime to terminate it in an unusual way) which I believe is caused by too many existing entities at once. I'm using v4.0.2.112.
So, what I've been trying to do is basically the following:
I've been trying to "
fake"
functions by creating a character that takes parameters stored in hold variables and returns a result by storing it in another variable. Whenever I want another character to call that function, I set up the variables and use GenerateEntity to instantly evoke its script. I tried to kill the function executer by either calling "
Imperative Die"
or "
End"
after the result is stored (note that my character is invisible at the beginning, so I'm not sure if Imperative Die works anyway?).
So far, this is the only way I've found to fake functions within only one move, and at first I thought that was working very well. However, when playing the room for a longer time, first I've noticed the game was lagging on some turns, and after about 100 turns (with about 10 function calls per turn, admittedly), the game crahes, with the number of turns it takes seeming to be related to the number of function calls and thus to the number of "
Generate Entity"
's.
So...
Bug Report: First, though it's kind of obvious the game can't handle an infinite amount of characters, it shouldn't crash. Second, I'm confused about the number of entities anyway, as I feel an NPC who dies or whose script is ended while invisible should be removed from the game engine's list of entities. Is this behaviour intended or could that be changed?
Scripting Question: Well, two of them actually:
1. Is there maybe a way to completely get rid of an NPC? The two I could think of obviously didn't work.
2. If not, is there any other possibility to fake an instant subroutine?
Which leads to the feature request: Though I'm quite amazed what can be done with the scripting system, actual functions (with parameters and return and everything) would be really nice (I think this was already suggested several times), though I can imagine it to be hard to implement. To go over the top, an OOP approach would be even nicer
(I'd already be happy with NPCs being able to store private variables)
I've attached an example hold that crashes on turn 120 on my pc I think.
Sorry for the long post, I hope it helps in any way,
Lukas
[Last edited by skell at 10-15-2020 01:08 PM]