So I am controlling a test object's text property from an external text file with this code
def text(): import bge from bge import logic path = logic.expandPath('//') cont= logic.getCurrentController() scene= logic.getCurrentScene() own= cont.owner T= int(own['t']) try: file = open(path+'text_file.txt', 'r') info = file.readlines() own.text = info[T] except: print('error')
it works fine except for if I want line breaks so it doesn't stretch off the box i have it in. for example i have the veriable 't' set to 0 and the first line of the txt doc says "example text for stuff" but i want a line break between "text" and "for". If i was setting the normal text vaule and wanted a break there i'd have the code
own.text='example text\nfor stuff'
but if i type that in the txt file it just displays the line break command (\n). how do i make a line break command from inside the txt file be recognized by python? or is it even possible.