How can I perfect this "GoTo"?
Author |
Message |
Jarren95
|
Posted: Mon Jan 24, 2011 10:33 pm Post subject: How can I perfect this "GoTo"? |
|
|
What is it you are trying to achieve?
I'm trying to get an object on the Turing output screen clickable for the duration of the entire program, while forked, and only outputting one preset text/img once for each detected click.
(Please ask any clarification questions... I'm not good at explaining without a specific questions sometimes. )
What is the problem you are having?
I'm trying to use a sort of 'GoTo' code, and I'm a little confused on how this will work when the object I'd like detected, is using mousewhere.
It simply loops over and over again. I'm not sure how to make it re-detect whether the User will click the button again.
Describe what you have tried to solve this problem
I've tried looking through the forums a little, but time is short on me... so I'm wondering if anyone can help with it.
I've tried implementing a sort of "GoTo" code... but I know it won't work.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
I've spaced it out for easy looking! I hope it doesn't confuse anyone.
Turing: |
% This is the first Process, for the first button. There are other buttons, which are all running simultaneously.
process learnTuring
loop
loop
mousewhere (x, y, button )
if (x > 41
and x < 127
and y > 449
and y < 457
and button = 1)
then
put "This is Test Text. A picture will be here with information in the final version."
exit
else
end if
end loop
exit when button = 1
end loop
end learnTuring
|
I hope that this code is useful. If any more code is required, please ask. (There are literally only a few lines... this and a second process that I've forked as well.)
Please specify what version of Turing you are using
I'm using Turing 4.1.1, from Holt Softwares.  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Insectoid

|
Posted: Mon Jan 24, 2011 11:00 pm Post subject: RE:How can I perfect this "GoTo"? |
|
|
goto is bad, processes are bad.
Nothing needs to happen simultaneously. Just has to look like it.
goto will destroy your program. Write a procedure to do whatever and call that. |
|
|
|
|
 |
lordroba

|
Posted: Mon Jan 24, 2011 11:15 pm Post subject: Re: How can I perfect this "GoTo"? |
|
|
have your procedures run inside of one giant loop
*simplified
loop
mousewhere (x, y, button)
procedure draw button
procedure 2
procedure 3
end loop
then have 'if' conditions within your procedure to do things based on whether the button was pressed or not.
as for how to detect if a user pressed a button again, you can have a counter that goes up by one each time you press the button |
|
|
|
|
 |
|
|