Text Processor - Adding "br", "hr", etc.
K.V.
06 May 2021, 19:51REFERENCE
https://docs.textadventures.co.uk/quest/text_processor.html#extending
FUNCTION
(Ran during start script)
SetUpTextProcessorStuff
game.textprocessorcommands = game.textprocessorcommands
scr => {
game.textprocessorcommandresult = "<br/>"
}
dictionary add (game.textprocessorcommands, "br", scr)
dictionary add (game.textprocessorcommands, "cr", scr)
dictionary add (game.textprocessorcommands, "line break", scr)
dictionary add (game.textprocessorcommands, "crlf", scr)
scr => {
game.textprocessorcommandresult = "<hr/>"
}
dictionary add (game.textprocessorcommands, "hr", scr)
//removed paragraph break
EXAMPLE
msg("This{cr}code{br}works{crlf}and{cr}{br}works{line break}and{crlf}keeps working{hr}")
Anything else I should add to this?
mrangel
06 May 2021, 22:08Wouldn't paragraph break be better using "</span><br/><br/><span style=\"" + GetCurrentTextFormat() + "\">"
? Might be a little more complex, but means the HTML is the same as paragraphs created by using multiple msg
statements. Could be beneficial so that it will behave consistently if a user is doing fancy CSS or JS stuff that might care about the number of paragraphs.
K.V.
06 May 2021, 23:11Good thinking.
I was just adding that because it's nice to use [paragraph break]
in Inform 7, just for a double helping of [line break]
s.
In Quest, though, I better stick to what makes sense in Quest.