The mod that I want to create is rather ambitious... but once I can get the hang of a few basic things, I simply have to change a few variables and it will become something quite excellent. Unfortunately, both of those basic things are seriously frustrating me at every turn. I have very little programming experience, but I did learn C# and Unity well enough to be able to create a 'randomized' Heroes of the Storm drafting program. I learned the basics and it worked well. ...very little of that knowledge translates to Blender, Python and LUA, apparently. Maybe I just didn't have enough of it to transfer... Anyway, here what I'm trying to do:
I want to gather the name of a colonist that died. The Cemetary mod gives a great example of how to query this. I now want to:
1. export the name into a simple text file using LUA.
2. import the name into a python script from within Blender.
3. change the text of an already-placed text box within Blender.
I'm thwarted at step #0.5: I figure it's easier to read a file than to write to a file... so I created a text file and tried to get Blender to read it... the end result was that Blender would never acknowledge the directory within which I had placed the file. I even used the // to identify the 'current directory'. I think that was trying to find the text file within the .blend file, thus it could never work because I cannot put a txt inside a blend. ...and if I put in my local disk directories... it would never work on anyone else's computer, would it? So, that's the 1st issue: how do I read a file. Once I figure out directories, I can continue on to find my next issue.
tl;dr How do I get Blender to read a text file and create a string from it? In particular, what directory should the file be in and how do I call to that directory?
I want to gather the name of a colonist that died. The Cemetary mod gives a great example of how to query this. I now want to:
1. export the name into a simple text file using LUA.
2. import the name into a python script from within Blender.
3. change the text of an already-placed text box within Blender.
I'm thwarted at step #0.5: I figure it's easier to read a file than to write to a file... so I created a text file and tried to get Blender to read it... the end result was that Blender would never acknowledge the directory within which I had placed the file. I even used the // to identify the 'current directory'. I think that was trying to find the text file within the .blend file, thus it could never work because I cannot put a txt inside a blend. ...and if I put in my local disk directories... it would never work on anyone else's computer, would it? So, that's the 1st issue: how do I read a file. Once I figure out directories, I can continue on to find my next issue.
tl;dr How do I get Blender to read a text file and create a string from it? In particular, what directory should the file be in and how do I call to that directory?