|
Post by Famer on May 24, 2016 15:02:22 GMT
Welcome to the new thread! Here we will be discussing about how to create a savegame. I have a problem with doing a savegame. I do not know how save games in 3D Rad. If you guys can help me with scripts or something else, it would be appreciated. I actually thought of instructing the script to: bool iFileSaveDialog(string,string,string) (for saving the game as .3dr)int iFileReadOpen(string) (for opening the savegame.3dr)I used the open and save syntaxes because I had to save the game. But what can I do to save the game without opening the windows save as dialogue box and open the savegame without opening the windows open dialogue box? I have'nt tried it in script yet. So I don't know whether it will work or not. I have planned to save the game as .3dr file because normally, the game is running on .3dr project files. Thank you.
|
|
|
Post by cypermethrin on May 24, 2016 18:24:14 GMT
You are thinking about this slightly wrongly, you can't just save the .3dr
You have to basically save the variables you want to remember to a file then read them back to the appropriate places when you start again - its not as simple as it seems
|
|
|
Post by Famer on May 25, 2016 11:14:05 GMT
You are thinking about this slightly wrongly, you can't just save the .3dr You have to basically save the variables you want to remember to a file then read them back to the appropriate places when you start again - its not as simple as it seems Yes, but you know, .3dr is the file that the compiled project can open! I don't understand what do you mean by variables.
|
|
|
Post by NicusorN5 on May 25, 2016 12:10:40 GMT
variables (if you don't know what are them) in 3D Rad are:
int Name = a number that ∈ to Z where Z ={-∞,-5,-4,-3,-2,-1,0,1,2,3,4,5,6...,+∞} float Name = a number that ∈ to Z and Q where Q contains rational numbers ex: -1.567364,2.6,5.6 .etc bool Name has 2 values : true and false => bool Name = true/false string Name = "contains a text" Vector3 Name (x coordinate,y coordinate,z coordinate) Contains a XYZ coordonate which is made from floats Quartenion Name (x rotation,y rotation,z rotation,q) Where q is a complex number, i have no idea what are them.
|
|
|
Post by Famer on May 25, 2016 12:32:08 GMT
Thank you nicusorN5, now I understand!
|
|
|
Post by Famer on Jun 1, 2016 6:42:25 GMT
BTW how to save the variables?
|
|
|
Post by Power Supersport on Jun 1, 2016 8:09:08 GMT
You want them to be saved to a file?
|
|
|
Post by Famer on Jun 1, 2016 9:36:10 GMT
|
|
|
Post by Power Supersport on Jun 1, 2016 11:43:27 GMT
Here is the code you need...
float value; void Main () { // Read if (iInitializing()) { int Read = iFileReadOpen(".\\MyFile.txt"); value = iFileValueRead(Read); iFileClose(Read); }
// Write if (iDeinitializing()) { int Write = iFileWriteOpen(".\\MyFile.txt"); iFileValueWrite(Write, write, true); iFileClose(Write); } }
value is the float you need to read and save...
|
|
|
Post by rock on Jun 1, 2016 12:10:06 GMT
|
|
|
Post by Famer on Jun 1, 2016 12:14:45 GMT
Thanks Power Supersport, you are very thorough with the scripts! Thanks to your knowledge! I am yet to test it!
|
|
|
Post by rock on Jun 1, 2016 12:27:07 GMT
|
|
|
Post by Famer on Jun 12, 2016 8:17:00 GMT
I get an error " 'write' is not declared line 13 pos.26
|
|
|
Post by Power Supersport on Jun 12, 2016 11:49:11 GMT
Capital W, my friend...
|
|
|
Post by commended on Jul 5, 2016 10:19:22 GMT
|
|
|
Post by NicusorN5 on Jul 5, 2016 12:11:01 GMT
Just use ValuePrint's IN_0 (Displayed value) and modify it....You can define it as a other float/ int ... ex:
int Value ; void Main() { IN_0 = Value; //Displayed value of 0BJ_0 }
|
|
|
Post by commended on Jul 8, 2016 9:39:23 GMT
@nicusorn5 I don't understand, could you explain please?
|
|
|
Post by NicusorN5 on Jul 8, 2016 11:32:10 GMT
Try this: float value; void Main () { // Read if (iInitializing()) { int Read = iFileReadOpen(".\\MyFile.txt"); value = iFileValueRead(Read); IN_0 = value; //valueprints IN_0 (Displayed value) iFileClose(Read); }
// Write if (iDeinitializing()) { int Write = iFileWriteOpen(".\\MyFile.txt"); iFileValueWrite(Write, write, true); iFileClose(Write); } }
I didn't tested this code , BTW it's Power Supersport 's code modified... xD
|
|
|
Post by commended on Jul 8, 2016 15:40:28 GMT
NicusorN5 Will try when I can, but my 3d rad computer is unavailable at the moment, I can't use it.
|
|
|
Post by Red Moon Entertainment on Jul 13, 2016 12:59:06 GMT
Which script of these is needed so?
PS: When I try to copy a code, space will disappear. Are they needed? How have I to set spaces before code lines?
|
|