Is there a text-style along the lines of "normal"? I'm randomly selecting a text-style but would like to include the possibility of there not being a style at all. So:
The (text-style: ) macro validates the style name you pass to it so you can only use the names listed in it's documentation, and unfortunately due to the way it hard-wires a style attribute directly to the HTML element being generated (instead of assigning a CSS class) you can't simple override the effects of a named style using CSS within your Story Stylesheet.
You could do something messy like the following, which first randomly determines which style to use, next it checks to see if the style is either 'normal' or something else and re-assigns the $style variable appropriately, and finally uses the $style variable to style the text.
(set: $style to (either: "normal", "shadow", "blur", "blurrier", "smear", "mirror", "upside-down", "fade-in-out", "rumble", "shudder"))
(if: $style is "normal")[(set: $style to true)]
(else:)[(set: $style to (text-style: $style))]
The shadow $style[flares] at you!
Because you may want to use the code that determines the style to use multiple times you could move the (set:), (if:) and (else:) code into its own passage and call it like so:
1. Create a passage to store the style determining code, I named mine Determine Style. Note the Collapsing Whitespace markup and that there is no line-break at the end of the code, this is to stop it from creating blank lines.
{(set: $style to (either: "normal", "shadow", "blur", "blurrier", "smear", "mirror", "upside-down", "fade-in-out", "rumble", "shudder"))
(if: $style is "normal")[(set: $style to true)]
(else:)[(set: $style to (text-style: $style))]}
2. Using your new Determine Style code.
Note the backslash after the (display:) macro, this is to stop it from adding a blank line to the passage.
(display: "Determine Style")\
The shadow $style[flares] at you!
Comments
You could do something messy like the following, which first randomly determines which style to use, next it checks to see if the style is either 'normal' or something else and re-assigns the $style variable appropriately, and finally uses the $style variable to style the text.
Because you may want to use the code that determines the style to use multiple times you could move the (set:), (if:) and (else:) code into its own passage and call it like so:
1. Create a passage to store the style determining code, I named mine Determine Style. Note the Collapsing Whitespace markup and that there is no line-break at the end of the code, this is to stop it from creating blank lines.
2. Using your new Determine Style code.
Note the backslash after the (display:) macro, this is to stop it from adding a blank line to the passage.