Howdy, Stranger!

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

newlines in twine macros inside a nobr

::Start
<<nobr>>
<<print
2>>
<<print
2>>
<<set $foo =
5>>
<<endnobr>>
produces the output
Macro not found: print2 Macro not found: print bad expression: Invalid character '\u8204'
which, given the recent discussion about using object literals, might come up once people start wrapping their finished code in &lt;&lt;nobr&gt;&gt;s

(I just replaced the inserted ZWNJ with a space; idk if that could cause problems in certain cases)

Comments

  • While we're on the subject of <<nobr>> and whitespace in macros,
    <<set $player = {
    inventory: {
    gold: 10,
    silver: 25,
    potion: 0
    }
    }>>
    <<print $player.inventory.gold>>
    Works.
    <<nobr>><<set $player = {
    inventory: {
    gold: 10,
    silver: 25,
    potion: 0
    }
    }>>
    <<print $player.inventory.gold>>
    <<endnobr>>
    Doesn't. No whitespace or anything after <<endnobr>>

    bad expression: invalid property id<<print>> bad expression: state.history[0].variables.player is undefined
  • Eh? Javascript doesn't consider zwnjs as whitespace? Hm, go figure. OK, I'll fix this in 1.4.1.
  • In 1.4.2 the TAB characters seem to place a whole bunch of ZWNJ in the code.

    This:
    <<nobr>>
    <<print "11111111">>
    <<set $a=1>>

    <<if $a is 1>>
    <<if $a is 1>>
    <<if $a is 1>>
    <<if $a is 1>>
    <<set $a=99999999999>>
    <<print $a>>
    <<endif>>
    <<endif>>
    <<endif>>
    <<endif>>
    <<endnobr>>
    Ends up like this:

    undefined

    Without the tabs it looks just fine.
    Could <<nobr>> remove the tabs also? I think it would make sense.
Sign In or Register to comment.