Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (opm), 778 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Strange Numbers in file_var_read #466299
06/06/17 22:42
06/06/17 22:42
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I am using external files to save data. Occasionally, when my function opens a particular file, it gets strange data out of it that was never actually in the file.

I am using local variables in my function to store the data from the file. I have also made sure that only one instance of the function can access the file at a particular time.

I can't figure out where this strange data is coming from. If you reach the end of a file it should return zero, but in this case it is returning strange numbers, like 675.794 or -.001

I have a code that tells the game to stop reading if the number does not match a certain expected number (I added numbers to the file writing sequence to do this) but it still somehow reads these strange numbers from the file.

It's as if the function is being fed numbers from some source other than the external file.

Does this sound like a known bug of some kind? Or perhaps it's a problem someone encountered before?

Re: Strange Numbers in file_var_read [Re: Dooley] #466327
06/08/17 20:19
06/08/17 20:19
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Okay, I'm just following up with my solution. It's pretty obvious, and I should have caught it much sooner, and I'm kind of embarrassed to explain what happened, but for the good of the Game-Studio community, here goes:

I forgot to assign my variables a 0 value when I declared them.

I (almost) always assign a value when I declare variable. I don't know why I did not in this case, but that's why it took me so long to figure it out.

Happy programming!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1