Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Sugarcube] Custom Styles Markup help

I'm having some trouble using the Custom Styles syntax in Sugarcube Markup, according to this page. I want stats to display as a different color as regular text, and to be bolded as well, but it doesn't seem to be recognizing that I'm using a CSS id and class in the Custom Style.

Here's my code in the passage:
@#willpower;.stat;Willpower@@ is the player's ability to resist mental changes.

And here's my code on the CSS page:
.stat {
	font-weight: bold;
}
#willpower {
	color: green;
}

Instead of making it bold and green, it makes it yellow and italics, and includes the "#willpower;.stat;" from the original passage code. The following code does work:
@font-weight:bold;color:green;Willpower@@ is the player's ability to resist mental changes.

I'd rather not have to manually do that every time though, because if I make any changes to the style it's much easier to alter the CSS than alter every occurrence of the stat.

Comments

  • Are you sure you are using the SugarCube 2 story format, it is not the one that current comes with Twine 2.0.8, you have to install it yourself.

    According to the SugarCube 1 documentation (and testing) it does not support the #id version of Custom Styles, which is why you would be seeing the result you are.
  • edited October 2015
    The identifier syntax (the #willpower bit) is a SugarCube 2.x feature. Meaning that, in all likelihood, you're actually using SugarCube 1.x.

    You may simply use a class in place of the ID, however, so you can still do it mostly the way you intended.
  • Oh I didn't realize Twine 2 came packaged with Sugarcube 1. I'll just make each stat its own class. Is there any word on if the online version of Twine 2 will get Sugarcube 2 support?
  • numberQ wrote: »
    Is there any word on if the online version of Twine 2 will get Sugarcube 2 support?
    That is the eventual hope, yes.
Sign In or Register to comment.