Click to See Complete Forum and Search --> : Saving data?


chriz
07-09-2004, 06:53 AM
Hi, i don't know a THING about Perl or PHP but i was told i could find a solution here.

I am making a small RPG game out of javascript and HTML on my home computer and would like to create a 'Save game' feature that would store the players name, status and any checkboxes that have been checked.

Can anybody help me with this plz!
Thanx a lot guys!:) :)

Phil Karras
07-09-2004, 10:34 AM
If you can keep what needs to be saved under 1K then you can use JavaScript and cookies to add your save game feature. Go to the JavaScript section and do a search on cookies, that question has been asked numerous times.

Otherwise, you need a server that supports Perl or PHP or some other server-side scripting and then the user MUST be able to connect to the server whenever s/he wants to do a continue play or save a play. Not real friendly that but it would make it possible for you to charge for the service I guess.

chriz
07-12-2004, 04:24 AM
ok, i thought with it being on my hard disk, it would just be a couple of files. i tried using cookies butt when i tried to load the game it replied 'undefined'.
apart from SSL then, is yhere no other way to dp this i.e applets?:(

Phil Karras
07-12-2004, 01:07 PM
Actually I think IE will allow you to save a file & read it in as data, but that's an IE/Microsoft added feature which is not supported by any other browser.

You'll have to ask the question again on the JavaScript area & perhaps someone there will know better than I about what IE can & can not do in that regard.

Actually at one time I did manage to show how to do that. Go to my web site, below, and go to the help folder and copy the file: help246.htm to see if that's what you want to do for writing. I never bothered to read such a file, BUT if you name it NAME.txt and include HTML tags in it, you can read it with standard JavaScript methods. For that example play with the either of these: Read File / Text

chriz
07-13-2004, 04:15 AM
OK, i've asked in the javascript forum b4 but, not much help to be honest(!).
I am using IE only no other so that example sounded perfect.
I tried your site, but there seemed to be anerror on it. If possible, could you please explain this in more detail?? Thanks a lot.
:D
p.s (This is the page wasn't it? (See image attacthed))

chriz
07-13-2004, 05:46 AM
oph yeah, one more thing, if that is just loading, then how could oi get to actually 'SAVE' the data?
The data i would like saving are a lot of text boxes nd checkboxes. ThaNKS AGAIN

Phil Karras
07-13-2004, 10:47 AM
Humm, You're right there is a problem with read file, however, if you click on the right-had side link to: HELP Index the same program is used on my help files index and it seems to work fine. I'll have to check that data file it might have gotten messed up for the read file example.

The saving example was given to you before. From the Help Index example here's how you run the save file example help246.htm: find the location for text entry called: Test an example: put the above name in it, & click on the [Open Example] button. Then do a right mouse click so you can get the code, "view source" of the help file and save it. Modify it to save to a real location on your computer to test it out.

I want to thank you for letting me know of the problem, it has been corrected. It always helps to change all the programs that are using a given file when that file name changes. Now, the above example should work from either direction, Read File / Text or HELP Index

chriz
07-15-2004, 04:12 AM
Sorry to say again, but that page has another error in it.

help246.htm

I've go the hang of loading the data but, it's just saving it so...
speak soon

Phil Karras
07-15-2004, 09:06 AM
No, probably not. It runs and if you use IE it will try to write the file. There are a few things you need to know however,

1. You must have active-X activated
2. You need to change the path where the file is saved since I strongly doubt you have the path I set up.

So, do a View-Source and save the file onto your HD, make the needed changes & it should work.

I also use PKJS-LIB.JS and MyStyles.css neither of which you have to have to allow the file to work.

chriz
07-16-2004, 04:27 AM
OK thanks for that, i'll try and sort out that DirectX thing and have a go with the code. Ill Get back soon.

chriz
07-16-2004, 09:47 AM
right, ive got it to work, but not as i expected.
I saves the files onto your Desktop, thats OK but, how do you manage to load the data from here? i don't know ant of that X stuff. Thanks a lot - i'm nearly there!:D