Python - logic bricks expression problems

So I made 2 boolean properties and added a check for them. If the key “N” is pressed and both boolean are true then the object moves away. But that takes up 3 lines in the sensor panel which is pretty damn high after a few hot-keys.

I tried to add only the key pressed sensor and connect it to the actuator with an expression but it didn’t work well.
I wrote the expression N=False && Le1=False. The problem is that that now it wont detect the key pressed first. It should only trigger after the N key is pressed but currently it triggers as soon as I start the BGE. Any ideas how to solve that?

I have issues with the keyboard ever since 2.69

So, I do this

look at the object sending the messages,


KeypressRot.blend (445 KB)

expression N=False && Le1=False


N == False and Le1 == False

What you are doing is trying to assign false to N and Le1.
The expression brick acts the same as an if statement.

btw i assume N and Le1 are the names of the controllers.

N and Le1 are boolean variables.

N == False and Le1 == False

That one solves it. Thanks :slight_smile:

Oookay now the problem is that because it’s an expression and not a logic bricks and group check it’s too fast and it collides with other options on the same hotkey thanks to the fast variable rewrite :confused: