0 votes
asked by (150 points)
reopened by
Hi I'm new with twine but I manage to study and learn how macros and everything works, at the moment I didn't have a problem but I'm someone who likes to write big stories, this came to my head but...

What can I do if I want to make some "episodes" type stories? I know that with each time the story is open all variables and stuff are reset.
There is a way that I can transfer "choices" to one story to other? (I use Sugarcube)

Thanks you :)

1 Answer

0 votes
answered by (52.4k points)
selected by
 
Best answer

What can I do if I want to make some "episodes" type stories? I know that with each time the story is open all variables and stuff are reset.

I assume you mean between two different games, right?

Assuming both games will be hosted on the same domain, you can use local storage as described in this answer to another question.  You could also look into this solution on the old forums to leverage SugarCube's built in saving functionality to your needs, and it includes an example file for SugarCube 1, you'll likely need to alter it slightly to have it work with version 2.

Overall, the local storage route is probably easier, but there's a chance that old data in local storage could get overwritten if there's a long gap between the player playing different episodes / games.  The other method is a probably a little more complicated, but allows the player to save their data to their computer and import that save any time.

Edit. Typos.

commented by (53.9k points)

You could also look into this solution on the old forums to leverage SugarCube's built in saving functionality to your needs, and it includes an example file for SugarCube 1, you'll likely need to alter it slightly to have it work with version 2.

That particular solution, which is what I generally recommend, requires the base story name of the episodes to be the same.  Making that work with Twine 2 is problematic due to it currently requiring story names to be unique.  It's not insurmountable, but it does makes things more difficult than they need to be.

commented by (150 points)
Testing it right now!

 

But this also could affect macros like <<If>>? (If visited)
commented by (52.4k points)
What do you mean?
commented by (150 points)
I would like to make stories in different episodes, that means Variables and choices of Chapter 1 would be used in Chapter 2.

I'm seeing that the macro <<if>> (If visited) can't be sent to another game (Chapter 2) but I'm being trying to send the variables of game 1 to game 2 but I can't manage to make it work, This is the first problem I can't find a solution for it or I don't really understand how to make it work., I'm really new to this type of coding.
commented by (52.4k points)
First, which solution are you trying to implement and what does your code for it look like?

The visited() function will not work when transitioning to a new game using the first option (local storage), but should work using the second option (using SugarCube's save system). The <<if>> macro itself will work fine, and you will be able to use it to test variables from the previous chapter without issues in either case.

It should be fairly simple to get variables over, and you could potentially include the list of passages the player has visited in the first option if you need it. We need to see what your implementation looks like before we can help.
commented by (150 points)
I manage to make it work! I was just doing things more complex than they needed but I admire the great attention and help you guys gave us!

You guys are great! Sorry for the bother.
commented by (52.4k points)
It's probably better to mark this as answered than to just lock it. Either select an answer or explain (briefly) how you managed to solve the problem and select your own answer if the other answers are inadequate. That way future readers/others with similar questions will be able to find this question and know that it came to a satisfying conclusion and we can avoid some repeated questions.
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.
...