Hey Saschaw04
First, I believe
the manual said I read somewhere not to use while loops in functions (voids) but rather, nest the function into a while loop, in an action.
so in your flashlights action do this:
var light_on = 0;
var pressed = 0;
function press_f(){
// -- Turn the Light On
if(key_f && pressed == 0 && light_on == 0){light_on = 1;pressed = 1;}
// -- Turn the Light Off
if(key_f && pressed == 0 && light_on == 1){light_on = 0;pressed = 1;}
// -- Wait until release of key_f to allow pressed again
if(key_f==0 && pressed == 1) {pressed = 0;}
if(light_on == 1){
..//Do this
}
else{
..//Reset / stop countdown
}
}
action flashlight(){
while(1){
press_f();
wait(1);
}
}
EDIT: I Just edited the heck out of this - so now you can know its final
I looked in the manual to see if I could back up my info... but I couldn't find it. I'm not sure where I read that, but feel it to be true. Someone correct me if I'm wrong here.