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

Using TXT Files

Root / FAQs / [.]

📌
Epic_MankyCreated:
In PTC, The MEM$ command was useful for saving and loading, but it doesn't seem to be here in SmileBASIC. Was it replaced by another command, or just removed entirely?

WHATEVER_STRING_VARIABLE$="WHOA IS THIS REAL"
SAVE "TXT:WOWISTHISAFILE",WHATEVER_STRING_VARIABLE$
there you go to load a file to a string:
WHATEVER_STRING_VARIABLE$=LOAD("TXT:WOWISTHISAFILE",0)
use 0 for the second parameter to hide the file dialog, 1 to show it

This would be so much easier if they just kept MEM$...

Easier? What. No. There's no 256 character limit, just as a FYI.

This would be so much easier if they just kept MEM$...
Here is a MEM$ replacement!
DEF SAVEMEM file$
      SAVE "TXT:MEM."+file$,MEM$
END
It takes MEM$ and saves it. Will not make a LOADMEM now because typing on an IPad is incredibly annoying

Well, I'm trying to port code from a small project I was working on in PTC. But it's hard for me to do that because I'm used to PTC commands, so I have to learn the new commands and stuff.

This would be so much easier if they just kept MEM$...
Here is a MEM$ replacement!
DEF SAVEMEM file$
      SAVE "TXT:MEM."+file$,MEM$
END
It takes MEM$ and saves it. Will not make a LOADMEM now because typing on an IPad is incredibly annoying
Your code isn't working for me...when I typed it, I got
Duplicate function in  0:20

You can also save arrays as dats. It's very useful for game data.

You can also save arrays as dats. It's very useful for game data.
Using DIM typically gets me a duplicate definition error... ...And by the way, are you the same user who created the music for the Onward game I made a while back?

Using DIM typically gets me a duplicate definition error...
This means you are probably trying to declare the same variable twice. Maybe you should post your exact code so we can help you determine where you went wrong. The listed examples in this thread are correct, and shouldn't be the cause of your errors if you copied them, line for line

Using DIM typically gets me a duplicate definition error... ...And by the way, are you the same user who created the music for the Onward game I made a while back?
I meant: SAVE"DAT:FILENAME", ARRAY(an array that is already defined). And to load: LOAD"DAT:FILENAME",ARRAY. And yes, I'm that user, lol.

This would be so much easier if they just kept MEM$...
I think it is the same... except you can have more characters and "MEM" is "TXT".

This would be so much easier if they just kept MEM$...
I think it is the same... except you can have more characters and "MEM" is "TXT".
And you can use different strings as well, instead of just MEM$

This would be so much easier if they just kept MEM$...
I think it is the same... except you can have more characters and "MEM" is "TXT".
And you can use different strings as well, instead of just MEM$
Yeah, I forgot that part.