Actions and reseting values within the if statement.
hi guys,
I am a beginner to programming, i need some help if possible.
i have created 4 Actions a,b,c & reset. each action is connected to a button. and within each Action, there is an if statement. So if the first action 'a' fulfills the if statement within, then the second button 'b' is to be pressed until the if statement within is fulfilled. then is the same for the third button 'c'.
the buttons. a,b and c they count and show numbers. 'a' will show 1-4, 'b' will show 1-3 and 'b' will show 1-3 again.
all the above up to here are ok.
my problem is with the final button i have created 'reset'. the purpose is to reset all variables to '0' and start over the counting again for a,b and c. I CANNOT DO THIS RESET. i need this reset to reset all values to start over again whenever it is pressed.
please could anybody let me know how could i do this and where to find the solution?
It sounds like each button is generating a value, yes?
Each push adds on 1 to that value, yes?
In the reset action you simply need to set value 1,2 and 3 to 0.
Use the same process that you use to create the value to be displayed for each button and set it to =0.
If you post code it should be easy to give you an answer specific to your needs.
It sounds like each button is generating a value, yes?
Each push adds on 1 to that value, yes?
In the reset action you simply need to set value 1,2 and 3 to 0.
Use the same process that you use to create the value to be displayed for each button and set it to =0.
If you post code it should be easy to give you an answer specific to your needs.
Thanks for responding,
I think you got my point, I did what you recommended and set the value again to 0, but when i press the actions again the value remains as 0.
hoe to make the actions a,b and c start counting again from 1?
They don't look like they are doing anything, except for the ones in your reset function. They are not helping you in that function though. Try to remove them.
Last edited by aldcorn@live.com; 12-12-2010 at 10:38 PM.
It sounds like each button is generating a value, yes?
Each push adds on 1 to that value, yes?
In the reset action you simply need to set value 1,2 and 3 to 0. your
Use the same process that you use to create the value to be displayed for each button and set it to =0.
If you post code it should be easy to give you an answer specific to your needs.
Quote:
Originally Posted by aldcorn@live.com
Just to help others read code please use the code tags when posting...
They don't look like they are doing anything, except for the ones in your reset function. They are not helping you in that function though. Try to remove them.
Thank for your advice. I have changed as per your advised,
Then I have tracked my values with fprint and found that the value 'counta' was still adding when ever a button is pressed. so I have adjusted the if statement and then everything went just great.
again, thank you very much for your advice.
Somehow I could not see the silly mistake. Your advice made me look from a different angle .