Click and mouse over to activate a Python script

How do i make Python script run when the user clicks on an object. I´m linking a mouse over and a left click sensors to a Python brick but it running once at the mouse over and freely at left clicks on all the screen.
Do I have to link the two sensors to an AND and then to a property and then on another brick chain link a property sensor to the Python brick?

nope, just the two sensors

then have python get them, and make sure they both were positive.

if you want to make your script only run once when clicked, make sure you dont’ have the pulse buttons set for either sensor.

If you don’t program the sensors into your python script, it will run the whole script every time one of the sensors is activated.

You’ll need to get the sensors and give them conditions to run the script, for example:



mClick = c.getSensor("Left Click")
mOver = c.getSensor("Mouse Over")

if mClick.isPositive() and mOver.isPositive():

    ## Run Script ##


here is a link on blender sources server

http://212.123.169.51/blendernet/blendershare/blend/

and than dowload the

EXinteractiveButtons1.blend

exampe

may this help you :smiley:

Sorry for hijacking thread but quick question to tester: why a seperate program to access blender resources, why not just usual web interface? If I don’t want to install a program can I browse/download resources via the web? Excuse the brevity but a seperate prog seems restrictive.

here is the link that reach the examples files
and i put this link the appropriate forum thanks for observation :smiley:

http://212.123.169.51/blendernet/blendershare/blend/

Thanks.

Thanks a lot z3r0d, Andy83 and tester!