Macro does not exist error

Twine Version: 2.3.15
Story Format: Sugarcube

So I have been struggling with creating a speech box in my game for days now and I’ve looked through other posts and they just never seem to work for me so I’m assuming there’s definitely some user error on my part or I looked over something in the code.
In my StoryInit I have this:

<<character "lisa" "lisa.png>>

And in my first passage I have some random text for “Lisa” to say to test it out:

<<audio phone_ring loop play>>
<<lisa>>Get him!<</lisa>>
[[Answer it]]

Whenever I test it out I get this error:

Error: macro <<lisa>> does not exist

I can’t figure out what’s wrong with it, does anyone have a clue?

Welcome Ari!

If I understand you well, you want to create a macro that will render an image when the reader will enjoy the story.

Here’s what I would do: a <<widget>> https://www.motoslave.net/sugarcube/2/docs/#macros-macro-widget
First create a special passage where to store your widget. You need to add the widget tag to this passage.
With Sugarcube 2.36+ this should work (not tested, as I’ve not upgraded to Sugarcube 2.36 yet):

<<widget "character">>[img[_args[0]+'.png']]<</widget>>

Before Sugarcube 2.36

<<widget "character">>[img[$args[0]+'.png']]<</widget>>

The only difference is from 2.36 on Sugarcube asks to use _args instead of $args. Note that, at the time, the pre 2.36 $args should work with 2.36

This done, in any passage you can call for your widget.

<<character "Lisa">>

Of course, you need to have your picture in the same repertory as the html file. If not, you’ll have to enter the relative address of the picture, exemple:

<<widget "character">>[img['Images/'+_args[0]+'.png']]<</widget>>

I hope I’ve answered your question, if not don’t balance to reformulate!

Based on the fact you’re trying to use a <<character>> macro call in your project’s StoryInit special Passage to define a ‘Character’ named Lisa, and that you’re expecting a macro alias named <<lisa>> to also be created, I’m going to assume you’re trying to use the third-party The Speech Box System addon created by Chapel.

Before you can use the macros of that addon you need to the content of the Minified JS file to your project’s Story JavaScript area, and the contents of the Minified CSS file to your project’s Story Stylesheet area.

The original links to both of the above mentioned files can be found in the documentation of the The Speech Box System

1 Like

You’re missing the last ". Look at it carefully:

<<character "lisa" "lisa.png>>
1 Like

Thanks so much! Just got it to work :slight_smile: