Writing a file using save on 1.5 versus 1.3
by Isaac Barbosa · in Torque Game Builder · 09/26/2007 (8:54 am) · 11 replies
I feel stupid doing this question, that may be simple, but I can't find an answer in the forums and I've tried everything:
I was using
to write a file succesfully in TGB 1.1.3.
Now that line is not writing the file in TGB 1.5 using
neither
what could be wrong?
Thanks
I was using
GameData.save("mygame/data/savedInfo/gameInfo.cs");to write a file succesfully in TGB 1.1.3.
Now that line is not writing the file in TGB 1.5 using
GameData.save("~/data/savedInfo/gameInfo.cs");neither
GameData.save("mygame/game/data/savedInfo/gameInfo.cs");what could be wrong?
Thanks
#2
I have searched the forums for that workarounds but can't find them :( can you post a link for the right one or one of those please?
I have tried file IO and file IO work around but the search results are useless or out of date.
09/26/2007 (2:16 pm)
Thanks Robert,I have searched the forums for that workarounds but can't find them :( can you post a link for the right one or one of those please?
I have tried file IO and file IO work around but the search results are useless or out of date.
#3
Thanks!
09/26/2007 (2:57 pm)
I have the ability to learn and work with a functional thing. But if there is a bug with this I have no the ability to deal with it to found that work around. Can somebody tell me about this work around that Robert is talking about?Thanks!
#4
At the bottom of the post above is the function that I use, so instead of, for example,
$hsfilepath = expandFilename("~/data/saves/highscores.cs");
I use
$hsfilepath = expandFilenameFix("~/data/saves/highscores.cs");
Greg
09/30/2007 (4:39 am)
www.garagegames.com/mg/forums/result.thread.php?qt=66100At the bottom of the post above is the function that I use, so instead of, for example,
$hsfilepath = expandFilename("~/data/saves/highscores.cs");
I use
$hsfilepath = expandFilenameFix("~/data/saves/highscores.cs");
Greg
#5
Thanks, that fix works pretty cool. But my question is about why the ScriptObject is not being saved.
I'm using this line to create the object,
and this to save,
but it is not saving :(
why? is there a problem? a new syntax? can't find anything :(
09/30/2007 (10:41 am)
@Greg,Thanks, that fix works pretty cool. But my question is about why the ScriptObject is not being saved.
I'm using this line to create the object,
new ScriptObject(GameData);
and this to save,
GameData.save("mygame/data/savedInfo/gameInfo.cs");but it is not saving :(
why? is there a problem? a new syntax? can't find anything :(
#6
I can execute this file, but the save is not working....
What am I missing?
09/30/2007 (11:18 am)
Exec("~/data/savedInfo/gameInfo.cs");I can execute this file, but the save is not working....
GameData.save("~/data/savedInfo/gameInfo.cs");What am I missing?
#7
and it will work fine. (As long as you have my function in your game.cs) Using expandFilename regularly is good for a couple reasons. It adds a nice layer of abstraction, and makes it easy to implement workarounds such as this, as well.
Greg
09/30/2007 (1:17 pm)
You aren't missing anything. The bug in the file i/o is causing it not to save. But do this:%thepath = expandFilenameFix("~/data/savedInfo/gameInfo.cs");
GameData.save(%thepath);and it will work fine. (As long as you have my function in your game.cs) Using expandFilename regularly is good for a couple reasons. It adds a nice layer of abstraction, and makes it easy to implement workarounds such as this, as well.
Greg
#8
Wow, that was awesome! You have saved me :)
at the end I've used this line, that is working pretty well:
Thanks!
10/01/2007 (9:07 am)
@Greg:Wow, that was awesome! You have saved me :)
at the end I've used this line, that is working pretty well:
GameData.save(expandFilenameFix("~/data/savedInfo/gameInfo.cs"));Thanks!
#10
neither the tetraweb's fix, neither the TGB fix! (don't know what to do).
12/23/2007 (4:49 pm)
Now this is not working in TGB 1.6 :( :( :(neither the tetraweb's fix, neither the TGB fix! (don't know what to do).
#11
12/23/2007 (8:31 pm)
There is definitely something broken in the new TGB 1.6 FileIO. I've been trying to save and load my $prefs all day, to no avail. I posted about it in the bug reports forum...
Torque 3D Owner Robert Blanchet Jr.
There are work arounds for the issue in these forums. For now, I suggest you use them so you can move along with your game. However, in the next update the file io will be fixed and all of these work arounds will become useless.