I want to make a game that will access the hard drive. I want it to be able to open music files, text files, move them, stuff like that. I really want to use the command line and the terminal. Is any of that possible in Blender, or do I have to use operating system specific programming languages and game development software?:ba:
there’s some “system” possibilities…
The “CD” Logic Brick to play tracks from a…CD
The “Game” Logic Brick to access some “data” from HD
And there’s some “Save/Load” Python scripts available in the Resources forum!
And I guess that you can use “Python scripts” to handle “system calls”…?
i think a better study of ‘os’ module and other modules in python can solve most of your problems.
there are so much functions to use with and
python scripting is kind of cool.
you know how to use python scripts in blender,right?
you may need installed python for other complex scriptings
I didn’t know I could do System calls with Python. That’ll be cool. I dont really like Python, cause it’s not a strictly structured language like Java, but I know that Blender uses Python. Does/can Blender use other languages?
Here’s some Python BGE help:
I looked in the documentation real quick and didnt see anything like fileMove or fileCopy… Stuff like that. That’s what I’m looking for.
What I would recommend is to do some searches for how to do the things you requested in Python, and not strictly the BGE.
Good idea, Moguri. Thanks.
In python you can do anything you could do in a terminal with the os module; use “os.system” and then your command:
import os os.system("mkdir newdir") os.system("rm newdir") os.system("firefox")
These would create a new folder, delete it, and launch Firefox, respectively. Of course, as I am running Linux, these are Linux commands; your commands may be slightly different if you have Mac or Windows.
OK. Thanks for everyone’s help. I’ve gotten my scripts all done. Now how can I call them in blender? I have all my functions laid out in one file. Is there some spot in Blender where I can import that .py file and then call functions from it?
you can use the python controller in module mode.
BGE callabel functions in a file should be def callMe(cont):.
cont is the current controller.
Just enter “Modul.callMe” in the Module field.
So there’s only certain functions in Python that are callable?
Kinda sorta. You can’t call normal Blender functions (like those built into Blender for things like automation) while the Game Engine is running. However, I’m pretty sure that any other Python modules (and their functions) are callable with no trouble. This includes your own modules, or ones you install from a third party, as long as you know where to put them.
OK. I know programmers in general are all for learning how to do-it-yourself, but an actual example would help me out greatly. That’s all I need in order to get going. If anyone could make a quick .blend file that had a controller that called a simple python function, I’ll be set. If you can, can you make a function specific to Python and not specific to blender, like os.move, or some arrays and variables or something like that