Scripted dinamic text appearing animation

I am trying to write a script that will make a dynamic text to appear at 1 symbol per predetermined time unit(e.g. 1 second). Like text would be slowly written.
By using time.sleep() the whole BGE halts.
I tried using built in Timer, but that does something similar.
When I try to use threading I got a lot of errors, probably because I am a beginner at scripting.
What technique or module would you suggest to use?
I hope you understand what I am trying to say here with my clumsy English skills.

Stalling your script will stall the whole flow of the game engine since the BGE lets all logic complete every game frame.

You can either only call the script when you want to add a symbol (use a timer or counter property), or you can have the timer or counter within the script itself and just return without doing anything if the appropriate time hasn’t been reached yet.

I wrote a script for this a while back, but never published it online. Here it is:

cont = bge.logic.getCurrentController
own = cont.owner
numSoFar = len(own['Text'])
if numSoFar < len(own['toSay']):
    own['Text'] += own['toSay'][numSoFar]

Each frame that this script is called, it will add another character (ie, run it from an always, repeat about 4 or so).
There should be two properties in the object running this:
‘Text’ - string, leave blank
‘toSay’ - Put whatever you want it to say in here.
***How this script works:
It get’s the length of the current displaying text, and then uses that number to get the next character to add.

Cool beans :slight_smile:

This would be the ultimate solution, you can animate the text appearing with this addon:

^ That’s for Blender, not for the BGE, unless you mean an equivalent script or function for the BGE. But simply incrementing the text property as sdfgeoff wrote should work fine for most purposes.

Ah, my bad, hadn’t tried it for myself, just figured you could replay the animated in BGE with no problems… too bad that could certainly be useful in BGE.