You may add flavor text to any hashtag by typing text after a line break after the hashtag. Resolves #40

This commit is contained in:
raeleus 2024-10-04 00:15:29 -07:00
parent 1de7948af9
commit a0e8318cbc
2 changed files with 16 additions and 4 deletions

View file

@ -84,6 +84,15 @@ const modifier = (text) => {
state.characterName = getCharacterName(rawText)
text = sanitizeText(text)
var lineBreakIndex = text.indexOf("\n")
if (lineBreakIndex > -1) {
state.flavorText = text.substring(lineBreakIndex + 1)
if (!state.flavorText.startsWith(" ")) state.flavorText = " " + state.flavorText
text = text.substring(0, lineBreakIndex)
} else {
state.flavorText = null
}
command = text.substring(text.search(/#/) + 1)
var commandName = getCommandName(command).toLowerCase().replaceAll(/[^a-z0-9\s]*/gi, "")
@ -192,6 +201,8 @@ const modifier = (text) => {
text = processCommandSynonyms(command, commandName, statNames, doFlipCommandAbility)
}
if (state.flavorText != null) text += state.flavorText
return { text }
}
@ -1371,7 +1382,6 @@ function doGoToLocation(command) {
if (index != -1) {
location = state.locations[index]
var direction = pointDirection(state.x, state.y, location.x, location.y)
log(`direction:${direction}`)
var args = rotate(state.x, state.y, state.x + parseInt(arg0), state.y, direction)
arg0 = Math.round(args[0])
arg1 = Math.round(args[1])

View file

@ -17,10 +17,12 @@ See the [user guide here](https://github.com/raeleus/Hashtag-DnD/wiki).
Watch the [tutorial video](https://youtu.be/E5TYU7rDaBQ).
v. 0.1.1
* #note without parameters will store the last action text into the notes
* #goto specified with a distance and location name will take you partially toward the target
* `#note` without parameters will store the last action text into the notes
* `#goto` specified with a distance and location name will take you partially toward the target
* `#goto` allows you to travel by typing a location number instead of a name
* You may add flavor text to any hashtag by typing text after a line break after the hashtag (shift + enter on desktop). Thanks Xiron!
* You may use commas in coordinates now
* The scenario keeps track of how many days have passed since the adventure has started. See #rest, #showday, #setday.
* The scenario keeps track of how many days have passed since the adventure has started. See `#rest`, `#showday`, `#setday`.
* Minor bug fixes and improvements
v. 0.1.0