Wire expression 2 fail...

Hey i have just started a new project on a brand new stargate dialer and i have finished the e2 not one thing is wrong with the code but this keeps happening … i tried dialing a gate … nothing happend … i check if everything was wired right, Yes so i was like WTF . i then linked a screen to the expression and every time i pressed a button . Yay nothing happens >.< it is suppoesd to give out values like 57,112,97 and crap like the keyboard But nothing.

i am going to give 3 bits of code not all of it coz i dont want tits stealing it (it has like 90 lines)

a Number button part for it



@name Stargate Control
@inputs I0
@outputs DialAdd
@persist
@trigger
if (I0) {DialAdd=48} else {DialAdd=0}


Now a letter button



@name Stargate Control
@inputs A
@outputs DialAdd
@persist 
@trigger
if (A) {DialAdd=97} else {DialAdd=0}


And now the dial and close



@name Stargate Control
@inputs Dial Close
@outputs DialAdd
@persist 
@trigger
if (Dial) {DialAdd=13} else {DialAdd=0}
#Close
if (Close) {DialAdd=1} else {DialAdd=0}


DialAdd is just short for Dial Address

If anyone could help that would be great and you will get 50% credit

http://i.creativecommons.org/l/by-nc/2.0/uk/88x31.png

I think DialAdd becomes 0 again when it gets to the next if case.

Edit:
If you dial “1” it closes? I didn’t know that.

This would work: (Make each button output their ascii number)


@name Stargate Control
@inputs A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Enter Close
@outputs Dial
Dial = A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+Enter+Close

Edit:
This would also work:


@name Stargate Control
@inputs A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Enter Close
@outputs Dial
Dial =  A * 97 +
        B * 98 +
        C * 99 +
        D * 100 +
        E * 101 +
        F * 102 +
        # And so on.. I can't be arsed to write all this out :P


Yes but i don’t even press the next button, even when I’m holding the first button it doesn’t change value and it doesn’t change to 0 at the next if case it only changes to 0 if the button is released, well its supposed to do that

[editline]08:30PM[/editline]

Im going to message you the whole code Only you. so you can see what its like coz i is getting confused with your way


@name Stargate Control
@inputs Dial Close
@outputs DialAdd
@persist 
@trigger
# You press Dial


# The E2 checks this if case:
# E2 says: "You're pressing Dial! DialAdd = 13."
if (Dial) {DialAdd=13} else {DialAdd=0}

# The E2 checks this if case:
# E2 says: "You're not pressing Dial, not Close! DialAdd = 0"
if (Close) {DialAdd=1} else {DialAdd=0}

[editline]09:33PM[/editline]

What I meant by that first massive line of plusses was that before you spawn each button, change their OnValue to 97, 98, 99, 100 and so on.

Edit:

I just thought of a way to fix your code:


@name Stargate Control
@inputs Dial Close
@outputs DialAdd
@persist 
@trigger
if (Dial) {DialAdd=13}
elseif (Close) {DialAdd=1} else {DialAdd=0}

By putting elseif after all of them and only having else DialAdd = 0 at the very end.

Dude tah alot i just figured it out :smiley:

you guys need to realize that with ifthen statements,

else{} means that for any other condition in which the input is not true, then it returns whats inside the brackets{}.

If you double up else{}, for instance:

f (Dial) {DialAdd=13} else {DialAdd=0}
#Close
if (Close) {DialAdd=1} else {DialAdd=0}

your trying to apply two commands to the same value, and it becomes conflicting and glitchy. the first else{} will try to apply when it’s condition is false, and return zero even if the second statement is true.

This can’t be found by the E2’s validator btw.

What you need to write is:

if (Dial) {DialAdd=13}

if (Close) {DialAdd=1}

if(Dial==0 & Close==0) {DialAdd=0)


DialAdd = Dial ? 13 : Close ? 1 : 0

edit: oops