I was following a tutorial that was originally meant for Blender 2.4x, but I was using Blender 2.58a.
So, there is a script that was used to pick up an object when the crosshairs of the player are on an object with a property. I can’t get this script to work in Blender 2.58a because the system console keeps giving me this error:
ValueError: sensor.getButtonStatus<int>: Mouse Sensor, invalid button specified!
Here is the script:
import GameLogic
cont = GameLogic.getCurrentController()
own = cont.owner
ray = cont.sensors['ray']
click = cont.sensors['click']
item = own['item']
status = click.getButtonStatus(182)
if ray.positive:
pos = ray.hitPosition
hit = ray.hitObject
if status == 2 and item == False:
own['item'] = True
hit.setParent(own, 0, 1)
if status == 3:
own['item'] = False
hit.removeParent()
I added the “import GameLogic” part.
Why am I getting this error?
Link to tutorial: http://www.youtube.com/watch?v=evlGAroMfUE