Reply to Re: reaction time DMOD
If you don't have an account, just leave the password field blank.
Then I wonder how you are wanting to measure reaction time. But to answer your question why it fails.
early.c:
void main( void )
{
&early = -2;
wait(5000);
&early = 0;
timerloop:
//Replace this by whatever method you use to measure reaction time. I re-use &early in this case.
wait(5);
&early += 5;
goto timerloop;
}
void kill( void )
{
kill_this_task();
}
//*script before
int &timer = spawn("early");
loop:
wait(1);
wait_for_button();
if (&early == -2)
{
say("you're too early",1);
goto loop;
}
say("your reaction time: &early",1);
run_script_by_number(&timer, "kill");
//*script after
In this case, I've put only the timing in early.c. The main script still handles being too early. I don't what could go wrong initially. Perhaps you should add { and } to if-statemens. I know they shouldn't matter with just one line following, but then, they just might.
early.c:
void main( void )
{
&early = -2;
wait(5000);
&early = 0;
timerloop:
//Replace this by whatever method you use to measure reaction time. I re-use &early in this case.
wait(5);
&early += 5;
goto timerloop;
}
void kill( void )
{
kill_this_task();
}
//*script before
int &timer = spawn("early");
loop:
wait(1);
wait_for_button();
if (&early == -2)
{
say("you're too early",1);
goto loop;
}
say("your reaction time: &early",1);
run_script_by_number(&timer, "kill");
//*script after
In this case, I've put only the timing in early.c. The main script still handles being too early. I don't what could go wrong initially. Perhaps you should add { and } to if-statemens. I know they shouldn't matter with just one line following, but then, they just might.