User Tools

Site Tools



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

Link to this comparison view

harlowe:link-goto [2017/10/09 20:39] (current)
Line 1: Line 1:
 +**(link-goto:​ // [[harlowe:​String|String]],​ [ String ]//) -> //​[[harlowe:​Command|command]]//​**
 +Takes a [[harlowe:​string|string]] of link text, and an optional destination passage name, and makes a [[harlowe:​command|command]] to create
 +a link that takes the player to another passage. The link functions identically to a standard link.
 +This command should not be attached to a hook.
 +=== Example usage: ===
 +  * ''​%%(link-goto:​ "Enter the cellar",​ "​Cellar"​)%%''​ is approximately the same as ''​%%[[Enter the cellar->​Cellar]]%%''​.
 +  * ''​%%(link-goto:​ "​Cellar"​)%%''​ is the same as ''​%%[[Cellar]]%%''​.
 +=== Rationale: ===
 +This macro serves as an alternative to the standard link syntax (''​%%[[Link text->​Destination]]%%''​),​ but has a couple of
 +slight differences.
 +  * The link syntax lets you supply a fixed text string for the link, and an expression for the destination
 +passage'​s name. However, it does not provide any other means of computing the link. (link-goto:​) also
 +allows the link text to be any expression - so, something like ''​%%(link-goto:​ "Move " + $name + "to the cellar",​ "​Cellar"​)%%''​
 +can be written.
 +  * The resulting command from this macro, like all commands, can be saved and used elsewhere.
 +If you have a complicated link you need to use in several passages, you could [[harlowe:​set|(set:​)]] it to a variable and use that variable
 +in its place.
 +=== Details: ===
 +As a bit of trivia... the Harlowe engine actually converts all standard links into (link-goto:​) macro calls internally -
 +the link syntax is, essentially,​ a syntactic shorthand for (link-goto:​).
 +=== See also: ===
 +[[harlowe:​link|(link:​)]],​ [[harlowe:​link-reveal|(link-reveal:​)]],​ [[harlowe:​link-repeat|(link-repeat:​)]],​ [[harlowe:​link-undo|(link-undo:​)]],​ [[harlowe:​goto|(goto:​)]]
harlowe/link-goto.txt ยท Last modified: 2017/10/09 20:39 (external edit)