Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Applying style to named hooks

I'm sorry if this has already been asked (and it probably has, but I just can't find a relevant post).
I am trying (Twine 2, Harlowe 1.2.3) to apply a style to a bunch of named hooks, through a link.
Something like
This [is]<a| my [text]<a| with some [hooks]<a|.
(link: "Click!")[(prepend: ?a)[(text-style: "blur")]]
This doeasn't work, since prepend adds the given content in front of the target hook's content, not in front of the target hook itself.
Does someone know how to do that?

Comments

  • If each named hook you wish to style using a single link has a unique name (within the current passage) then you could do the following:
    This [is]<a| my [text]<b| with some [hooks]<c|.
    
    (link: "Click!")[\
    (set: $text to ?a)\
    (replace: ?a)[(text-style: "blur")[$text]]\
    (set: $text to ?b)\
    (replace: ?b)[(text-style: "blur")[$text]]\
    (set: $text to ?c)\
    (replace: ?c)[(text-style: "blur")[$text]]\
    ]
    

    notes:
    a. The above technique does not work correct if there are multiple named hooks within the current passage with the same name because the value assigned to the $text variable will be the contents of all those particular named hooks joined together into one big String. eg. in your case it would equal "istexthooks"

    b. The above solution will not work with Harlowe 2.0.0 because you are not longer allowed to assign the content of a named hook to a variable using (set:) macro.
  • Thx, this can come in handy. I'll see what I can do with Harlowe 2.
  • edited February 19
    Found what I was looking for: Harlow 2's
    (enchant: )
    
    does what I want.
Sign In or Register to comment.