How to return to previous page in gamebook mode?

Hello there. I'm using the gamebook style of game-making in Quest, and I have an idea for something similar to -if you've ever seen or heard of the game- Senran Kagura: Shinovi Versus, wherein a player can click on a highlighted word or phrase to learn more about it. To use an example from Senran Kagura, clicking on the word "Kagura" would produce a popup that gives some information on Kagura.

I want to do something similar to that, however, I'm a bit stumped. I've dedicated specific pages to the "pop-ups", however, I intend for the player to be able to access these "pop-up" pages from more than one point in the game. Is there any way I can use a variable or an attribute to mark a page as the "previous" one so I can use a script in the "pop-up" pages to return the player to the "previous" page?

If I need to explain what I'm trying to accomplish in more clear detail, please let me know.

(Also, while I'm here, could somebody please explain Squiffy to me? Is it just the gamebook feature for Quest, but as a standalone program? Does it have differing features?)


If you have a script that runs on every turn (I believe there's an option for that in gamebook mode) you could use that to record the previous page.

Something like:

if (not game.currentpage = player.parent) {
  game.previouspage = game.currentpage
  game.currentpage = game.previouspage
}

That checks if the attribute game.currentpage is the same as the page the player is currently on; meaning that they've moved to a different page. If so, it sets game.previouspage to the previous value of game.currentpage, and sets game.currentpage to the current page.

You can then have a script on your 'popup' page which creates a link from there to game.previouspage.


Thanks for your help! However, I've poured through the options, and there doesn't seem to be an option to run a script on every turn. Unless I've missed something. I appreciate the help immensely, however.


there doesn't seem to be an option to run a script on every turn

There's a script attribute named game.roomenter which is run in between changing the player's location (player.parent) and running the script or displaying the text for the new current page.

In the editor, it should be captioned "Script when entering page" on the "Script" tab of the game element. (I looked through the editor source to find it, as I don't have Quest running on this computer, but pretty sure I found the right one)


If you were using this method, then on the "popup" pages, you'd want to make them script+text type, and have a script something like:

if (not TypeOf (this, "options") = "stringdictionary") {
  this.options = NewStringDictionary()
}
if (HasString (this, "previouspagelink")) {
  dictionary remove (this.options, this.previouspagelink)
}
if (HasObject (game.previouspage)) {
  this.previouspagelink = game.previouspage.name
  dictionary add (this.options, this.previouspagelink, "Back to previous page")
}

(slightly more complex than adding a "previous page" link, because if the popup has been visited from more than one place, you need to remove the link back to the page that was previous last time)


Alrighty. I'll try it out!


I hope i do not cause any inconvinience when taking over this thread, but i have a question closely connected to the above:

I'm using a very similar code (see below) which works like mrangle's example, but more general and for all pages.

player.LastPage = player.Now
player.Now = player.parent
AddPageLink (player.parent, player.LastPage, "Previous Page")

But this one has the issue of not removing the links once they are used, meaning that if the player enters the same page again from a different direction, it will have two links reading "Previous Page", bot leading to different pages.

I actually found a way to prevent this when directly going back, but for each step i'd do this, i had to add two new lines of code (one to define the page, one to remove the link) but if the player decides to walk 64 rooms in one direction and then 65 back, i still get the issue.

This all would be no problem if there was something to clear all PageLinks of a given page, but there doesn't seems to be a script for that. Could i somehow refer to the attributes of a given page to get the expression of a PageLink?

Anyone knowing how to do this? I regard this important to this topic since the other code will most likel have comparable problems.


Wrote quite a large response, but "sorry, you can't post that here"



Oh, i didn't knew you could look for a DictionaryItem that way. Mostly because i did have multiple "Previous Page"-links. I guess in that case, it would just remove all of them?

Also, player.parent.options = NewStringDictionary() does the job already, since i wanted to clear all page links anyway.

All the essential links are added to my pages by scripts, since i foudn fiddling with the options in the GUI annoying and inefficient. It's much easier to pop a AddPageLink (this, Target, Name) and edit it than going through an annoying and prone-to-errors confirmation dialogue each time you want a new page. (Especially since hitting the tiny buttons is tricky on a 4K screen.)

However, i don't understand your second block of code. It checks for "options"and not player.parent.options to exist? And isn't the nested if () checking for something that would first be defined if it results a negative?


Log in to post a reply.

Support

Forums