Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Display a history of choices in each passage

Hi, I am looking for a way to create a 2 functions that will basicly do 2 things:
1) Displays the history of choices, example below:
I went through 5 different passages (Intro, Left, Left, Right, Jumped)

This would help create a nice history for me, to make sure everything is working in my dynamic story (many different endings).

2) Similar one (not sure if fully possible though), but with a coded "save state" that can later be decifred, for example each passage would have an ID (or would use tags), and it would add as youre going, so if you stop on one of them your code would be 2A5FAD, it would be easy to recreate for you. Maybe even with an input field to recreate all decisions?

Anyone got any clue how to approach this?

Comments

  • When asking a question you need to state the name and version number of the Story Format you are using, as answers can be different for each one.

    re: Displays the history of choices

    This functionality is possible to do in each of the different story formats although the actual implementation would be different for each one, thus the need to know yours.

    re: Save State Codes:

    It sounds like you are trying to implement a way to save the path the Reader took through your story, both Harlowe (1.x and 2.x) and SugarCube (1.x and 2.x) story formats already have a History Save System built into them.
  • Ah, sorry, I thought I updated it, I am using Harlowe 2.x. Could you help me know where to start with both? I am eager to learn how to do this.

    Thank you.
  • I personally don't have the Twine 2 Beta appliaction installed which means I also don't have an installed copy of the latest Harlowe 2 Beta, the following example should work but I have not tested it.

    1. Displays the history of choices

    Create a header tagged passage and place the following example in it.
    []<list|\
    (set: _history to (history:))\
    (if: _history's length > 0)[\
    	(set: $index to 0)\
    	(for: each _item, ..._history)[\
    		(if: $index > 0)[(append: ?list)[, ]]\
    		(append: ?list)[_item]\
    		(set: $index to $index + 1)\
    	]
    ]
    


    2. Save State Codes

    I suggest reading about the (save-game: ) macro and the (load-game: ) macro
  • So I've encountered an error, and then it lighten me up... I've just noticed my version is 1.2.2 - I am using an online one and thought that Twine 2 will be the newest one... sorry for wasting your time greyelf. Thanks for the feedback though.
  • Try placing the following code within the header tagged passage instead.
    |list>[]\
    (set: $history to (history:))\
    (if: $history's length > 0)[\
    	(set: $list to $history.join(', '))\
    	(replace: ?list)[$list]
    ]
    
  • Great, works! Thank you.

    As for the save option, I am looking to have a code instead of save / load type thing. As I want to make a help system for a board game, so that players know where they stopped, just by copying the code in the footer, and then pasting it into input, so that all the decisions he made has been still active.

    Will the save option be able to do that?
  • For example, I would like to add tags to passages, then when you save, you are getting a code for the passage you were in (all the tags along the way, making it for example 3fur83f8). Then to get back into game on different pc or whatever, on the start of the game I use that code to "load" my state.
Sign In or Register to comment.