Replacing text by keypress, using <<type>> macro

Twine Version: 2.10.0, SugarCube v2.37.3

Hey there,

first time poster here and English is not my first language, so I hope I’m doing everything right. :slight_smile:

I am using the latest versions of Twine and Sugarcube, working on a prototype to achieve a text display for dialogues inspired by Visual Novels. So far, I got the <<type>> macro working with a symbol (an arrow, for example) added to the end of each line after the typing effect stops, to indicate the need of a user input to proceed. This user input is done by pressing any key. No problems so far.

However, the next steps are becoming a bit too complicated for me, as I don’t have any knowledge for the use of javascript and I think this might be the right direction to take …

The dialogues used with the <<type>> macro are in the same passage, being revealed sentence-by-sentence, which works fine. However, I can’t wrap my head around the right solution to replace the text… currently, each new sentence is revealed in a new line under the sentence before. Instead, I would like to replace the first sentence with the second one and so on, just like you see in Visual Novels or JRPGs.

I already looked at the <<replace>> macro, but so far any example I could find uses a <<link>> in combination with this. I’ve tried my best to find a solution for this via google and different forums, but anything I’ve found relies on clicking a <<link>>.

Could anyone please tell me how I can get this to work with a keypress? I’d be very grateful for any help! <3

1 Like

If your objective is to emulate the Dialogue area that is found in (Visual Novel based) projects built with frameworks like RenPy and RPG Maker, then you might want to consider using one of the following SugarCube third-party libraries:

Note: If you do intend to constantly use what is commonly known as the “typewriter” effect to display your project’s dialogue, then you may want to consider adding the ability for the end-user to alter the delay between characters and for them to be able to disable the effect. Because not everyone reads at the same rate, and many people don’t like waiting for the dialogue to appear.

1 Like

Thanks a lot for the great recommendations, Greyelf. The emulated effect fits the project exactly like intended! :slight_smile:

Additionally, there is another solution using a <<widget>> on r/twinegames (if you’re interested) and I am really happy to have several options now for the effect I want to achieve.

Thank you also for reminding me about a skip option for the typewriter effect. Fortunately, the dialogue in my game will be sparse and I just use the effect fo a more dynamic feeling while interacting with NPCs.