Game Development Community

[T2Di 1.3] SimObject.save() not working?

by Pisal Setthawong · in iTorque 2D · 01/12/2010 (7:31 am) · 11 replies

when im using version 1.2 im used

new ScriptObject(Profiles);
Profiles.save("profiles.sav");

and it work perfectly on PC , Mac and iphone.

but on version 1.3 it seem this code didn't write anything to iphone , im tried to check and the function SimObject::save is called and even return true , but everytime im tried to load , the file isn't there. anyone could enlighten me with this problem? there are a lot minor change when im move to 1.3 and this is the biggest problem for me.

About the author

An Educator moonlighting as the Technical Lead at the indie game development studio called Flying Pig Game Studio


#1
01/28/2010 (11:08 pm)
im investigated more and found out that file is already created and saved but the real problem is "exec" function in 1.3 said the file is missing but it don't have any problem exec saved file in version 1.2. anyone?
#2
01/29/2010 (7:00 pm)
try with 1.3.1 :)
#3
01/30/2010 (3:04 pm)
it seem 1.3 and 1.3.1 tried to find and load .sav.dso when call exec("profile.sav") but in 1.2 it doesn't have any problem to handle this kind of load , there a lot of changes in exec console function from 1.2 i have to investigate more
#4
01/30/2010 (4:02 pm)
exec profile.sav makes no sense.

exec is in the own folder the saving is definitely not in the own folder but the applications documents folder
#5
01/30/2010 (4:40 pm)
hi Marc , what should I do to exec my profile.sav? any help are really appreciated :D

*note : since my save data are heavily contain tons of simset changing the way of save and load files going to be real pain for me :(.
#6
01/31/2010 (8:44 am)
Did you try saving the file NOT to the bundle (as thats not allowed?) .

For example :

getAppDocumentsPath() is used to find somewhere to save the files.

new ScriptObject(Profiles);
Profiles.save(getAppDocumentsPath() @ "/profiles.sav");

You also load it from that directory. you cannot save files "in place". The iPhone does not allow it.
#7
01/31/2010 (1:57 pm)
here is what it seem work for me

im using this for save

new ScriptObject(Profiles);  
Profiles.save("profiles.sav");

and this for load

exec ("../Documents/myCompany/myGame/profiles.sav");

#8
01/31/2010 (3:53 pm)
Pisal, tried saving and then reloading your app using that method. My guess (well not so much a guess really) is that file won't be there for you.
#9
01/31/2010 (5:08 pm)
could anyone show me the real working example to save and load simset on iphone? this is what I'm really asking for.
#10
05/06/2010 (7:09 pm)
http://www.torquepowered.com/community/forums/viewthread/112693
#11
05/09/2010 (11:42 pm)
http://www.torquepowered.com/community/resources/view/17153