Discussions

SmileBASIC Community

DobsDobs60

12/01/2016 12:24 PM ·Spoilers

Open Closed

help with game progress save

can anyone help? how would i implement an in-progress game save in my game. i am looking to be able to be able to save and restart at the same map location and retain all progress (items, experience, weapons, scrolls, etc.). if i am not wrong backup would not do that.

Advertisement

Comment

This post has no comments.

  • You need to create a DAT file that will contain all these variables. It's a straightforward process. 1. Declare an array that will fit all the stuff you will save. 2. Fill this array with said stuff. The order is not important, but you must remember it. 3. Call the SAVE instruction. Specify DAT file type and the array to save.

    Yeahs1
    Played
  • DIM SAVARR[3] 'Let's assume I have 3 variables to save SAVARR[0]=HP SAVARR[1]=MP SAVARR[2]=EXP SAVE "DAT:FILE1",SAVARR Note: If you want to save an array... If it's a static array (fixed length), you can just accommodate it in the same save array. If you have a dynamic array, you'll want to create a separate file for it, although there is a semi-complicated workaround.

    Yeahs1
    Played
  • Strings follow a different saving process and use a separate file, but the process is similar. Let me know if you want an explanation for it. Loading the data back up is also a similar process. It's pretty much the same as saving, but backwards. Let me know if you want an explanation for it as well.

    Yeahs1
    Played
  • If you want to put mixed value types in a prg file (it's really easy) then do this saving: PRGEDIT 1,1 PRGDEL 1,-1 FOR I=0 TO LEN(ARRAY[]) PRGEDIT 1, I+1 PRGSET STR$(ARRAY[I]) NEXT FOR I=LEN(ARRAY[]) TO LEN(ARRAY[])+LEN(ARRAY$[]) PRGEDIT 1, I+1 PRGSET ARRAY$[I-LEN(ARRAY[])] NEXT SAVE "PRG1:SAVE"

    Yeahs0
    Played
  • oops, some of the stuff is wrong, but it should work with some easy fixing

    Yeahs0
    Played
  • thank you all for your help. it is greatly appreciated. my knowledge of 'basic programing' is limmited. and finding reference material for basic is hard. i cant even find 'basic for dummies' book. so thanks guys.

    Yeahs1
    Played
  • i got smile basic because when i was in my teens i got a 'comadore 64' and tried to do some basic but then life happened. i look at programing in sb as a game itself. to me itis one big logic problem to be figured out. trial and error is my most used approach but never shy away from help. so thanks to all again.

    Yeahs1
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-EJ9-9E2N-99M-6CXW

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: