I'M TIRED OF LOGIC BLOCKS!!!

:smiley: Well, I’m tired of logic blocks. they’re so messy…
SO I’m going to use python instead. :smiley:
But First of all, how do I use an sensor in a conditional statement, and second of all, how do I “perform” an actuator?

And where can I find some python docs?
I’m really looking forward to being free of the tangled webs of logic bricks. :smiley:

And where can I find some gamepython docs? I heard of a recent one that kester(or jesterking, I don’t know which) wrote…

Good choice. I now use python scripts exclusively for all my work. It’s far easier to debug and modify a python script than a whole interconnected mess of logic bricks. Your workflow will be much more efficient using python, at least in more complex games.

Whilst python scripts run slower than logic bricks, this difference isn’t noticeable in all but the most extreme setups. You just need to make sure the script is efficient with a good setup of nested if statements, and not executed more often than needed.

The documentation can be found on the blender.org site, under documentation. It’s the Game Logic Python API you want.

Generally it’s a good idea to look at other scripts, it’s a fast method of learning if you understand the basics of programming.

Thanks! And my Game-Character setup is EXTREMELY complex.You can only see all of it if you zoom out ALL the way in a 1024x768 fullscreen window. And yes, I know a lot of java and a bit of C++, so It should be relatively easy. Thanks, again! :smiley:

maybe we should figure out a way to orginize the logic brinks and somehow make them easier to read? but how would they be orginized?

Vertical-sliding columns. ANd I tried the python. It won’t work.

huh?

okay, so the problem I see with python is that it can’t test if this is the first pulse from a sensor [either true or false], just if the sensor is true or false

so you must set up your pulse modes so that the script only runs in that situation if that is the case

python scripts run on all pulses [true and false, from all sensors they are connected to]

well, anyway, here is some code to get you started


# using this you can get the linked sensors and actuators
controller = GameLogic.getCurrentController()

# getting a sensor by name
sensor1 = controller.getSensor("keyboard")

# getting a list of sensors
sensorList = controller.getSensors()

# the same things work with actuators
actuator1 = controller.getActuator("moo")
actuator2 = controller.getActuator("run")
actuatorList = controller.getActuators()



# to send a true pulse to an actuator
GameLogic.addActiveActuator(actuator1, 1)
# false pulse [it sometimes does something]
GameLogic.addActiveActuator(actuator2, 0)

# to test sensors:
if sensor1.isPositive(): print "moo!"

# there is no isNegative() as far as I know, and as I mentioned you can't tell if this is the first frame the sensor is positive as far as I know in python.

well anyway, read up on the properties of various python things in blender (2.23) at http://www.geocities.com/z3r0_d/blenderDoc.html

I already have and advanced python setup, but it’s WAAAY too slow, and it’s full of bugs. :frowning:

Post it so that we can help ya out, or email it to me so that I can help ya out if you like, [email protected]