LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Saveing the game

Root / Programming Questions / [.]

KomodoCreated:
So you know in all the video games how you can "save" how do you do that in smilebasic because you can't use the save command in the edit screen.

VAR SOMEVAR1=1
VAR SOMEVAR2=20

DIM SARRAY[0]
PUSH SARRAY,SOMEVAR1
PUSH SARRAY,SOMEVAR2

SAVE "DAT:SAVEFILE",SARRAY
The above saves an array to a data file called, SAVEFILE. Reading this back in is as easy as:
DIM SARRAY[0]
LOAD "DAT:SAVEFILE",SARRAY, FALSE   ' FALSE suppresses user confirmation dialog
I'm not sure what you mean when you say, SAVE doesn't work in edit screen. What problem are you running into?

well for some reason the save command whould not work in the edit screen.

what does the error message say?

Just TYPE what glenn wrote in edit mode and press START to run it. It will work.

wait it's working now thanks.

Mine keeps saying duplicate variable

Mine keeps saying duplicate variable
What is your code? Also, this topic is two or threeish months old...?

Bumping and old thread is better than making a duplicate thread IMO.

Mine keeps saying duplicate variable
This is usually because you aren't doing an ACLS at the start of your code, so the array is already defined the second time you run your program. (This is assuming that you've already checked your code to make sure you don't have DIM MYARRAY twice, which you will do if you've copied glennxserge's code without reading it)

ACLS does not clear the variables and arrays. It just resets the graphics n' stuff. The reason the error pops up is probably because you are running the code in DIRECT mode multiple times. That or there are multiple variable definitions for the variable in the code.

Do you have a better example because I need one this is the last thing I need for standard open rpg and I'll have everything I need

And I always use acls