python sensor for checking horizontal mouse movement

according to the blender python api and a tutorial im following, bge.events.MOUSEX should check for horizontal mouse movement, however i keep getting an invalid syntax error! Im aware that i could use logic.mouse.events[xxx], but i have already been using bge.events and would like to be consistent in my code. Anybody know how i could fix this?

We need to see the code in question, along with the error that follows.

import bge, math
from bge import logic, events
from math import cos, sin

cont = logic.getCurrentController()
own =cont.owner
scene = logic.getCurrentScene()
obj = scene.objects
hero = obj[“Hero”]
gd = logic.globalDict
mouse = bge.logic.mouse

VectTo = own.getVectTo(hero)
own.alignAxisToVect([0.0,0.0,1.0],2,1)
own.alignAxisToVect(VectTo[1],1,1)

if bge.logic.KX_INPUT_ACTIVE == mouse.events[bge.events.WHEELDOWNMOUSE] and gd[“Radius”] > 5:
gd[“Radius”] -= 1
elif bge.logic.KX_INPUT_ACTIVE == mouse.events[bge.events.WHEELUPMOUSE] and gd[“Radius”] < 50:
gd[“Radius”] += 1

#the line the error is occurring on

if bge.events.RIGHTMOUSE == 2:
if bge.events.MOUSEX

x = hero.localPosition[0] + gd[“Radius”] * cos (gd[“a1”]) * sin (gd[“a2”])
y = hero.localPosition[1] + gd[“Radius”] * sin (gd[“a1”]) * sin (gd[“a2”])
z = hero.localPosition[2] + gd[“Radius”] * sin (gd[“a2”])

own.position = [x,y,z]

Please use code tags for posting your code (to preserve proper indentation): http://www.bbcode.org/examples/?id=15

Also, I asked for the actual error, not just the line on which it occurs.

That said:

RIGHTMOUSE and MOUSEX are integer constants, meaning that they have set values which won’t change, so even though your check for RIGHTMOUSE == 2 is valid python code, it will always evaluate to False, and I don’t think you want that.

The error is probably in relation to the incomplete if statement that follows:

if bge.events.MOUSEX

But I’m only guessing, because you didn’t post the error, and because your code lacks indentation …

Yes, the Python error messages usual show what exactly is wrong. But you need to get used to them. Often it helps to read them multiple times to get what they mean. In 90% of cases the user did something stupid ;).