Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 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