Hello.
Has anyone implemented anything like displaying a caret at the end of the text whilst renpy is typing text?
I would like my game to type at the rate defined by the cps setting but display a caret (ideally flashing) after each character as it's being printed. e.g.
"H█"
"HE█"
"HEL█"
"HELL█"
"HELLO█"
My background image is an old computer so i want the text to look like the computer is typing the text
Thanks
Displaying a caret whilst drawing
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Re: Displaying a caret whilst drawing
Is this for your say dialogues, or for a specific screen?
I'd recommend you do this to a custom screen that's only used at certain point in the game - unless the CPS is high enough - you don't want to annoy your players by making them wait for every single line of dialogues to display character by character if it's slow. I also don't know how fast skipping affects this as well.
With that out the way, I'd done something similar for someone else before using transforms: viewtopic.php?p=486660#p486660
A few differences to consider:
1 - I used linear alpha to fade characters in, you'd want the characters to just appear after a pause
2 - You don't want to fade the characters out again, so you'd get rid of that part
3 - You need a caret - should be doable by adding the caret image to the transform as the first line using contain (anther image that fades away)
4 - This approach won't allow text interpolation, so if you pass in "[variable_name]" it'll output as [variable_name] not what's inside it.
If someone else has a better solution I'd go for that, if you're interested in how to do it with mine (I'm not sure how experienced you are and if the above is enough to push you in the right direction) I can have a go at putting something together. Can't promise my method works that's why I'd like to see if someone else chips in first!
I'd recommend you do this to a custom screen that's only used at certain point in the game - unless the CPS is high enough - you don't want to annoy your players by making them wait for every single line of dialogues to display character by character if it's slow. I also don't know how fast skipping affects this as well.
With that out the way, I'd done something similar for someone else before using transforms: viewtopic.php?p=486660#p486660
A few differences to consider:
1 - I used linear alpha to fade characters in, you'd want the characters to just appear after a pause
2 - You don't want to fade the characters out again, so you'd get rid of that part
3 - You need a caret - should be doable by adding the caret image to the transform as the first line using contain (anther image that fades away)
4 - This approach won't allow text interpolation, so if you pass in "[variable_name]" it'll output as [variable_name] not what's inside it.
If someone else has a better solution I'd go for that, if you're interested in how to do it with mine (I'm not sure how experienced you are and if the above is enough to push you in the right direction) I can have a go at putting something together. Can't promise my method works that's why I'd like to see if someone else chips in first!
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Displaying a caret whilst drawing
As far as I know, this would not be easily feasible to accomplish in Ren'Py.
When Ren'Py displays dialogue or cps based text it first caches a hidden image containing all the letters (glyphs) laid out as the final image would look and keeps a map of the positions of each letter/glyph.
It then reads through that glyph map and reads each one in turn from the cache and draws it (at n cps) onto the image that is shown to the player.
I do not truly know if there is a callback you could patch into that might allow extra code to run on each letter draw cycle.
Theoretically, for Ren'Py to support this internally would be more tricky than it might first appear; remember after all that Ren'Py supports LTR, RTL and perhaps even vertical languages as well as ruby diacriticals etc
Hopefully someone with more knowledge in that area will come along and add more insight.
When Ren'Py displays dialogue or cps based text it first caches a hidden image containing all the letters (glyphs) laid out as the final image would look and keeps a map of the positions of each letter/glyph.
It then reads through that glyph map and reads each one in turn from the cache and draws it (at n cps) onto the image that is shown to the player.
I do not truly know if there is a callback you could patch into that might allow extra code to run on each letter draw cycle.
Theoretically, for Ren'Py to support this internally would be more tricky than it might first appear; remember after all that Ren'Py supports LTR, RTL and perhaps even vertical languages as well as ruby diacriticals etc
Hopefully someone with more knowledge in that area will come along and add more insight.
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Displaying a caret whilst drawing
Hi kivik. THanks for tte help. Your approach makes sense. This is only at a specific point in the game so doing this via a screen would be fine.
I'm pretty new to Renpy. The part i'm struggling with is #3 in your comment. specifically aligning the caret image to the character just rendered. I couldn't see from the documentation how to do this?
I'm pretty new to Renpy. The part i'm struggling with is #3 in your comment. specifically aligning the caret image to the character just rendered. I couldn't see from the documentation how to do this?
Re: Displaying a caret whilst drawing
There won't be documentation for it as it's not a designed behaviour. I was merely using the ATL to simulate the appearance.
Look up the contains statement, make it your caret (make it disappear after a predetermined time), then use the contain statement to include it in the transform at the start. So it'd look something like this (pseudo code only, not tested):
I don't actually know if this will work, it's just a theory of how it might work. If I have time later today I'll test it myself, but feel free to have a go meanwhile and let me know how you get on
Look up the contains statement, make it your caret (make it disappear after a predetermined time), then use the contain statement to include it in the transform at the start. So it'd look something like this (pseudo code only, not tested):
Code: Select all
transform caret_effect(pause_time):
contains caret
pause pause_time
alpha 1.0
Re: Displaying a caret whilst drawing
i haven't quite got this working, but i think you've put me on the right track. I'll feed back once I have something that is working. thanks.
Who is online
Users browsing this forum: MisterPinetree, Red-Baby