Uisng < > in Logic bricks

Hi, i was wondering if its possible to use the greater than/less than statements in the property logic brick?
It has not been working for me (e.g >10)

Thanks :slight_smile:

Are you using a property sensor? There’s also an ‘Expression’ controller - I believe you have to use (‘property name’ > 10), for example.

I am using property sensors,
do you mean i need to specify the property in the sensor twice? Once in the prop section and another in the value field?

Edit: Sorry about the title spelling error, wrote it in a rush :slight_smile:

Sorry, I posted a bit rushed as well. The easiest way to do this is to tie an Always sensor (for example) to an Expressions controller. Then, in the expression, type ‘variablename > 1’, for example - when the variablename’s value exceeds one, the actuator tied to that triggers as well.

I’m not quite sure I understand,
I have a near, mouse over and keyboard actuator connected to and and and then my action.
How would I incorporate the expression controller into this so it check a variable before it can go ahead?

Okay, I found a way to test for a sensor and a variable’s condition. In the example, you’ll see that pressing the Left-key will make the cube move to the left until timer > 2, at which point the cube will reverse direction. Note that if you don’t press the key, the cube stops moving - this is because the Keyboard sensor returns false when this happens.

ExpressionController.blend (462 KB)

Thank you, i will try it.
I am actually using 2.49b right now- i gave 2.56 a go but i cant find the physics options (e.g static, dynamic etc) so i gave up on it.

You should check out 2.56 - it’s faster and the UI is far better. The physics tab is on the same bar as the Render tab, Object tab, World tab, etc. By default, it should be on the right of the screen, I think.

You could try using a property sensor with the “interval” setting. Set the maximum or minumum values that you want the sensor to fire between. Alternatively, set an open bracket for < or >. ie. minimum = 2 is the same as >=2 Not checked out SolarLune’s example so I apologise if this has already been mentioned.

Edit: It seems the interval needs to have a max and min to work. My advice would be to set values that will guarantee appropriate operation.

Here is a simple .blend:

prop_interval.blend (59.6 KB)

I have used a small script to update the “x” property to the position of the cube on the x axis. What it does is use that property (set to x axis position) to move the cube along the x axis until it’s position is 2 on the x axis.

I made this in 2.56a. It may or may not work in 2.49b, but the principle is the same.

I recommend the interfall mode of the property sensor too. An Always sensor + Expression controller is usually just an unnecessary performance eater.

Oh, I didn’t see the interval setting - that is a better method of value comparison.

Sorry, what do you mean?
I wish it was as easy as >= …

I looked and saw the animation physics not blender game engine physics?

Make sure that ‘Blender Game’ is selected under the Renderer section at the top of the screen (where it says “Blender Render” by default, I think).

EDIT: I think that Monster is saying to use the ‘Interval’ setting of a property sensor. When the property goes between two specific values, then it will trigger. If you want to trigger an actuator when a value is above a certain amount, then just use the minimum of the value and a maximum value of, say, 10000000. Yeah, here’s a little tutorial on it.

Thank you everyone, interval worked a treat! :slight_smile: