i need help with a script!

i am using a mouselook script but when i try to run the script, it keeps saying one of my lines of code is wrong:ba:…(dont get me wrong, im still a newbie at python) the script is:
Up.setDRot = ( rotUp, 0.0, 0.0, True)
it is made almost exactly like all my other codes like the Left, Right, and Down.setDRot but it just keeps saying its an invalid syntax!
o yeah, the left, right, down.setDRot scripts look like this:
Left.setDRot = ( rotLeft, 0.0, 0.0, False)
Right.setDRot = ( rotRight, 0.0, 0.0, False)
and:
Down.setDRot = ( rotDown, 0.0, 0.0, True)
but all those r right
HELP ME PLEEEEEEEZ!!! i would appreciate it ALOT!!!

steve

Can you show us the whole code ?
Or at least the lines before and after the error ?
Maybe you forgot to close a “)” at the end of the line above or something like that (indent,etc…)

ok here is the whole code:


sensitivity = .0005
directionLeft = -1
directionRight = -1
directionUp = 1
directionDown = 1
import GameLogic
import Rasterizer
gameWidth = Rasterizer.getWindowWidth
gameHeight = Rasterizer.getWindowHeight
Rasterizer.setMousePosition(gameWidth/2, gameHeight/2)
controller = GameLogic.getCurrentController()
mouse = controlleer.getSensor("Mouse")
 
def mouseMove
 x = mouse.getXPosition() - gameWidth/2
 y = mouse.getYposition() - gameHeight/2

 return(x, y)

pos = mouseMove()

rotLeft = (pos[0] * directionLeft) * sensitivity
rotRight = (pos[0] * directionLeft) * sensitivity
rotUp = (pos[0] * directionLeft) * sensitivity
rotDown = (pos[0] * directionLeft) * sensitivity
Left = controller.getActuator("LookLeft")
Right = controller.getActuator("LookRight")
Up = controller.getActuator("LookUp")
Down = controller.getActuator("LookDown")
Left.setDRot( 0.0, 0.0, rotLeft, False)
Right.setDRot( 0.0, 0.0, rotRight, False)
Up.setDRot( 0.0, 0.0, rotUp, True)
Down.setDRot( 0.0, 0.0k rotDown, True)
GameLogic.addActiveActuator(left, True)
GameLogic.addActiveActuator(right, True)
GameLogic.addActiveActuator(up, True)
GameLogic.addActiveActuator(down, True) 

I have tested it to the point of up to “Up.setDRot( 0.0, 0.0, rotUp, True)” and everything before that is right ( i dont know about after it, i havent gotten past the problem yet.

Mmmmm
I dont have the necessary Game Engine python modules to test it.
Anyway there are a lot of typo errors here…
Here: def mouseMove ():
There: mouse = controller.getSensor(“Mouse”)
There: Down.setDRot( 0.0, 0.0, rotDown, True)

Where can i find those modules ?

EDIT ok found them…

gameWidth and gameHeight are functions… You should add () at the end of lines 8 &9 if you want to get a value returned

k ill try that…
srry about the typos n e ways…
i tried the thing about putting a “()” by lines 8&9 and it still sais ther is a invalid syntax in line 33.

Hi!

Here’s a working code (I tested it on a cube, and the cube were rotating fine)


import GameLogic
import Rasterizer

sensitivity = .0005
directionLeft = -1
directionRight = -1
directionUp = 1
directionDown = 1

gameWidth = Rasterizer.<b>getWindowWidth()</b>
gameHeight = Rasterizer.<b>getWindowHeight()</b>
Rasterizer.setMousePosition(gameWidth/2, gameHeight/2)
controller = GameLogic.getCurrentController()
mouse = <b>controller</b>.getSensor("Mouse")

<b> def mouseMove() :</b>
    x = mouse.getXPosition() - gameWidth/2
    y = mouse.getY<b>Position</b>() - gameHeight/2
    return (x, y)

pos = mouseMove()

rotLeft = (pos[0] * directionLeft) * sensitivity
rotRight = (pos[0] * directionLeft) * sensitivity
rotUp = (pos[1] * directionLeft) * sensitivity
rotDown = (pos[1] * directionLeft) * sensitivity
Left = controller.getActuator("LookLeft")
Right = controller.getActuator("LookRight")
Up = controller.getActuator("LookUp")
Down = controller.getActuator("LookDown")
Left.setDRot( 0.0, 0.0, rotLeft, False)
Right.setDRot( 0.0, 0.0, rotRight, False)
Up.setDRot( 0.0, <b>rotUp, 0.0</b>, True)
Down.setDRot( 0.0, <b>rotDown, 0.0</b>, True)
GameLogic.addActiveActuator(<b>Left</b>, True)
GameLogic.addActiveActuator(<b>Up</b>, True)
GameLogic.addActiveActuator(<b>Right</b>, True)
GameLogic.addActiveActuator(<b>Down</b>, True)

I put in bold what I’ve changed.
In addition to what Gwenouille said, just remember that Python is case-sensitive (left and Left are two different variables)

By the way, you don’t need so much actuators to do what you wanna do: comment the last two lines and you’ll see that it still works fine! You could even just use one actuator…

yeah…ive tried what u just said and it dosnt work…

Hi!

What do you mean exactly by “it doesn’t work”?
Is there any error message from Blender?

I’ll post my file as soon as I get back.

i mean that i put in that code (made changes to mine) so it looks like urs and mouselook still wont work!:ba:

So, here’s my file: link
I put two examples: one with a cube (first scene), one with a camera (second scene).
Both of them run well on my computer (Blender 2.44 or 2.45).
(I didn’t want to spend time adjusting the camera’s movement, so the shifting isn’t well at all, but still it runs)

Your reply isn’t detailed enough to find what causes this issue, so could you please post your file somewhere if my file doesn’t help you?