# Simple Expression 2 not working

Hey everybody.

I was on a server, trying to make a simple E2 equation. if(Ranger >30) {out=1} was the code. Input was Ranger, output was Fire. Ranger was wired to a ranger, and a turret wired to Fire. I crossed the beam, but it still won’t go off. Please help.

out is not the name of your output, and it’s not even a valid name.

change so Fire=1

Try This

if (Ranger>=1) {Fire=1} else
{Fire=0}

this code is written wrong here is one that will work:

``````

@inputs Fire
@outputs Ranger
if(Ranger){Fire=1}
else{Fire=2}

``````

now i am bad at figuring out the inputs and outputs but you get the idea, fire is the turret and ranger is well the ranger.

U Forgot to put in the spaces

``````

if (Ranger) Or (Ranger>=1) {Fire=1} else
{Fire=0}

``````

[editline]04:44AM[/editline]

And the Inputs and Outputs are Wrong

``````

@inputs Ranger
@outputs Fire

``````

I don’t think spaces are required.

Aaaah i will check

ya im on that 2

Il Keep u ^ to date

E2 doesn’t use “Or”
You also do not need an E2 for this. Just set the Ranger’s range to 30 and wire the turret directly to the ranger.
Also remember to check the “default to zero” checkbox in the ranger and you’re good to go.

so… he wants use use E2 for it

I tried it with {Fire=1} and else {Fire=0}. Still doesn’t work.

``````
@name
@inputs Ranger
@outputs Fire
@persist
@trigger all
Fire = (Ranger > 30)

``````

A built in ranger. (Turns the expression into a ranger)

``````
@name
@inputs
@outputs Fire
@persist
@trigger all
interval(10)
Fire = ranger(30):hit()

``````

Uhm, This isn’t exactly the same thing, but Its still E2. I am trying to make a hovercraft, and the E2 code screen thing is making me mad.

if{Ctrl==1}and{Up==0}and{Down==0}{Up1=1}{Down1=1}

It keeps telling me tha I need a left parentises before the If. I know thats not right. Pleasae help me.

Use

``````
&

``````

``````
and

``````

Fix below.

``````

@name Blah blah
@inputs Ctrl InUp
@outputs Down OutUp
if(Ctrl & Up1 == 0 & Down == 0
) {Up2 = 1, Down = 1}

``````
``````

``````

No, that’s right.

Ok, thanks. And from what I understand, you say that I do need a parenthesis before the if. I’ve done this, then it says If cannon appear inside an equation at condition whatever.

I’ll go try this.

Optimization:

``````

@name Blah blah
@inputs Ctrl InUp
@outputs Down OutUp
if(Ctrl & !Up1 & !Down) {Up2 = Down = 1}

``````

This code will set Up2 and Down to 1, but then they will never switch back… Well I hope you figure it out and fix it yourself.

Well, what I want it to do is sense their is someone in the seat, then set both sides to on. ( 4 up, 4 down.) Then, when you press mouse 1 or mouse 2, it would disable the according side (1, goes up, 2, goes down.) So when you disable one, say the top ones, the bottom one force it up. So yeah, please tell me how this would work.

Just use the “Active” output of the Adv Pod Controller to check if anyone is sitting in the seat.