トピック
受付中
bherdm bherdm

Save an array of strings?

I see in the help that it's possible to save a numerical array, is it possible to save an array of strings? Thanks!
1そうだね
プレイ済み
返信[1]
親投稿
MSWS coolestkid123
Yes. Just like variables you just have to add $ after their name. Eg: DIM TEST$[5] TEST$[0]="Hi" TEST$[1]="Sup!" etc.
0そうだね
プレイ済み
返信[2]
親投稿
Alex MrCashews
You can't save a string array to a file unfortunately. You could put every entry together into one string with some kind of separator after each one and save it as a TXT though. You would have to load the TXT and split all the parts up to convert them into a string array later.
0そうだね
プレイ済み
返信[3]
親投稿
MSWS coolestkid123
Oh sorry lol. As stated above this is the only way to do this. I've made 2 simple functions that let you save/load arrays into an already defined array. Eg: DIM T$[9] T$[0]="Test" T$[1]="HI" SAVESTR "FILENAME",T$ LOADSTR "FILENAME",DESTINATIONARRAY$
0そうだね
プレイ済み
返信[4]
親投稿
If you will be storing sensitive data to a file (high scores, progress) I highly, highly recommend using the DAT file type instead of TXT DAT stores an array of numbers, and cannot be viewed or changed in the text editor DIM D[1] D[0]=MYNUMBER SAVE "DAT:SAVEDATA",D You want to save not very often so the user is not bombarded by dialogs saying "Would you like to save blah blah blah?"
0そうだね
プレイ済み