Help with file save & load?

Blitz3D Forums/Blitz3D Programming/Help with file save & load?

Guy Fawkes(Posted 2012) [#1]
Hi all :) Ok, so a few weeks ago when I was on vacation, I wrote a function to save multiple objects to a specific folder, along with a save file that reads each object into my level for my game. Now the PROBLEM I'm having is that it's saying "Object does not exist" at THIS line:

all\id = LoadAnimMesh(all\meshdir$)


I have NO idea why.



I checked if all\meshdir$ is NOT "nothing", and it wasn't. It lead straight to the mesh's correct location.


Can someone please help me out here? :) Thanks alot! :)


Here's the functions:





Please note you do NOT need to run this code. I just need to see why its saying that the loaded mesh does not exist when it clearly does o.o


the loaded path TO my model btw, is whatever path was chosen from the load menu in function Call_Load_Open_Menu(). My load function then reads which mesh location was written into the save file.


Please note: The file extension for now for the save file, is ".myfile"


Thanks again! =D

Last edited 2012


Yasha(Posted 2012) [#2]
"Object" in Blitz3D errors doesn't refer to 3D models or other scene objects - these will be referred to as "entity" if it needs to be generic, or "mesh", "camera" etc. if it happens to know the subtype of the entity in question.

When an error message refers to "objects", it means instances of custom types. Therefore "Object does not exist" means that the variable in question ("all") is Null at the time when you're expecting to be able to use an object pointed to by it.

So this error message has nothing to do with the loaded mesh. Stick a Stop in that case block and try stepping through it to see why it's Null.

Last edited 2012


Guy Fawkes(Posted 2012) [#3]
Well do you know what's going on with this thing? For god sakes it's driving me crazy *twitch* :3


Guy Fawkes(Posted 2012) [#4]
UKW? Screw it. im going to upload a demo :P cause i REALLY need help with this :)


Guy Fawkes(Posted 2012) [#5]
NVM! Figured it out! I fgt. to add 2 readline(filehandle)'s to the end of my file read... it was crashing because it was missing 2 lines which were null. THANKS ALOT, YASHA! =D


Yasha(Posted 2012) [#6]
I have no idea why it was doing what it was doing, but OK, glad I apparently helped...?

However, I would suggest you consider using some other way to read/store your data. The issue you just had shows how unstable a program can be when the exact shape of the data is hardcoded into the read routine. If you use a slightly more structured format (e.g. XML, INI - I remember you looked at that before), the program will automatically be resilient to errors caused by too many or too few newlines, or fields being written in the wrong order, or left out, or whatever. You can find libraries for handling XML and other things in the code archives.

Last edited 2012


Guy Fawkes(Posted 2012) [#7]
Thanks, Yasha! :)


Guy Fawkes(Posted 2012) [#8]
Thanks, Yasha! :)


Guy Fawkes(Posted 2012) [#9]
Sorry for the double post.... The forum seems to allow for that for some reason... I twitched when I hit the submit button ><