LoginLogin

Need help with save"txt

Root / Programming Questions / [.]

ArrowCreated:
Thanks it worked why didn't somebody tell me before now

Thanks it worked why didn't somebody tell me before now
It's hard to immediately know what a problem is in a program. That's why debugging usually takes the longest when making a program.

As Lumage said, no-one wants to write your code for you. And, you made it difficult to help you. Among other things, you were given code that did not have this problem, no-one told you that your changes - changes that you told no-one - would be a problem because no-one is a mind-reader.

Thanks it worked why didn't somebody tell me before now
Put this code near the beginning:
VAR SAVE[5]
It will make an array (essentially a bunch of variables put into one) that will store your save data.
Just wanted to point this out

Thanks it worked why didn't somebody tell me before now
Put this code near the beginning:
VAR SAVE[5]
It will make an array (essentially a bunch of variables put into one) that will store your save data.
Just wanted to point this out
To be fair, later in that post:
LOAD "DAT:SAVEDATA",SAVEDATA,0
12Me21 had it right, and in the other thread MZ592 and Minxrod both gave examples with proper declarations.

No longer need help with saving But do need help with background animation

When you use bganim to move background it move the entire layer not just one tile is there a way fix this

no. That's how BG works. To move smaller objects, use sprites instead.

Lumage, rename this page to "Arrow needs help with SmileBASIC". That's all it is anymore.

Actually that was the last thing I need help with for a while

If the variable STATS is not declared, that's a problem. At or near the beginning of your code (but after CLEAR, if you use it), include
DIM STATS[9]
(or 5 or whatever the proper number is).
┈┈┈┈┈┈▕▔╲ ┈┈┈┈┈┈┈▏▕ ┈┈┈┈┈┈┈▏▕▂▂▂ ▂▂▂▂▂▂╱┈▕▂▂▂▏ ▉▉▉▉▉┈┈┈▕▂▂▂▏ ▉▉▉▉▉┈┈┈▕▂▂▂▏ ▔▔▔▔▔▔╲▂▕▂▂▂I

for saving numbers, I strongly reccommend that you use DAT files
VAR SAVEARRAY[5]
...
SAVEARRAY[0]=ATK
SAVEARRAY[1]=DEF
SAVEARRAY[2]=GOLD
SAVEARRAY[3]=HP
SAVEARRAY[4]=SP
SAVE "DAT:SAVEFILE",SAVEARRAY
and then
LOAD "DAT:SAVEFILE",SAVEARRAY
ATK=SAVEARRAY[0]
etc. to load
Old thread bump, but I do have a relevant question. Will this save the 'real numbers' with decimal points? I have numbers with 0.01 and stuff in my variables (?) for the cost of sand/how much it pays out, etc. And I was wondering if this method of saving will allow me to save Wonky numbers with decimal points. Also, is there a limit to how many things you can save? I have a feeling some of my numbers may end up extremely large as this clicker game progresses

It will save the exact values

It will save the exact values
Thank you very much. It's all working just the way I want it to. :D

I have a code using DAT files and its pretty good code it worked great for months but in one of the games I'm making with it it keeps changing variables on me when it's not supposed to and seems to be happening when it loads and I can't find anything in the should make it do that overall it works great with my first game I was making no problems at all