User Tools

Site Tools


harlowe:replace

Differences

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

Link to this comparison view

Next revision
Previous revision
harlowe:replace [2017/06/19 01:49]
l created
harlowe:replace [2019/04/16 03:10]
l
Line 1: Line 1:
 **(replace: // ...[[harlowe:​HookName|HookName]] or [[harlowe:​String|String]]//​) -> //​[[harlowe:​Changer|Changer]]//​** **(replace: // ...[[harlowe:​HookName|HookName]] or [[harlowe:​String|String]]//​) -> //​[[harlowe:​Changer|Changer]]//​**
  
-Creates a [[harlowe:​Command|Command]] which you can attach to a hook, and replace target +Creates a [[harlowe:​Command|command]] which you can attach to a hook, and replace target 
-destinations with the hook's contents. The targets are either text [[harlowe:​string|string]] within+destinations with the hook's contents. The targets are either text [[harlowe:​string|strings]] within
 the current passage, or hook references. the current passage, or hook references.
  
Line 44: Line 44:
 place (replace:) commands in ''​%%header%%''​ tagged passages, if you want them to conditionally affect place (replace:) commands in ''​%%header%%''​ tagged passages, if you want them to conditionally affect
 certain named hooks throughout the entire game, without them interfering with other passages. certain named hooks throughout the entire game, without them interfering with other passages.
 +
 +(replace:) (and its variations) cannot affects hooks or text that haven'​t been printed yet - if the (replace:) runs at the same time that the passage is appearing (as in, it isn't inside a hook that's delayed [[harlowe:​live|(live:​)]],​ [[harlowe:​link|(link:​)]],​ [[harlowe:​show|(show:​)]] or similar macros), and a hook or line of text appears after it in the passage, the macro won't replace its contents even if it's a valid target. For example: ''​%%(replace:​ "​cool"​)[hot] cool water%%''​ won't work because the (replace:) runs immediately,​ but ''​%%cool water (replace: "​cool"​)[hot]%%''​ and ''​%%(event:​ when time > 5)[(replace:​ "​cool"​)[hot]] cool water%%''​ will.
 +
 +As a result of the above, putting these in ''​%%header%%''​ tagged passages instead of ''​%%footer%%''​ tagged passages won't do much good, as they are printed before the rest of the passage.
  
 === See also: === === See also: ===
  
 [[harlowe:​append|(append:​)]],​ [[harlowe:​prepend|(prepend:​)]],​ [[harlowe:​show|(show:​)]] [[harlowe:​append|(append:​)]],​ [[harlowe:​prepend|(prepend:​)]],​ [[harlowe:​show|(show:​)]]
harlowe/replace.txt · Last modified: 2019/04/16 03:10 by l