
-----------------------------------
wlarien
Fri Apr 27, 2012 8:59 pm

How to stop the movement of mousewhere temporarily?
-----------------------------------
What is it you are trying to achieve?
I need to stop the mousewhere from moving for 3 seconds while at the same time keeping up the decrement in an accumulator. For more context, I am trying to do this requirement in my assignment: Small solid squares, coloured differently from the slime ball, occasionally appear on the screen. Accidentally hitting one freezes the slime ball in place for 3 seconds, but it continues to shrink.


What is the problem you are having?
I can't get the two processes to run simultaneously. I am looking for some code that will only freeze the slime ball (which is controlled by mousewhere)


Describe what you have tried to solve this problem
I tried delay and looked at time related commands in the help menu, but none seem to be of use.


Please specify what version of Turing you are using
4.1

-----------------------------------
Tony
Fri Apr 27, 2012 9:04 pm

Re: How to stop the movement of mousewhere temporarily?
-----------------------------------
processes
well there's your problem (processes are really really hard to do correctly; if anyone suggests otherwise, they just don't understand the complexities well enough).

-----------------------------------
wlarien
Fri Apr 27, 2012 9:14 pm

Re: How to stop the movement of mousewhere temporarily?
-----------------------------------
well what I want to do is to have the mousewhere not move for 3 seconds, then resume moving. Could you help me out with that?

-----------------------------------
Tony
Fri Apr 27, 2012 9:40 pm

RE:How to stop the movement of mousewhere temporarily?
-----------------------------------
mousewhere is just a function that returns the x/y(+button) values. There is no "move", unless you act on those values. It's this "act on" step that you want to pause; more likely in a sense of "do nothing".
[code]
loop
   Mouse.Where(x,y,b)
   if 
      do nothing
   else
     do something
   end if
end loop
[/code]

Of course since you have multiple independent objects, you would likely want multiple independent timers. It's fine if they are sequential, as long as they are non-blocking (don't do anything slow, such as delay).

-----------------------------------
mirhagk
Sun Apr 29, 2012 4:21 pm

RE:How to stop the movement of mousewhere temporarily?
-----------------------------------
general rule of thumb, if your using processes in Turing, you don't understand them. Whenever your using processes it's usually something to do with making something wait a little while other things continue to happen. This is better handled with a timer (just store the time in a int and then check the current time to the time stored) and sequential programming.
