Narrat 3.10.1 - Multiline scripting, text auto advance, new string functions

Narrat 3.10.1 has been released :partying_face: It contains a few useful new things

Multiline Scripting

You can now split your code into multiple lines by simply adding a backslash \ at the end of any line.

test_multiline:
  talk player idle "This is a very long string that \
  I want to split into multiple lines for readability"
  var text (concat \
    "I am concatenating multiple lines of text " \
    "together to make a longer string" \
  )
  talk player idle $text

This can allow writing longer or multiline scripts more easily, as well as splitting long lines of code in more readable formats.

Text autoadvance and delays

Two new options at the end of the talk or think command for a delay and autoadvance. If a delay is present, the game will wait that amount of time after the text animation is done before it enables the continue button.

If the last option is true, autoadvance will be on for that line of dialogue and the game will automatically jump to the next line without needing to press continue.

With this you can create dynamic sequences of timed text or cutscenes where text progresses without player input.

test_text_autoadvance:
  narrate "Hi!"
  narrate "with delay " 2000
  narrate "With delay and auto advance" 2000 true
  narrate "auto advance not waiting for text to print" 0 true
  narrate "auto advance waiting for text to print" 1 true
  narrate "This is a normal line"


  talk player idle "Hello!"
  talk player idle "This will auto advance" 1 true
  talk player idle "This will not auto advance but has a delay" 2000 false
  talk player idle "this is a normal line"

New string commands

  • str_search: Allows searching in a string. Works the same way as javascript search, returning the index of the result, or -1 if no result is found.
  • regex_search: Same as the above, but will interpret the search pattern as a regex
  • split: Splits a string into an array, based on a splitter character. Works the same as the equivalent javascript function. This one came from a contribution!

image

4 Likes

Line splitting is such a gamechanger haha. Thanks for the update!