Well, that looks Okay so far. The reason it’s only OK is that if your object doesn’t exist, your script crashes. Also, you use ‘object’ as a variable name, because ‘object’ is also used in some internal python commands, and the script will get confused very easily. Instead use ‘playerObject’ or ‘cubeObject.’
So what us guys normally do is use:
cubeObject = [obj for obj in bge.logic.getCurrentScene().objects if obj.name == "Cube"][0]
Looks daunting doesn’t it, so I’ll explain it.
This is really a compressed version of the following:
scene = bge.logic.getCurrentScene() #Gets current scene
for obj in scene.objects: #looks at every object
if obj.name == "Cube": #Compares every object to the name 'Cube'
cubeObject = obj
You don’t have to understand how I compressed it into the top code line, but there you go.
As to the second part of your problem, you want to learn about how to find the value of the property.
So you’ve got the property fine:
cubeProperty = cubeObject["property"] #Again using 'property' as a variable is a bad idea
So now we’ve got it we need to compare it:
if cubeProperty == 1: #Two equals means compare instead of assign (var = 1 vs if var == 1:)
'''do whatever you want to do'''
In this case we want to set the physics type, so we look up the API and find some functions
Now we can use them like:
if cubeProperty == 1:
cubeObject.enableRigidBody()
elif cubeProperty != 1: #Is not equal to 1
cubeObject.disableRigidBody()
Hope that helped a little.