Okay, so I am working on a Plural script and have somehow managed to break whatever Danmakufu does to end the script. After defeating the boss, they disappear as normal, health bar goes away, etc, but the EndScript script is never called so you don't get the option to save replays and so on.
I've narrowed it down to this standard block of code not clearing:
task TPlural {
let obj = ObjEnemyBossScene_Create();
//Singles added to boss scene here...
ObjEnemyBossScene_LoadInThread(obj);
ObjEnemyBossScene_Regist(obj);
while(!Obj_IsDeleted(obj)){
yield;
}
//Execution never reaches this point
CloseScript(GetOwnScriptID());
}
TPlural is present in the Plural script, and is called by @Initialize as normal
From what I can tell from the logs, the while statement runs basically once per boss phase and the idea is that after the last boss phase the plural notices that the boss scene has been deleted due to lacking any further single scripts and closes itself. This then ends the whole script if you're running the Plural in isolation. However, by putting a WriteLog in the while statement I've found that it doesn't seem to be executing after the last boss phase at all! As a result, the last time Obj_IsDeleted(obj) is checked it returns false, it's never checked after it becomes true (if indeed it IS becoming true...), CloseScript(GetOwnScriptID()) never executes, and the script fails to terminate. Instead, the player just flies around on an empty screen endlessly and pointlessly.
My current hypothesis is that something I did somewhere else is somehow not "returning" execution to the Plural and is just spinning forever, but I have no idea how Danmakufu normally handles this stuff and thus no idea what change might have busted it, and it seems weird that the Plural would be successfully checking after every script BUT the last one (something I verified with writeLog). To compound the problem, I only discovered the issue after a LOT of changes to the script since I was not playing it all the way through while editing it! Additionally, the problem isn't specific to any one single as I have tried using several different singles by themselves and the script still fails to end after the single is defeated.
I don't expect anyone to be able to solve the problem based on this admittedly terrible diagnostic information, so all I really want is to know what determines when the while statement in the standard TPlural task is checked (i.e. when the TPlural task gets to execute a frame, as it is clearly not just "on every frame") and maybe some theories on what could cause it to not execute after the EnemyBossScene has been deleted. I think with that I can probably go figure out which change is causing the check to not occur. The script has some custom events and visual effects, but otherwise nothing too fancy I didn't think.
EDIT: Okay, so I compared to an old test script and found that the TPlural task SHOULD be running every frame, but for some reason isn't. This is likely the cause of the issue, as it's simply not running on any frame where the script is over. However, I have no idea what could have caused this.
EDIT: Alright, I've commented out so much of the script that it literally just displays a black screen and all you can do is shoot or bomb the boss (which is at 0, 0 with no animation) to kill it. This STILL fails to end the script, and WriteLog shows that tasks in the Plural are still stopping executing. I think that means it has to be a problem with the player script.
EDIT: ...
...
...
I deleted the @MainLoop in my plural
I have no idea when or how this happened
Somehow the only symptom this led to was the script not ending properly
I remember thinking it was weird that stuff I was putting in the Plural wasn't happening every frame a while back, so it must have been before then
I will leave this post up as a monument to my idiocy
(seriously I even misread the logging and didn't understand what it was doing, and basically stumbled upon the problem by sheer luck)