Calling objects & Python runtime files

Exactly which files do I need to operate a python module driven exe file on another computer without python installed? I am using the urllib.py module but it calls on the socket.py module and a bunch of other stuff. I had to install python 2.3.3 on my freinds computer in order to show him my project.

Also –

Is is possible to call on objects outside of getCurrentController
Like where on cube1 where enter is pressed it runs data.py but in data.py I would like to make changes to cube2. How would I go about doing this? Thanks for all your help in advance!

:smiley:

Well if you want to run a blender game using some python modules that aren’t inside blender itself, you should install Py2Exe.

When you create a setup and place only the py files and the setup.py and run the Py2Exe function inside python afther install, it will make a dir where it copies all the py modules in it which you need to run those py files you made. Then add these in the same dir as the runtime file. Now people without blender or python can run the game.

The 2nd question?
Can you explain it more, I don’t know what you want to do. Read data that’s used for cube 1 into cube 2? What kind of data do you want to read, and what do you want that cube2 to do with that data? Give more examples. :slight_smile:

http://www.pryjon.com/sensorstuff.jpg

Here is my logic brick setup.

Lets say that socket.py in lesser words looks something like this:

plane = getowner…

And lets say that plane has a property of “Text”

So fine and dandy I can change the property of plane

plane.text = “Hello”

Right?

This all works so far.

What if I want plane to take the home key, activate socket.py, and have socket.py tell plane2.text what to do? There must be another command besides getcurrentactuator because I dont want the current one. I want a different one.

Ok, I still don’t get it. Are you trying to make your game playable over a network?

Mmh let’s do something.
If you get information from a cube1 and you want that to be set on cube 2 you can do a lot of things.
If you use GameLogic and do something like:

player = cont.getOwner() (player is always sensor named player, linked to script)
GameLogic.data = player.getPosition()

Now you’ve coppied that data into GameLogic inside blender. When you call somewhere else:

import GameLogic
data2 = GameLogic.data
print data2

It sprints the data. So if you actually want to set the same position to a cube that runs another script. Do just import GameLogic and call the same variable. Besides that, this script makes you able to transport data inside a blend file to an another script inside the same .blend. If you want to transport data from .blend1 to .blend2, you can use a script to save the data to a text file or something and let .blend2 load that txt file and read the information. Btw this is really slow, well actually the cube2 in .blend2 will move really shocky. If you just use it for properties, it works well.

If you want to export data directly from .blend1 to .blend2 without saving but just send the data directly as euh… data instead of save to file and load file. You can use socket. It’s really handy, but that also needs a lot of works to get it work fine, because if you script it wrong the cube 2 in another blend file moves shocky as well.

Now I talked all the time about positions, but you can do the same with just normal text or properties. If you send properties with socket, the best thing to do is send the properties with 1 or 0 (on or off) and use the a script in the receiver to split it up and handle which 1 or 0 is doing what.

If you keep in mind how your telephone, internet and pc works using thins for on or off or just another stuff, you can always find a solution. The hard part is get it actually working, but that takes me even hours to do that.

:-?

pryjon you graphic did not show up.

I suppose if I ask a simple question in a complicated way I will get a complicated answer in simple way!! :smiley:

Thanks and that info will come in handy here in the next few steps.

I have re-thought my question. Here is what I want to do. In one script I want to change the position of several cubes. How do I call those cubes?

cube1.setPostion([x,y,z])
cube2.setPostion([x,y,z])
And so on…

Again, thank you for the help!

We are creating an online 3d database. It will contain mail, news, and other things that it pulls from an online database. That part is already figured out though. My problem is being able to alter the properties of different objects from one script, so that I dont have to rely on the “current” controller that the script is attached to.

Sorry. I suppose it is not important anymore. I don’t know what happened. Thanks anyways! :smiley: