0 votes
asked by (2.4k points)

Hello there, 

I have 10 images within my images folder named from str_1 to str_10.

What I would like to achieve would be to have the image fitting the strength of the character to be printed.

I tried something like this, with huge hopes of success :

[img[`"images/str_" + $strength + ".jpg"`]]

The idea being than, when processed, it would be read as 


(Or any number $strength is at the moment).

Obviously, it didn't work...
I then tried to apply this to a variable, to test if it actually did anything. It doesn't.

<<set $imgStrength to `"images/str_" + $strength + ".jpg"`>>

Didn't do much for me. 
So now I'm left wondering : what is the correct way to achieve this goal ?

Thanks a lot !

1 Answer

+1 vote
answered by (131k points)
selected by
Best answer

You were trying to use backquotes \ graves characters to force the pre-evaluation of your image name releated expression, and unfortunately you can only use those characters do that for Macro Arguments.

However all isn't lost because you don't need them to solve your issue as you can simple do the following

[img["images/str_" + $strength + ".jpg"]]


commented by (2.4k points)
Damn it. I was so close.
Thanks !!
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.