Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.9
Story Format: Sugarcube 2.31.11
Hi, I’m having a little bit of trouble converting some scripting from Harlowe to Sugarcube. Essentially, I had it set up so that I had hover text, with the contents of that being pulled from a datamap based on a variable. So essentially in the text:
The green (set: $lore to "moss")(display: "lore") carpets
Which would call to a passage where something like this was set up:
(set: $_lore to (dm:
"moss",
"You've not seen anything like it before. Nothing in the guide matches it."
))
(set: $_description to $_lore's $lore)
(print:'<span class="lore" lore="'+$_description+'")>'+$lore+'</span>')
I’ve managed to replicate it in Sugarcube for the most part. In the passage it’s this:
<<set $lore to "power">><<display "lore">>
And in the lore passage it looks like this:
<<set $_lore to {
"power": "hello",
"mobility": "trust"
}>>
<<set $_description to $_lore.$lore>>
<<print '<span class="lore" lore="'+$_description+'">'+$lore+'</span>'>>
However, I can’t get the $_description to set at all. Essentially, I’m trying to set it based on a variable and that obviously works in Harlowe but not here. I’ve tried a few different ways of expressing it, but to no success.
This isn’t the only place where I’d like to be able to do a similar function. At the minute I’m getting around that with a load of if statements, essentially I’m trying to search a game object based off of a variable - using that to find the right entry based on its string and then pulling out its associated data.
Is this possible? Is there another way around it?