I think my 3DS is cursed.
I was happily coding my event engine, and it worked! Then I tried events that trigger when you walk over them. Suddenly, I was given an error that made no sense. It was from the function that gets called every frame that a player exists on. The function is attached to a sprite via the SPFUNC command, so there was no way of it getting wrong parameters.
Out of range in 0:263(SPOFS:1)
I checked what was wrong with that line of code.
SPOFS CALLIDX,X%-7,Y%-7I checked to see if the coordinate variables contained weird values. Nothing. I checked if I had any random new players being generated. Nothing. Finally, I checked the CALLIDX. ?CALLIDX 496 496. The flipping ID was outside my limit I set. Here, right at the beginning of my code, is this line:
XSCREEN 3,496,3(This means only use sprites 0 to 495.) It's impossible to attach a function to a sprite that doesn't exist. What the heck. EDIT: Somehow, I fixed it right after posting this. It seems that when using sprite functions, going inside a function causes CALLIDX to be reset in a weird way, which makes it 496. To solve this bug, I simply saved CALLIDX to a variable in the beginning of the player function and it worked.