|Heheh. Just kidding.
So the problem was this: I was using the numbers from a foreach variable (thing as otherthing) outside the foreach. I imagine at one point that code was inside the foreach. Anyways, it was only grabbing the last cost, not the sum cost, so that was weird.
The only reason I found this was because I'd moved a function to a different script, and the script that was calling it sometimes included it and sometimes didn't, based on what was calling that script. So in trying to fix it I double-included a thing that declared functions and everything was on fire.
But it took me a while of debugging to even get that far.
After that I tried debugging some Linux audio crap and just got more and more frustrated. Aaaargh!|