How to access an internal textfile in runtime (2.49b)?

Hi there,

does anyone know, how to access an Blender internal text file in BGE 2.49b without Blender.Text ?

I would like to have the option to keep an configuration file in the Texteditor without the need to make it external.
Blender.Text is not known when using runtime.

Thanks Monster

One way would be to create python controllers in ‘Script’ mode for each text file and access the controllers’s script property.

ob = GameLogic.getCurrentScene().objects["OBTexts"]
texts = dict(("#CONTR#", 1)[0], c.script) for c in ob.controllers)
print texts['settings.ini']


internal_ini.blend (36 KB)

Edit: Never mind. Supersock’s solution is better.

That is my workaround.
It has some disadvantages:

  • an additional controller is needed
  • it produces compile errors when the file content is not python code (that can be avoided by surounding the content with ‘’’)

beside that it works fine