how to only allow link to be used once in game book

georgiebhughes
27 Jul 2019, 01:03

hiya,
just wondering if there's a way to make links to a page only work once?
i'm putting writing and then a choice for the person playing but currently if you choose one of the options, the other option is still available to you after.
sorry if this is a stupid question, i've never done anything like this before :)
thanks


mrangel
27 Jul 2019, 08:26

The simplest way would probably be to put a script on the page that the link goes to, using the function RemovePageLink.


jmnevil54
27 Jul 2019, 16:15

{once:page link}


Zesc
27 Jul 2019, 21:43

Both of the previous suggestions only work partially. It really depends on what exactly you're trying to do "only work once" is somewhat vague.

@mrangel's suggestion only works with links added either through AddPageLink () or the tedious function at the bottom of the graphic development enviroment.

@jmnevil54's suggestion, at the other hand, only work with in-text page links. (Althought correct syntax would be {once:{page:Page2}}) Also, this has the serious issue of hiding all links of a page after it has been visited, most likely turning it into a dead end the next time it is visitied.

Therefore, going with RemovePageLink (Page2, this) is the easiest way.

You can, however, achieve proper in-text links by using some if () { msg ("{page:Page1}") } shenenigans utilizing flags, if you wish so.

EDIT for clearification: Page1 in these examples is the page you're linking from, whereas Page2 is the page you were linking to.