Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Question about (save-game:) and variables (Harlowe)

$
0
0
So, I fashioned a save and load menu by putting a bunch of stuff in a passage with the header tag. In itself, the saving and loading works perfectly fine, but at some point I decided to add a functionality that displays an "(empty)" behind the slot name if you haven't saved to it yet and the date and time of the save, plus what chapter the player was at if they have saved to it, so now it looks like this:

{(link:"Save game")[(text-style: "underline")[Save to:]
|A>[(link:"Slot A ($SLOTA)")[(set: $SLOTA to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?B)[](replace: ?C)[](if:(save-game:"Slot A"))[Game saved!](else:)[Saving failed!]]]
|B>[(link:"Slot B ($SLOTB)")[(set: $SLOTB to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?A)[](replace: ?C)[](if:(save-game:"Slot B"))[Game saved!](else:)[Saving failed!]]]
|C>[(link:"Slot C ($SLOTC)")[(set: $SLOTC to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?B)[](replace: ?A)[](if:(save-game:"Slot C"))[Game saved!](else:)[Saving failed!]]]]}
{(link: "Load game")[(text-style: "underline")[Load from:]
(link: "Slot A ($SLOTA)")[(load-game:"Slot A")]
(link: "Slot B ($SLOTB)")[(load-game:"Slot B")]
(link: "Slot C ($SLOTC)")[(load-game:"Slot C")]]}

$SLOTA, $SLOTB and $SLOTC are set to "empty" at the beginning of the game and $Chapter is set accordingly at the beginning of each new chapter. So, theoretically this should work, but what happens is this: When I click on "save game" or "load game" after saving to one of the slots, the message containing the date, time and chapter is displayed as intended. But when I load that save and then click on save or load again, it says "empty" again. At first I thought it was because the variables for the messages were actually set after the game is saved (the set macro was originally after the save-game macro), but even when I moved that part before the actual saving part (as displayed above), the problem persisted. So, why are the values for those variables not carried over after loading? It seriously doesn't make sense to me, from everything I know about how harlowe works, this should do what I want it to... It's not exactly a gamebreaking issue so I can keep working without problems, but at some point I'd like to fix this and I have no idea where the problem even lies...

Viewing all articles
Browse latest Browse all 1844

Trending Articles