'--- WHAT I USE FROM TIME TO TIME: FORGIVE MY MESS :3 ----
COMMON DEF SAVE_VAR TB$,VL,IM$ OUT OM$
OM$=IM$+"["+TB$+"]"+STR$(VL)+"[/]"
END
COMMON DEF SAVE_VAR$ TB$,IS$,IM$ OUT OM$
OM$=IM$+"["+TB$+"]"+IS$+"[/]"
END
COMMON DEF GET_VAR TB$,M$ OUT VL
VAR SI%=INSTR(0,M$,"["+TB$+"]")+LEN(TB$)+2
VAR EI%=INSTR(SI%,M$,"[/]")-1
VAR STRVAL$=MID$(M$,SI%,EI%-SI%+1)
VL=VAL(STRVAL$)
END
COMMON DEF GET_VAR$ TB$,M$ OUT OS$
VAR SI%=INSTR(0,M$,"["+TB$+"]")+LEN(TB$)+2
VAR EI%=INSTR(SI%,M$,"[/]")-1
VAR STRVAL$=MID$(M$,SI%,EI%-SI%+1)
OS$=STRVAL$
END
Here you can see how these DEFS are implemented...
Spoiler
VAR MEM$="" 'HAVE A STRING FOR THE MEMORY, LOADED OR NO
'--------------------------------------------------------
'NOW WE SAVE WHATEVER VARIABLES NEED TO BE SAVED, USING
'THE APPROPRIATE DEFS. STORE ANY SINGLE VARIABLE YOU WANT...
SAVE_VAR$ "FNAME","Seiji",MEM$ OUT MEM$
SAVE_VAR$ "LNAME","Serenity",MEM$ OUT MEM$
SAVE_VAR "AGE",30,MEM$ OUT MEM$
' !NOTE THAT THE LAST VARIABLE CALLED SAVE_VAR, NOT SAVE_VAR$!
' THIS IS BECAUSE IT IS NOT A STRING LIKE THE TWO ABOVE IT
' --------------------------------------------------------'
' THE RESULTING STRING READS:
' "[FNAME]Seiji[/][LNAME]Serenity[/][AGE]30[/]"
' MAKING THE SAVED STRING FILE ITSELF SUPER EASY TO DEBUG &
' EDIT!
'####TESTING GROUNDS#######
'-- NOW WE LOAD SOME VARIABLES FROM OUR MEMORY STRING
' AGAIN, USING GET_VAR$ FOR STRINGS AND GET_VAR FOR THE REST
GET_VAR$ "FNAME",MEM$ OUT FNAME$
GET_VAR$ "LNAME",MEM$ OUT LNAME$
GET_VAR "AGE",MEM$ OUT AGE
?FNAME$+" "+LNAME$+" is "+STR$(AGE)+" years old."
' THIS WILL OUTPUT "Seiji Serenity is 30 years old."
While wasteful with letter space in your string, this tedious method gives you a worry-free one file only save string to keep track of. The version I actually use is far more in depth, able to initialize arrays and the such using specialized tags like "[,]" and "[%]" making it more powerful than it seems at first glance. I'm sure there is a more efficient manner of achieving this, with less space used such as exclusive one character tabs like obscure ascii characters, but the premise will remain the same.
Also, you do not have to sacrifice '[' or ']' usage with this method, it is why I use INSTR. In the rare event that it did conflict, you could use one of those obscure characters to check for and substitute, but I can't conceive of any such conflict short of wanting to store '[/]' as a value or '/' as a tab.
There are pros and cons to both my and 12Me21's approach. His leaves a far shorter string with a little quicker speed, mine allows any variable scope, really. Like all tools at your disposal pick any method that easiest suits your goal.
Hope it helps you :)
Edit: Sry for all of the edits, I'll be better about them from now on now that my less-than-observant self has noticed the preview button.