Login
Remember
IF Answers
Ask a Question

# What script creates a link to a page?

0 votes
28 views
asked Oct 18 in Authoring by J.S. (1 point)

Simple question. What script do I need to write to add a link to the current page which will take the player to the specified page if they click on it?

I am using Quest in gamebook mode and writing my pages as scripts and ignoring all the gibberish of the G.U.I. and just typing the code directly, nice and simple like, but I don't know how to add text that links to another page.

I don't want to just use text+script pages and add the links down at the bottom, because that's weak, as I can't put the link inside of other code to make it only run under certain circumstances. (approximate example: if object.attribute=1 { (link: "this string", to page5) } )

- quest
- gamebook
- first-time

## 1 Answer

0 votes
answered Oct 19 by The Pixie (121 points)

It goes like this:

    {page:Page2:Next page}

... where "Page2" is the name of the page to go to, and "Next page" is the text displayed. It is the same in the GUI as in code.

By the way, have you thought about do this as a text adventure that looks like a game book? Sounds like you might want something a bit more advanced than the standard gamebook.
http://forum.textadventures.co.uk/viewtopic.php?f=18&t=4772

commented Oct 21 by J.S. (1 point)
I'm getting an error. Function not found. It's trying to read that line as a function, nomatter how I break it up or how I format it.
"Error: Error adding script attribute 'script' to element 'Page2': Function not found: '{page:Page2:Second}'"
Is there a different way I should format it in the code view?
Also, in the GUI, the closest thing I see is "Add Page Link," which is formatted AddPageLink (Room1, Room2, "Go from room1 to room2"), but it doesn't do anything, at least not when I call it in the "Room1" script of the above example.
I have started thinking about doing this particular project as a textadventure instead, but there's another project I'd like to do as a gemebook, but utilising variables (or in this case, attributes.) Basically, certain links would only appear based on the value of certain variables. For example, over the course of the gamebook you could have opportunities to gather coins or not, and then later you would have certain options that only appear if you have the coins. I've figured out how to keep track of the statistics, just not how to write the link within the code.

## Related questions

- Quest Gamebook: Return to a previous page with multiple links, and make link already chosen inactive
- Quest Gamebook: Can I allow players to choose their own name?
- Gamebook: How to include a player's attributes/stats?
- Quest Gamebook: Previous page links remain active?
- No option to save a .quest file?

...