When changing states during an on_damage event while changing a prim property in state_exit, the script stops handling all future on_damage events until it is recompiled.
Resetting the script doesn't get it back working, neither does re-rezzing it.
The key seems to be the llSetRot() call in state_exit. Removing it will not bug the script. Happens as well with other functions that change a prim property, like llSetPos. Although it could also be the general state change during the on_damage event that triggers it, hard to pin down.
Tested on Second Life RC BlueSteel 2024-07-22.10048683488
Repro: Rez a prim and put the script below in it. Then repeatedly apply any llDamage to it.
Expected output:
> default
> ouch
> state_exit
> crashed
> default
> ouch
> ...etc until damage stops
Observed:
> default
> ouch
> state_exit
> crashed
> default
[no further output is generated]
Test script:
default {
state_entry() {
llOwnerSay("default");
}
on_damage(integer n) {
while (n--) {
llOwnerSay("ouch");
state crashed;
}
}
state_exit() {
llSetRot(ZERO_ROTATION); // The suspect?
llOwnerSay("state_exit");
}
}
state crashed {
state_entry() {
llOwnerSay("crashed");
llResetScript();
}
}