Search the Community
Showing results for tags 'operators'.
-
Hi! I've written a script that starts on touch_start. After starting the script, the touch_start event is supposed to be deactivated for some time, so that nobody can restart the script as long as the process has not been finished: integer on; touch_start (integer num) { if(!on) { on = TRUE; *do something* } else { return; } This seems to work (the only thing I'm not quite sure about is the "else" part with "return". Couldn't you just leave the "else" part out?) Now my main question: I've tried a similar version, which does NOT work, and I don't really understand the difference: integer on; default { state_entry() { on = FALSE; touch_start (integer num) { if(on = FALSE) { on = TRUE; *do something* } else { return; } } } } The problem apparently is that "!on" and "on = FALSE" don't seem to be the same thing. Could one of you explain the difference between "!on" and "on = FALSE" to me? (Besides: Is it necessary to declare the integer "on" as FALSE at the beginning? Is integer "on" not FALSE by default before it is turned TRUE?) Thank you very much in advance!