This Gist is no longer maintained. Head over to https://github.com/cyrusfirheir/cycy-wrote-custom-macros for newer versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//split text by headers (headerRegex, noOfCaptureGroupsInHeaderToReturn) | |
if(!String.prototype.headsplit) { | |
Object.defineProperty(String.prototype, 'headsplit', { | |
configurable: true, | |
writable: true, | |
value: function headsplit(regexp, caps = 1) { | |
const text = this.trim().split(/\r?\n/); | |
let retArr = [], | |
_header = "", | |
_content = "", |
Storing dialogue in plain text and converting it to html elements on the fly using JavaScript. (Part 1)
Note!
This system is not a replacement for standard usage, and has been developed only to facilitate faster/easier markup of story/dialogue data. In no way is this advanced enough to handle choices and a bajillion conditionals. At least not yet.
This sort of an approach is best suited when one needs to display text sequentially (like in a Visual Novel) without focusing much on writing html or macros. I decided to do something like this because typing:
<<speech "Speaker Name">>
Speech text
NewerOlder