Need help with addCharacter

Twine Version: 2.3.16
Story Format: SugarCube 2.36.1

Hello, I am trying to do speech box system with macros by guide: Custom Macros
And I am new to all of this and I can’t understand or find any information on how to addCharacter and where to?

From the linked Custom Macros page:

This macro will only function if run before the story starts, that is before the first passage is loaded. The StoryInit special passage is therefore the best place to define characters.

StoryInit is a specially named passage whose contents execute before the story loads. You create it by adding a passage in the normal way and naming it StoryInit. You need to put all your <<character>> macros there.

1 Like

Okay, I think I got it but why <> showing up and StoryInit on the top when I test it? Also, I can’t put pictures out of my directory (pc), right? Cause it didnt show up when i tried and the second character is with link.

The <<a>> and StoryInit etc. are because you’re in test mode: if you choose Test rather than Play, SugarCube will show you a bunch of the stuff that’s normally invisible.

You can use pictures on your PC, but they won’t work from Play or Test, you’ll have to Publish it as an html file and put it in a directory along with the images.


Okay, so I created zip file with photos and html file of a game called index.html. But photos that were included in zip and used in game still doesn’t show in game.

What are you doing with the zip file? Uploading it to (I’m just guessing here)

If you’re trying to test on your computer you’ll need to:

  • Have a folder with the photos.
  • Link to the images in Twine/Sugarcube [img[photo1.png]] or <img src="photo1.png">
  • Make sure you get the spelling and capitalization the same in Twine as the filename! Capitalization mistakes may not matter on your computer but they’ll break when you put it on a web server: this gives people trouble a lot.
  • Publish the story to an html file in the folder with the images.
  • Open the html file in your browser (double-click the one in the folder to make sure you’re getting the right one); should work.
  • Then if you zip it up and you’re uploading to it should also work (the file needs to be named index.html for Itch).
  • Link to the images in Twine/Sugarcube [img[photo1.png]] or <img src="photo1.png">
    Do I do it on StoryInit, css stylesheet or where?

Also in zip file does it matter if photos are in folder or separate ?

Link to the images in the passage where you want them to appear.

Yes, they have to be at the (relative) address where the Twine code expects them to be. In the zip file or in the file system. If you had:

images/ folder

Then you could make it work, but you’d have to refer to the image as
[img[images/photo1.png]] in your Twine code. (177.1 KB)

1 Like

My zip file goes:
photos (folder)

If I try to put [img[photos/monkey.jpg]] in my passage it just displays a photo and chat box ‘a’ still stays blank. Tried creating another passage just to put those [img[photos/monkey.jpg]] but still nothing, I don’t get it.