Interesting question about repeated code usage

Blitz3D Forums/Blitz3D Programming/Interesting question about repeated code usage

Cubed Inc.(Posted 2013) [#1]
I've recently run into a nasty bind with my game where a certain repeated line of code that's worked many, many times before suddenly no longer working when re-used, anymore. It's a code put into every type character that deletes their type once the "main" character, or themselves, are no longer existent. After much hair-ripping headache, I managed to fix the issue by very slightly changing the codes content, and now it works fine.

What the hell? That's what I said at first. So what do you guys think is up with this? Some sort of glitch with Blitz3d, or maybe a common limitation I was never aware of?


Stevie G(Posted 2013) [#2]
Your code was likely flawed in the first place. You'd need to post the offending code and your fix for anyone to have the first clue.


RemiD(Posted 2013) [#3]

What the hell? That's what I said at first. So what do you guys think is up with this? Some sort of glitch with Blitz3d, or maybe a common limitation I was never aware of?


or the most likely possibility : you have made an error in the code and sometimes when you rewrite it, you don't make the same error.
Sometimes an error is difficult to spot in Blitz3d because if a variable name has not been written properly, it will automatically be considered as a new variable with a value of 0.
DebugLog("Variable = "+Str(Variable))
FlushKeys()
WaitKey()
can help you to find the error.


Cubed Inc.(Posted 2013) [#4]
Yeah, I think you guys are right. I looked back and found numerous flaws in my code that I could've sworn weren't there upon the first 100 or so checks. I must be getting code delusional or something. Working on your first big, serious project can really take a toll on your common sense, I swear...


xlsior(Posted 2013) [#5]
Sometimes taking a break and re-examining your code the next day will bring up obvious mistakes that you don't spot when you keep staring at it for hours.


Rroff(Posted 2013) [#6]
Sometimes your original code has a flaw you've not noticed but works upto a point, then as your program gets more complicated it starts using scenarios that expose the flaw in the code - I had it with one of my string parsing routines - I thought it was bullet proof and well tested but then as I started to give it more complex strings to work with there was a certain case it wasn't handling heh.