I went ahead and put the same command on either side of an if/else just to make sure I wasn’t messing up the return value. These results are interesting though; I suppose that means I just made an unrelated mistake somewhere. Incompetence is completely plausible in this case.
Edit: Wait though, now my script works, but all I did was expand the if statement into name_of_function, return_variable=$?, and if ! [[ return_variable ]]; then. I didn’t screw anything else up. So the mystery remains.
I’ve never used pastebin or similar services, but if you feel like wading through my mess of a coding playground, the offending code is when findclosestbox calls either collisiondetection or findbetterport, and the debug “echo” I’m interested in is the one after “This is the end of the findclosestbox function:”
https://zerobin.net/?9fa46f9871bb3607#tnEmm2JQZ3ggy2+fLp2oJwGf5r5uRcs0xj8zIvyurYQ=
password: lemmydebug