There are several ways to do it, though the most robust way is probably the specific GreenSock plugin designed for this, which works best in SugarCube for Twine 1.4.2 (to my knowledge the only story format that can reliably use GreenSock animation due to its user library feature).
Other story formats do have their little Javascript macros you can write into your story to achieve the effect but GreenSock gives many more options.
To do this you create a userlibrary.js file in the SugarCube targets directory that contains the GreenSock source javascript library, then put the text you want typed out inside a <<script>> <</script>> macro containing the inline GreenSock code.
There's also Typed.js (a jQuery plugin), which can simply be pasted into the Story JavaScript (so should work for all Twine 2 story formats).
@TheMadExile, would you be so kind as to attach for us an example HTML file with this and the flashing cursor using SugarCube and, if different, Harlowe? I'd appreciate it. :-)
Well, I've already written a Typed.js integration module for SugarCube for someone else (which is the only reason I knew about it; it's on SugarCube's website), so I'm just going to reuse that here. The module's purpose is to make using Typed.js easy. It's a fairly simply module, so it shouldn't be too difficult to port to Harlowe, though without the display hooks SugarCube offers it will require some additional setup.
The CSS is identical and the actual usage is similar, though the SugarCube module triggers on a specific class and the Harlowe module triggers on a specific hook (since I figured the hook would be more idiomatic).
I've attached an archive for SugarCube 2 and the Harlowe 1.1 beta (1.0.1 is too busted for me to bother with). Assuming that Twine 2 has decided to allow me to save my work today, hopefully, they include everything you should need: Typed.js, the integration module, styles, a demo, and instructions.
I've attached an archive for SugarCube 2 and the Harlowe 1.1 beta (1.0.1 is too busted for me to bother with). Assuming that Twine 2 has decided to allow me to save my work today, hopefully, they include everything you should need: Typed.js, the integration module, styles, a demo, and instructions.
I've attached an archive for SugarCube 2 and the Harlowe 1.1 beta (1.0.1 is too busted for me to bother with). Assuming that Twine 2 has decided to allow me to save my work today, hopefully, they include everything you should need: Typed.js, the integration module, styles, a demo, and instructions.
TheMadExile,
I found your post while looking for a way to achieve the same "words-typing-themselves-out" effect that Dorgam describes-- and judging by the comments of the people before me, it must've been a great solution-- but when I attempted to download your Harlowe archive, it just took me to this, which I'm assuming has been partially devoured by the forum software or something since you posted it. Would you happen to have another copy of the archive on hand-- and would the contents work with Harlowe 1.2.2, or would they need significant modification first?
[…] but when I attempted to download your Harlowe archive, it just took me to this, which I'm assuming has been partially devoured by the forum software or something since you posted it. […]
You need to right click on it and save as/save link as—the forum software doesn't give you a proper download if you just click on it.
[…] and would the contents work with Harlowe 1.2.2, or would they need significant modification first?
It should work in every version of Harlowe, save possibly the very first. However, to put your fears at rest, I just tested it in Harlowe 1.2.2 and it works fine.
[…] but when I attempted to download your Harlowe archive, it just took me to this, which I'm assuming has been partially devoured by the forum software or something since you posted it. […]
You need to right click on it and save as/save link as—the forum software doesn't give you a proper download if you just click on it.
Much appreciated. Realizing I was supposed to save and then import the files as stories has really broadened what I can do with Twine, thanks to helpful folks like yourself and others posting code on the forums!
Comments
Yes. There is.
What format are you using?
https://greensock.com/TextPlugin
Other story formats do have their little Javascript macros you can write into your story to achieve the effect but GreenSock gives many more options.
To do this you create a userlibrary.js file in the SugarCube targets directory that contains the GreenSock source javascript library, then put the text you want typed out inside a <<script>> <</script>> macro containing the inline GreenSock code.
For something a little less robust but much simpler to use, you can use Leon's typewriter Javascript for SugarCane/SugarCube: https://www.glorioustrainwrecks.com/node/5161
Small, but important, correction. The user library file is actually named userlib.js.
The CSS is identical and the actual usage is similar, though the SugarCube module triggers on a specific class and the Harlowe module triggers on a specific hook (since I figured the hook would be more idiomatic).
I've attached an archive for SugarCube 2 and the Harlowe 1.1 beta (1.0.1 is too busted for me to bother with). Assuming that Twine 2 has decided to allow me to save my work today, hopefully, they include everything you should need: Typed.js, the integration module, styles, a demo, and instructions.
Wow, TME! Thanks a lot! :-D
I found your post while looking for a way to achieve the same "words-typing-themselves-out" effect that Dorgam describes-- and judging by the comments of the people before me, it must've been a great solution-- but when I attempted to download your Harlowe archive, it just took me to this, which I'm assuming has been partially devoured by the forum software or something since you posted it. Would you happen to have another copy of the archive on hand-- and would the contents work with Harlowe 1.2.2, or would they need significant modification first?
Thanks!
It should work in every version of Harlowe, save possibly the very first. However, to put your fears at rest, I just tested it in Harlowe 1.2.2 and it works fine.
Much appreciated. Realizing I was supposed to save and then import the files as stories has really broadened what I can do with Twine, thanks to helpful folks like yourself and others posting code on the forums!