TGC Codebase Backup



Basic Saving and Loading by Phoenix Software

1st Dec 2005 18:23
Summary

Very Basic, but helpful to newbies.



Description

You can use this for loading values later in your career as a programmer. Useful from everything to saving your player's stats to their level.

Enjoy :).



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `Simple Save and Retrieve
`Version - 1.0
`By **Name Erased**

input "name> ";name$

dim namea$(1)
namea$(1) = name$

input "file location,name,extension> ";file$

Print "saving as array"
save array file$,namea$(1)

Print "now saving as a text file"

open to write 1,file$
if file exist(file$) = 1 then delete file file$
write string 1,name$

close file 1

Print "All done!"

Print "Now then I'll reload it for you pal!" 

Print "As an array: "
load array file$,namea$(1)
Print "Your name was: ";namea$(1)

Print "As a text file: "
open to read 1,file$
read string 1,name$
close file 1
Print "Your name was: ";name$

Print "There ya go bob's your uncle! :) Hope This Helped!"