Any way to do "new line" in PulpScript?

Any way to add somethings like "\n" to a string so that your say"" command will continue on a new line?

I have been using \n in my say commands to do exactly this and it appears to work as expected.

So this is the code I am using and it will show \n in the dialog.

monsterDetails = "Monster: {playerMonsterName}\n"
monsterDetails += "Level: {playerMonsterLevel}"
say "{monsterDetails}" then
end

Screenshot 2022-02-25 at 11.19.12

Ah, I just tried it out and see the problem now - you can't use \n inside a string that is included via string formatting.

i.e.

say "Hello\nWorld"

Outputs as:

"Hello
World"

foo = "Hello\nWorld
say "{foo}"

Outputs as:

"Hello\nWorld"

foo = "Hello"
bar = "World"
say "{foo}\n{bar}"

Outputs as:

"Hello
World"

Hopefully you can workaround that limitation?

Alternatively you could right pad the variable with the number of spaces needed to push onto the next line.

Thanks. I'll try that for now! Does this count as a bug? Or is this just the way it's supposed to work. Should I add "feature request" tag?

That’s a bug! I’m looking into it now. :smiley:

2 Likes