Howdy, Stranger!

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

Combining text format commands

Pretty basic question, but what's the syntax for combining text formatting commands to apply to a string in Harlowe.

For example I want to change the font and underline a piece of text. I can get each change to happen individually but get error messages when I try to combine them.

e.g. ((font: "Courier")(text-style: "underline")) gives an error.

Comments

  • Try the following:
    (set: $style to (font: "Courier") + (text-style: "underline"))
    
    $style[This text should be Courier and underlined.]
    
  • Thank you, that does work. However, using set: causes us to fall foul of the problem I previously posted on, that the save-game: command fails when set: is used to change something like text style. I guess we'll have to keep our text formatting on the simple side.
  • Or you could unassigned the variable ($style in this case) after you have finished using it, so that it does not conflict with the (save:) macro.
    (set: $style to "")
    
  • @greyelf
    Without testing it, I don't think what you've proposed will work. IIRC, Harlowe never updates the "cannot save" flag once it has been set, so getting rid of any constructs that cannot be saved after the fact doesn't undo it.

    I could be wrong about that, however, that's what I seem to recall.
  • @TheMadExile
    You may be correct as I only did the following simple test to see if it worked. (Using TWEE notation)
    :: Main
    [[1. Test Styling->Styling]]
    (link: "4. Load Save")[(load-game: "StyleTest")]
    
    :: Styling
    (set: $style to (font: "Courier") + (text-style: "underline"))
    
    $style[This text should be Courier and underlined.]
    
    (set: $style to "")
    
    (link: "2. Save")[(save-game: "StyleTest")]
    [[3. Go to Main passage->Main]]
    
Sign In or Register to comment.