Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Returning to story after reading item journal

2 years ago
I have a journal as an item in my story that has different pages that the reader can click the link and read through. I currently have all its pages in a different chapter than the story itself.

Is there a script or other way to return the reader back to the story at the page they decided to open and interact with the journal? (Other than pressing the Go back button a dozen times.) I have a return link on page 1 of the journal but if the reader clicks through the journal and then uses the return link, it just returns back to the previous journal page, which I do not want.

I don’t know if this has been addressed before and how simple or not the answer is and I hope I didn’t miss it in my approximate 30 seconds of looking through the forum. . . But thank you! :~)

Returning to story after reading item journal

2 years ago
Short answer: yes. Use a variable and set the destaination page.

Longer answer... to come...

Returning to story after reading item journal

2 years ago
Oh wait, here are the instructions:

Page Recall

When using complex scripts and linking out to many different pages, sometimes you want to come back to the page you were at originally. For example, you have a random encounter script that takes the user to an encounter page where they do some actions with the encounter and then they come back to their original setting. A better explanation of this would be in a forest, where the user may encounter an animal. If the user encounters an animal, they are taken to the encounter page and do some actions like tame the animal, run away from the animal, or other related actions. Then, they return to the point that they were at in the forest. All of this explanation must leave you asking, where is all this going? Well, in the midst of all these examples, you must of have noticed that the user always returned to the same point they were at in their game before the encounter. As the game creator, you need to know how to return to the page they were at because it is most likely that the Previous Page link will not work. The following is placed in a link script.

%LASTPAGEID := $PAGEID

The above script stores the page id that the user is at before they are taken to the next page. This means that you can place this in the pages that the user may have random encounters, or like in the example, it can be placed in the forest pages, thus remembering what page you were on before the encounter happened.

Currently, we only know what page you were at, but we have not actually set the destination of the encounter pages to come back to this stored page. Therefore, we use the following link script in the Go Back link after the encounter:

$DEST := "@P" + %LASTPAGEID

If %LASTPAGEID = 39, then the user is taken to @P39, or the page with ID of 39. There are few things to note before I move on. The variable, %LASTPAGEID can really be any variable, you can call it "%LASTPAGE" or anything that you like, just remember to keep consistent and keep calling it that throughout the entire game. Also, when you are creating the link in the advanced editor, the destination that must be initially set is the chapter that %LASTPAGEID is in. So if you have a forest setting, the chapter that contains the forest must be the destination for the link, and then the link script above does the rest with the page ID.

Returning to story after reading item journal

2 years ago
The LASTPAGEID line would be placed in the link script for using the journal.

Then in the link for closing the journal, use the $DEST line

Returning to story after reading item journal

2 years ago

Perfect! Thank you!

Returning to story after reading item journal

2 years ago
"Also, when you are creating the link in the advanced editor, the destination that must be initially set is the chapter that %LASTPAGEID is in. So if you have a forest setting, the chapter that contains the forest must be the destination for the link, and then the link script above does the rest with the page ID."

If she was using the Codex article, it might need an edit to include this.