User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

harlowe:link-reveal-goto [2019/04/16 02:46] (current)
l created
Line 1: Line 1:
 +**(link-reveal-goto:​ //​[[harlowe:​string|String]],​ [String]//) → //​[[harlowe:​changer|Changer]]//​**
 +This is a convenient combination of the [[harlowe:​link-reveal|(link-reveal:​)]] and [[harlowe:​go-to|(go-to:​)]] macros, designed to let you run [[harlowe:​command|commands]] like [[harlowe:​set|(set:​)]] just before going to another passage. The first [[harlowe:​string|string]] is the link text, and the second is the passage name.
 +=== Example usage: ===
 +  * ''​%%(link-reveal-goto:​ "Study English",​ "​Afternoon 1"​)[(set:​$eng to it + 1)]%%''​ will create a link reading "Study English"​ which, when clicked, adds 1 to the $eng variable using [[harlowe:​set|(set:​)]],​ and then goes to the passage "​Afternoon 1".
 +  * ''​%%(link-reveal-goto:​ "Fight the King of England",​ "​Death"​)[(alert:"​You asked for it!"​)]%%''​ will create a link reading "Fight the King of England"​ which, when clicked, displays an alert using [[harlowe:​alert|(alert:​)]],​ and then goes to the passage "​Death"​.
 +=== Details: ===
 +Note that there is already an idiom for checking if a passage was visited earlier in the game: ''​%%(history:​ ) contains "​Passage name"​%%''​ checks if the passage named "​Passage name" was visited. So, you don't necessarily need to use this macro to record that the player has visited the destination passage.
 +Note also that there'​s no way to "​cancel"​ traveling to the new passage once the link is clicked, unless you include [[harlowe:​go-to|(go-to:​)]],​ [[harlowe:​undo|(undo:​)]] or another such macro is inside the hook.
 +=== See also: ===
 +[[harlowe:​link-reveal|(link-reveal:​)]],​ [[harlowe:​link|(link:​)]],​ [[harlowe:​link-goto|(link-goto:​)]],​ [[harlowe:​click|(click:​)]]
harlowe/link-reveal-goto.txt · Last modified: 2019/04/16 02:46 by l