Cs24 wrote:(e)=>{e.geom.controlleracc == <0 ? {e.geom.density = 0}}
This won't work nor does "<="
but it will [work] if I remove the <
Fixes?
If structures take a boolean value (
true or
false) and if it's
true, run the first script and if
false, run the second script, you always need three inputs for an if structure, for example:
- Code: Select all
e.geom.controlleracc == 0 ? {print("hello")} : {};
should print "hello" in the console (view by pressing F11 or Tilde("~")) if e.geom.controlleracc is equal to 0.
Different statements you can check are:
x == y, x is equal to y.
x != y, x is not equal to y.
x < y, x is less than y.
x > y, x is more than y.
x <= y, x is less than or equal to y.
x >= y, x is more than or equal to y.
Each of these statements return a
true or
false value, depending on whether they are
true or
false.
Another thing you can check for is OR (represented as
||), if either inputs or both inputs are
true, it will return
true, otherwise it will return
false, for example
true || false will return
true, or
x == y || x != y will return
true, or,
false || false will return
false similarly,
false || true will return
true as well
.
You can also check for AND (represented as
&&), if both inputs are
true, it will return
true, if either input or both inputs are
false, it will return
false, for example
true && true will return
true, whereas
false && true or
false && false will return
false.
These can be combined a lot to form the questions you want, like for example:
- Code: Select all
(Value1 != Value2 && Value2 == Value3) || (Value3 == Value1 && Value2 == Value4) ? {print("Success")} : {print("Try again")};
The code I think you want is:
- Code: Select all
(e)=>{e.geom.controlleracc < 0 ? {e.geom.density = 0} : {}}
Hopefully this has answered your question, if not, please be very specific
.
- Grady