Winterbay
Active member
I've found an interesting error in zlib -> batbrain -> wham -> autobasement (i.e. the last crashed while fighting a monster with WHAM which calls batbrain which calls zlib):
This is from evaluating "love song of vague ambiguity" as an attack option. I added some print outs to WHAM to see where it happened and the following snippet is what I narrowed it down to:
A run of the script shows:
So it happens somewhere in the enqueue-function before WHAM gets back control after enqueueing the skill.
Looking closer we see that enqueue() calls set_happened() which prints out the "Queued: skill 2022"-message followed by build_options(). Build_options calls build_items() which is where the crash occurs. Now, the problem is that after enqueueing skill 2022 the monster HP is -75.69 and as such the monster is dead so we won't need to update the options. Batbrain doesn't care about this and moves on anyway which with the new addition of not being able to take the root out of negative numbers makes the script crash.
I suggest adding a check for monster_stat("hp") being less than 0 in build_options() and either setting it to 0 before moving on, or just exit said function in that case.
Code:
[COLOR=red]Expression evaluation error: Can't take square root of a negative value (zlib.ash, line 162)[/COLOR]
This is from evaluating "love song of vague ambiguity" as an attack option. I added some print outs to WHAM to see where it happened and the following snippet is what I narrowed it down to:
Code:
print("Enqueueueing");
enqueue(killer);
print("Monster HP is now (after queueueue) " + monster_stat("hp"));
print("Enquueueueued");
A run of the script shows:
Code:
Enqueueueing
[COLOR=black]Queued: skill 2022[/COLOR]
[COLOR=black]Building options...[/COLOR]
[COLOR=red]Expression evaluation error: Can't take square root of a negative value (zlib.ash, line 162)[/COLOR]
So it happens somewhere in the enqueue-function before WHAM gets back control after enqueueing the skill.
Looking closer we see that enqueue() calls set_happened() which prints out the "Queued: skill 2022"-message followed by build_options(). Build_options calls build_items() which is where the crash occurs. Now, the problem is that after enqueueing skill 2022 the monster HP is -75.69 and as such the monster is dead so we won't need to update the options. Batbrain doesn't care about this and moves on anyway which with the new addition of not being able to take the root out of negative numbers makes the script crash.
I suggest adding a check for monster_stat("hp") being less than 0 in build_options() and either setting it to 0 before moving on, or just exit said function in that case.