Skip to content

Rewinding in matchascript #7

@T-harrison1

Description

@T-harrison1

Can I ask you for advice on how to use matchanovel to let players rewind a VN?
I'm trying to code a limited, simplified rewind. I want to let players go backwards to re-watch curly bracket functions that make visual stuff happen in my game. It doesn't need to undo choices, variables or anything complicated.
I'm not using matcha's built in function show. I'm using custom curly bracket functions in an extension to control the game's graphics. For example, my story file looks like this:

C: Hold my hand here and go like this. {exactForwardVN(1)}
T: Careful, Be careful! {exactForwardVN(2)}
C: I won't mess up. Let me pretend. {exactForwardVN(3)}

I use the number in the function to control everything.

To do rewinding, I think the puzzle is to:

  1. Show the previous line in the textbox when player presses the back button.
  2. Run any curly bracket functions on that previous line again.
  3. Prevent rewinding behind a choice so it doesn't break anything.
  4. Prevent rewinding behind a label so it doesn't break anything.

In matchanovel in the textbox.guiscript on_input, there is a built in back() function in matcha that can do step 1.
I'm trying to find a way to re-run curly bracket functions on the previous lines.
I noticed that when going forward after rewinding, curly bracket functions won't run again when going forward after rewinding.
I also have to figure out how to get the back function to examine what the previous line contains, so that I can put a conditional so that it doesn't rewind on labels and choices, to avoid breaking things.
I really appreciate your insight and would like to learn any advice you have for how to implement code for rewinding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions