-1

as you can read in the title I have a problem. The value of x outputs null even though (I think) I give it a value.

What I want to do is check if x has a value. If it doesnt have a value give it the value of '$prop('BrakeBias')' (the value can vary between 50 and 70) after that I want to store that value of x and don't change it even if '$prop('BrakeBias')' changes. After that it needs to run again and check again, if everything is right it will detect x has a value and go to the else statement. Then I want it to give y the same value as x but y needs to update evertime '$prop('BrakeBias')' updates. If something updates I want to subtract y from x and calculate the outcome.

I checked: let's suppose '$prop('BrakeBias')' equals 50. Then the output of x is null, the output of y = 50 and xy = -50 because 50 will be substracted from 0 so -50. I don't understand what is going on and why it does not work. I need to store the first value of x (because '$prop('BrakeBias')' can change because the player controls the value) and leave it alone and dont update it but idk if iam doing that right now.

if (x = null) {
    var x = $prop('BrakeBias');
} else {
    var y = $prop('BrakeBias');
    var xy = x - y;
    return xy;
}

Thanks for looking!

I am looking forward to see your solutions!

Greetings, Peter

Peter
  • 7
  • 2

0 Answers0