0 votes
by (250 points)

(using tweego v1.3 and sugarcube v2.24)

Hey there, sorry to bother anyone, but I couldn't find a clean and proper way to do an append how I want, so I wanted a bit of wisdom shined down on me.

I am trying to append some text to a passage, but I want to do it in a particular way.
Currently I have been doing it this way.

<span id="extra_info">The small<<linkappend "brown" transition>><<append "#extra_info" transition>>

Its fur is a rather fluffy, dark chocolate type of brown.<</append>><</linkappend>>, dog.</span>

It's running in circles, excited to see you.

As you can see, I have set up a <<linkappend>>, and have placed, within it, an <<append>>.

My goal is to have a single click text, that can append extra information precisely where I want it, not just directly after.

For this, I needed append, so that I could have a selector, so I could choose exactly where the appending happens. However I still needed the the single use link that deactivates, and for this I needed linkappend, which doesn't have the ability to use selectors (or at least I didn't see it in the documentation).

This seems like a novice work around, and I was wondering if there is a better way to get the same result.

Oh also, as a secondary problem to my workaround, it seems I can not get the text to transition, which I want to happen. It is immediate and abrupt, even with the transition keyword attached in both append and linkappend.

Thank you for your time.

1 Answer

0 votes
by (159k points)
selected by
Best answer

Does the following do what you want to achieve?

The small \
<<link "brown">>
	\<<replace "#extra_info" t8n>><br>Its fur is a rather fluffy, dark chocolate type of brown.<br><</replace>>
\<</link>> dog.
<span id="extra_info"></span>
It's running in circles, excited to see you.


by (250 points)
Yes, this seems to have the same end result as the way I was doing it. Thanks!

 Sadly, it seems it also does not transition the text like I was expecting it to do.

Perhaps transition isn't what I think it is? I want the text to fade in like it does when a new passage is displayed. I haven't modified any css that involves transitions if that matters.

I attempted this on both Google Chrome Version 67.0.3396.99
and on Firefox 61.0.1.
by (63.1k points)
Are you using an old version of SugarCube?

Transitions for the DOM macros (<<replace>>, <<append>>, etc) were added in v2.25.0.

Note: the version of SugarCube packaged with Twine is rarely the latest version for very long.
by (250 points)
edited by
ah, i didnt notice that they were v2.25.0. I am using v2.24.0. That would explain it! Should have paid closer attention in the documentation. Sorry about that.