Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to stop the movement of mousewhere temporarily?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
wlarien




PostPosted: Fri Apr 27, 2012 8:59 pm   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Apr 27, 2012 9:04 pm   Post subject: Re: How to stop the movement of mousewhere temporarily?

wlarien @ Fri Apr 27, 2012 8:59 pm wrote:
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).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wlarien




PostPosted: Fri Apr 27, 2012 9:14 pm   Post subject: 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




PostPosted: Fri Apr 27, 2012 9:40 pm   Post subject: 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 <still waiting on timer>
      do nothing
   else
     do something
   end if
end loop


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).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mirhagk




PostPosted: Sun Apr 29, 2012 4:21 pm   Post subject: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: