Discussions

SmileBASIC Community

ClaytonDarkClay88

09/22/2016 11:47 PM ·Spoilers

Open Closed

Saving $trings

How do you save $trings? I tried saving it with my other variables like, (Example:) DIM SAVARR[3] SAVARR[0]=VARIABLE1 SAVARR[1]=VARIABLE2 SAVARR[2]=STRING$ It says type mismatch too. How do I save it?

Advertisement

Comment

This post has no comments.

  • hey, just a question, where did you code Megalovania in Miners Life, like where in the code (What line to what line)

    Yeahs0
    Played
  • It should be a separate file in the Miner Life folder. You can copy it and put it in your own folder and load into your program.

    Yeahs0
    Played
  • file name please?

    Yeahs0
    Played
  • Unfortunately, different types cannot share an array. If I have a chance, I'd write as follows. DIM SAVARR$[3] SAVARR$[0]=STR$(VARIABLE1) SAVARR$[1]=STR$(VARIABLE2) SAVARR$[2]=STRING$

    Yeahs0
  • You can only save numerical values when saving with an array. This means you can't save text in a binary (DAT) file. At least, not directly. However, there's a SAVE instruction specially designed to save text. You just need to call SAVE like this... SAVE "TXT:<Filename>",<String$> What's more, you can keep the same filename for both the DAT and the TXT file.

    Yeahs1
    Played
  • You technically can only save one string per TXT file this way, but you can store many strings within a single string by concatenating the strings while separating them with a special character. This explanation could take a while and gets a bit technical, so do say if you need it.

    Yeahs1
    Played
  • I gotcha! Thanks guys!

    Yeahs0
    Played
  • How would you load it? Like this? LOAD"TXTSTRING",FALSE

    Yeahs0
    Played
  • You have two ways of loading it... LOAD "TXT:<Filename>",FALSE OUT <String$> <String$> = LOAD("TXT:<Filename>",FALSE) As always, you should first check if the file exists with CHKFILE, like this... IF CHKFILE("TXT:<Filename>") THEN <String$>=LOAD("TXT:<Filename>",FALSE) ENDIF

    Yeahs1
    Played
  • Okay I gotcha, thanks!

    Yeahs0
    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-9E2G-CFY-TTHN

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: