This shows you the differences between two versions of the page.
harlowe:link-undo [2017/10/09 20:39] |
harlowe:link-undo [2017/10/09 20:39] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **(link-undo: // [[harlowe:String|String]]//) -> //[[harlowe:Command|Command]]//** | ||
+ | Takes a [[harlowe:string|string]] of link text, and produces a link that, when clicked, undoes the current turn and | ||
+ | sends the player back to the previously visited passage. The link appears identical to a typical | ||
+ | passage link. | ||
+ | This [[harlowe:command|command]] should not be attached to a hook. | ||
+ | |||
+ | === Example usage: === | ||
+ | |||
+ | ''%%(link-undo:"Retreat")%%'' behaves the same as ''%%(link:"Retreat")[[[harlowe:undo|(undo:)]]]%%''. | ||
+ | |||
+ | === Rationale: === | ||
+ | |||
+ | The ability to undo the player's last turn, as an alternative to [[harlowe:go-to|(go-to:)]], is explained in the documentation | ||
+ | of the [[harlowe:undo|(undo:)]] macro. This macro provides a shorthand for placing [[harlowe:undo|(undo:)]] inside a [[harlowe:link|(link:)]] attached hook. | ||
+ | |||
+ | You may, as part of customising your story, be using [[harlowe:replace|(replace:)]] to change the ?sidebar, and remove its | ||
+ | default "undo" link. If so, you can selectively provide undo links at certain parts of your story instead, | ||
+ | by using this macro. | ||
+ | |||
+ | === Details: === | ||
+ | |||
+ | As with [[harlowe:undo|(undo:)]], if this command is used on the play session's first turn, an error will be produced (as there | ||
+ | is yet nothing to undo at that time.) You can check which turn it is by examining the ''%%length%%'' of the [[harlowe:history|(history:)]][[harlowe:Array|Array]]. | ||
+ | |||
+ | === See also: === | ||
+ | |||
+ | [[harlowe:undo|(undo:)]], [[harlowe:link-goto|(link-goto:)]] |