Howdy, Stranger!

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

Using CSS styles around specific words in SugarCube

edited November 2014 in Help! with 1.x
Yet another "this worked in Sugarcane but not in SugarCube" threads, sorry. I have a whole lot of styles that I defined in order to change the font color of specific words. For example:

.forest {
font-size: 1.5em;
color:darkgreen;
}

And then I use it in a passage like this to turn "forest" the forest color:



Does this syntax not work in SugarCube? I know I could apply it to an entire passage by using tags, but there are some cases where I need to apply it only to a single word or phrase within a passage. How do I do that?

I'm also running into an issue where I tagged some of my passages in order to apply styles, but now suddenly none of the links in one of my other passages will respond. They're colored like links, but clicking on them does nothing. What's going on?

Honestly, SugarCube is even more opaque to work with than Sugarcane, whose documentation seems to be all over the place, but I really want the saving functionality, so I'm trying to get the rest of what I'm doing working.

Edit: I should specify that the passages that don't work are all ones that contain setter links, of the form [[Do Something|Do Passage][$i = $i + 1]]. Does that syntax also not work in SugarCube? According to the SugarCube docs page (http://www.motoslave.net/sugarcube/docs/), that syntax should work, so why are these passages broken?

Comments

  • Although there are many similarities in macro names and features supported between the different story formats they are not the same.

    @ styling shortcut, so you need to add the <span> tag yourself.

    @@.forest;forest@@ is a short cut for <span class="forest">forest</span>
    SugarCube expects all variables to be assigned a value before they are used in arthritic or used in a comparison, are you sure you assigned a value to $i before using it in the link [[Do Something|Do Passage][$i = $i + 1]]

    The following code works for me using SugarCube:

    :: StoryInit
    <<set $i to 1>>

    :: Start
    [[Do Something|Do Passage][$i = $i + 1]]

    :: Do Passage
    Value of $i is: <<print $i>>
  • Thanks, that's kind of what I figured about the span syntax, but I was having a really hard time finding any documentation that would explain it, and it was such a nice shortcut that I was surprised that a fancier setup would get rid of it.

    I never thought about initialization since Sugarcane was so cavalier about it, but it's probably better practice to make sure to initialize, so I'll do that and that will probably fix the problem.

    Thanks!
  • telyni wrote:
    and it was such a nice shortcut that I was surprised that a fancier setup would get rid of it.

    @ style syntax is only a relative recent addition to Sugarcane and was never in SugarCube.
Sign In or Register to comment.