Howdy, Stranger!

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

Anyway to display an image in StoryTitle [SC2]?

Is there any way to display an image in the StoryTitle passage using SugarCube 2? When I use...
[img[logohalf]]
I get an error saying that the story title cannot be null or empty.

Comments

  • SugarCube requires a valid textual story title (it's used as the basis for various storage tokens). In Twine 1, the story title is handled via the StoryTitle special passage, which is why you cannot simply assign an image to it.

    I assume you want to replace the text title completely with image logo/title. If so, then the easiest thing to do is:
    1. Put your story's image logo/title into the StoryBanner special passage.
    2. Put your story's normal textual title into the StoryTitle special passage.
    3. Add CSS to hide the #story-title element, which is where StoryTitle is displayed.
    The CSS to hide the normal title would look something like the following:
    #story-title {
    	display: none;
    }
    
  • Ah, that also explains why I was getting some interesting effects when I tried to put a small amount of code in there (I wanted the text to change to the logo when the game was in progress, but it's not a big issue for me at present).

    Thanks for answering :)
  • You should be able to do the text-to-image swap within the StoryBanner special passage. Though, the text formatting on its element (#story-banner) isn't exactly like the #story-title element, so you'd have to add some extra CSS to get the same effect.

    The #story-banner CSS to mimic the style of the #story-title element would look something like the following:
    #story-banner {
    	margin: 0;
    	font-size: 162.5%;
    	font-weight: bold;
    }
    

Sign In or Register to comment.