Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Conditionally display a link How-To

A topic by greendad37 created Sep 09, 2021 Views: 86
Viewing posts 1 to 1

The latest version allows you to display a link if a condition has been met. In the example below, the lines were added to the starter template under the DIV ID "part2"

#test visited.start
#iftrue <p>You've visited <a href="#start">start</a>

This simple example first tests whether you have seen a section and if you have, it displays some text and a link. The Dead Leaves example uses this frequently to display a message and link if you've visited before, and something different if you haven't.

Other scenarios that you might find this useful are:

  • Display a link if you have something in your inventory
  • Display a link if a random number generated by JavaScript meets your criteria

These little things help make your text adventure play differently every time you play it. I look forward to seeing other ways this might be used in the comments.