Creating save games
Author |
Message |
7h3Q
![](http://www.pix05.com/t/leet11396.jpg)
|
Posted: Thu May 05, 2005 4:31 pm Post subject: Creating save games |
|
|
i'm wondering if its possible to create a save/load menu in turing, for a game, that would export all the variables and their values, and later recall them upon the users request. if this is possible can anyone make a tutorial on this?? would really appreciate it. i did search the turing forums, but kinda got lazy after clicking about five pages of links to posts.
the tutorials i read delt with importing and exporting text, which isnt what i wish to do |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Paul
![](http://i12.photobucket.com/albums/a207/paulbian/DDRDuck.png)
|
Posted: Thu May 05, 2005 6:47 pm Post subject: Re: Creating save games |
|
|
7h3Q wrote: that would export all the variables and their values, and later recall them upon the users request.
the tutorials i read delt with importing and exporting text, which isnt what i wish to do
Wouldn't exporting the variable values into a text file work? if you designed a correct input/output system for it. Like if you wanted to save a um... tic tac toe game, where x's are marked with x's and o's are marked with o's and blanks are marked with b, then you would export a text file based on the x and o positions that looks like:
or something like that
when you load this, just load the X's and O's onto the board using the values on the text file? |
|
|
|
|
![](images/spacer.gif) |
7h3Q
![](http://www.pix05.com/t/leet11396.jpg)
|
Posted: Thu May 05, 2005 7:13 pm Post subject: thanks |
|
|
havent thought of that, will have to play with those tutorials a little more to see what i can figure out. i'm pretty sure i'll be posting here with more questions as i play around with the code |
|
|
|
|
![](images/spacer.gif) |
syntax0r
|
Posted: Thu May 05, 2005 7:20 pm Post subject: (No subject) |
|
|
There are many SAVE/LOAD tutorials on this site, which one is the best for 7h3Q's problem, as I have the same problem? |
|
|
|
|
![](images/spacer.gif) |
jamonathin
![](http://compsci.ca/v3/uploads/user_avatars/57683465145f851a43dd9a.gif)
|
|
|
|
![](images/spacer.gif) |
Token
![](http://server2.uploadit.org/files/token89-avatar1.jpg)
|
Posted: Thu May 05, 2005 7:40 pm Post subject: (No subject) |
|
|
i'd have to agree with paul on that, with the games that i've made i always just save a picture of the screen to file, and take all the variables neccisary and output them to a text file, i then later recall all of them and do somthing like this
code: |
%%open file and stuff
get :stream, data
data := x
|
|
|
|
|
|
![](images/spacer.gif) |
syntax0r
|
Posted: Thu May 05, 2005 9:37 pm Post subject: (No subject) |
|
|
Forgive my : lazyness, stupidness or ignorance, but I find those tutorials to be vague. Like I said, I'm not trying to be rude! Don't get the wrong impression, I'm just puzzled with what's happening with all these unknown syntaxs.
Could someone demonstrate how I could save this variable
code: |
var pleaseSaveMe : string
var choice : int
put " 1 - NEW ........... 2 - LOAD"
get choice
case choice of
label 1:
put "enter the string value u wish to store into var pleaseSaveMe: "..
get pleaseSaveMe
put pleaseSaveMe, " was saved. Now u can load it"
label:
%%%%load var pleaseSaveMe : string and the output w/e was specificed into file
end case
|
into whatever needed file, so that program will load the value user specified value (w/e the user types is stored in the var pleaseSaveMe ) again, outputting w/e was said upon selecting the load option
EDIT:
Found something that answers my question. Had to scan, but it was worth it. Still I don't know what the program does, I just intepreted it the best i could
code: |
proc save
var stremout : int %Does not need to be set
var pathName : string := "save.sav" %The name of the file to be saved
var character_name : string
get character_name %The variable to be saved
open : stremout, pathName, write
write : stremout, character_name
close : stremout
end save
proc load
var character_name : string
var stremin : int %Does not need to be set
var pathName : string := "save.sav" %The name of the file to be loaded
open : stremin, pathName, read
read : stremin, character_name
close : stremin
put character_name
end load
|
got it from http://www.compsci.ca/v2/viewtopic.php?t=502 |
|
|
|
|
![](images/spacer.gif) |
7h3Q
![](http://www.pix05.com/t/leet11396.jpg)
|
Posted: Thu May 05, 2005 11:46 pm Post subject: kool |
|
|
thanks for the help guys, i've been toggling between turing and cs for the past "few" hours. finally got the save/load script working somewhat, still not exactly what i want it to be, but i'm getting their... i hope.
really appreciate the help |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
jamonathin
![](http://compsci.ca/v3/uploads/user_avatars/57683465145f851a43dd9a.gif)
|
Posted: Fri May 06, 2005 12:11 pm Post subject: (No subject) |
|
|
Ill tell you line by line what everthing is, in lamin terms.
Turing: | proc save %Just a name for a proc
var stremout : int %Just a variable name
var pathName : string := "save.sav" %The name of the file to be saved
var character_name : string %Just a variable name
get character_name %The variable to be saved - getting input from user
open : stremout, pathName, write %using the output variable, telling it to open up "save.sav", then telling it, it's going to use it to write in it
write : stremout, character_name %It is now writing on it
close : stremout %Closing that file up
end save
proc load
var character_name : string %just a variable name
var stremin : int %Just a variable name
var pathName : string := "save.sav" %Same as above
open : stremin, pathName, read %Using streamin to open "save.sav", and telling teh program we're just going to read it
read : stremin, character_name %So then we read it and save character_name to the data
close : stremin %Then we close it
put character_name %displaying the data
end load |
I hope this helps. |
|
|
|
|
![](images/spacer.gif) |
7h3Q
![](http://www.pix05.com/t/leet11396.jpg)
|
Posted: Fri May 06, 2005 2:52 pm Post subject: excellent |
|
|
excellent, thanks for the line by line explanation. my main problem was that i was not understanding the code, so i wasnt sure what to do exactly. i find it easy (as we all should) to copy something, say it works, but not comprehend one line of it.
thanks again, now i comprehend all the variables and what the purpose they server
the help is truly appreciated |
|
|
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Tue May 10, 2005 6:59 am Post subject: (No subject) |
|
|
oo I think that you can open the saved game files with any text editor and it to the last level without trying. o_O Even with a different extension, you can stil use notepad to open it |
|
|
|
|
![](images/spacer.gif) |
Token
![](http://server2.uploadit.org/files/token89-avatar1.jpg)
|
Posted: Tue May 10, 2005 4:58 pm Post subject: (No subject) |
|
|
well you could use some sort of simple enctyption, you take the ascii value of the charecter, preform some math on it, and then add it to the file, and when u read the file you reverse the math function and convert it back to a string |
|
|
|
|
![](images/spacer.gif) |
|
|