+1 vote
asked by (1.3k points)

I am trying to put a "Save Game" link in my footer, combined with a menu in the opening passage that offers both "New Game" or "Continue Game." I'm following the documentation in the Harlowe 2.0.1 manual: https://twine2.neocities.org/#macro_save-game

The functionality of the save-game macro is working perfectly, as far as I can tell. I can load a saved game or start a new game; loading the saved game takes me to the correct point in the game; when I save the game, it works correctly.

However, when I test the game, I'm consistently getting the error: "(savegame:)'s 1st value is the number 0, but should be a string - The (savegame:) macro must only be given a string, and (an optional) a string, in that order"

I have only used strings for the savegame macro. What am I doing wrong?

Here is my implementation:

In the STARTUP passage:

(set: $check to false)

In the FOOTER passage:

(link:"Save game")[
	(if: (savegame:"File A"))[
    Game saved!
  ](else: )[
    Sorry, I couldn't save your game.
  ]
]

In the MAIN MENU passage:

(if: (saved-games:) contains "File A")[
   (if: $check is false)[
      (link-replace: "New Game")[
         (set: $check to true)
         (confirm: "You have a saved game. Are you sure you want to start a new game? To start a new game, choose 'New Game' again. To return to your previous game, choose 'Continue Game.'")

      [[New Game->Start]] 
   ] 
]

(if: $check is true)[ 
   [[New Game->Start]] 
   ] 
]}
{(if: (saved-games:) contains "File A")[
   (link: "Continue Game")[
      (load-game: "File A")
   ] 
]}
(else: )[ [[New Game->Start]]
No Saved Games ]

 

1 Answer

0 votes
answered by (1.1k points)
I see similar messages from the browser launched by Test or Play when testing saves. However, the saves work normally (so far!) when using another browser on a "published" file.
commented by (1.3k points)
I found the problem! I'd forgotten I'd put in an autosave in the header passage. I think it was interfering with the savegame macro I was working on elsewhere. I took out the redundant macro and the error message disappeared.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...