Problem with Typewriter

0 votes
asked Mar 12 by Brugtz (440 points)

Hey guys, i need help of all you...

I have this code for make typewriter effect.


<<widget "typewriter">>
	<div class = "typewriter"></div>
	<<set _textArrayLength to 0>>
	<<repeat 0.01s>>
		<<if _textArrayLength gte $args[0].length>>
			<<append ".typewriter">>$args[0][_textArrayLength]<</append>>
			<<set _textArrayLength ++>>

Base code for cookbook of twine... But i have one great problem...


If in the text have any variable (ex. $test) que typewriter effect go print "$teste" and not your value set.

Any method for change this?


I need this typewriter print values too.

2 Answers

+1 vote
answered Mar 12 by idling (8,920 points)

You can integrate the variable into the text before passing it to your typewriter widget like this:

<<set $name to "Johnny Thunder">>
<<set $sentence to "My name is " + $name +".">>
<<typewriter $sentence>>


+1 vote
answered Mar 13 by greyelf (73,550 points)

The Typewriter Effect recipe in the Twine Cookbook is a very basic implementation of that effect.

You may want to switch to using the TypedJS Integration Module that can be found on the SugarCube 2 web-site instead, because that module does support story variables embedded within the marked plain text.