Hi there,
I really think I'm a fool for asking this, but I just can't seem to solve this puzzle no matter what I try and where I've looked.
I'd like to use recurring custom named styles in my (Harlowe) project, and I've been doing so with code snippets like this:
(set: $robotrumble to (font: "Courier New") + (text-style: "rumble"))
and text entries like this:
The robot says $robotrumble[Intruder Alert!]
I'd like to use stylesheets to avoid the need to cut/paste every new text style into every passage and ensure they're all global and identical, but I can't make it work. I've tried making a new passage, setting the name and tag to 'stylesheet' (no quote marks), I've tried using HTML type tags, I've tried many many permutations and I can't get the styles to be applied universally to all passages. I've tried accessing the Stylesheet via the "Edit Story Stylesheet" menu item in the popup next to the project name, but to no avail.
All of the tutorials I can find seem focussed on editing the style for existing styles like body and passage, not creating your own new ones.
I feel like this should be really simple, but I'm just missing something!
Any pointers?
Comments
Where in the Story Stylesheet you write:
However, if there's no way to achieve something like that, then the span tags will have to do, I suppose?
Edited to add: Is there anywhere that has the HTML/CSS code for special effects text like rumble, blur, blurrier, etc.?
note: the following example is using Twee Notation, lines starting with a double colon indicate a new passage, the text on the same line as the double colon is the new passage's name and the lines directly after the line with the double colon is the new passage's contents.
Greyelf, I copied your code above, and broke it into three passages named FIRST, SECOND and THIRD, and ensured that they linked through to each other as per your -> codes.
I ensured that the first had the $robotrumble style set, and it did not propagate to the subsequent passages. All I would get would be something like this:
The robot says 0This should still be styled like the First passage!
So I was extremely frustrated, and dug further! I made a new story with only those passages, in case there was junk code elsewhere in my original story that was messing things up. Still no luck.
I then tried clicking through the links... and the styles in the second and third passages worked! It was then that I made the realisation that I'd been checking text styles in individual passages using the Debug button. When I followed the links through, the styles worked, but when I accessed a passage directly using Debug, the styles failed.
So thanks to both Claretta and Greyelf for assistance and helping me come to this realisation! I guess this means that all $styles need to be implemented in the root/origin passage, or they won't work in subsequent passages. Is this a known facet of this kind of style?
Thanks again!
It's a thing with variables in general. They must be set first. If they're not set, they don't exist.
Because you were starting from the specific passages that came after the initial setting, your story never set those variables.
Thanks again for your help!