Real Time Text Object; String Input from Script, How To?

So, odd title, I know, but it makes sense in context.

I just learned to create an in-game text object that accepts user input with logic bricks:


I would like to know how to, instead of User Input, use a script to input a String, or an Integer (series).

If you would like more info, feel free to ask. I say thank you to everyone who replies!

If I recall correctly you can do this by setting a “text” game property on the text object.

Something like this:


text_object = bge.logic.getCurrentController().owner
text_object["text"] = "Hello World"

I’m not entirely sure how to set that up, would you mind elaborating? Perhaps a screenshot if you’re able, it would be very much appreciated.

Hello! https://drive.google.com/file/d/0B3GouQIyoCmrbzBQV3RXYjV2ek0/edit?usp=sharing

I did this with logic bricks, no scripting (idk Python :stuck_out_tongue: ) If you want more info, lemme know.

Logic is the easiest way, as trying to handle text input in a script is hard. So, why do you want it to be done in a script?

youle: Thank you! That is exactly what I was going for!

ezio160324: Sure, I’d like to learn as much I can!

sdfgeoff: Well, I’d have to disagree based on what youle showed me. I feel that using logic to connect a script that contains context specific information is a lot easier, especially if I need to re-use that information in different areas. It’s mainly for ease of transport and use, I suppose.

Monster: I don’t mean any disrespect, but I can’t seem to sit still long enough to read it. I’ve tried many times, but to no avail. I just get too distracted.

kepress (select)-------------SetCopyTarget
ray property textable--------/

SetCopyTarget


import bge

cont=bge.logic.getCurrentController()
own=cont.owner()
sens=cont.sensors['Ray']
if sens.positive:
     Target=sens.hitObject
     own['Text']=Target['Textable']

this would be useful for in game help, or?uses ray to grab property from a target,
(text)