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

Username:   Password: 
 RegisterRegister   
 Possible to run more then one command at once
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
aznrex




PostPosted: Fri Jan 13, 2006 10:08 pm   Post subject: Possible to run more then one command at once

What i mean is that, is it possible for turing to be able to run 2 sets of code at once.
what i am trying to create is a "Town Project" which i need to utilize the parallel cable. anyways i wanted to make a trafic light (4way) that switch lights in a regular pattern. But how would i be able to do this while the computer is asking for other commands to be inputed?

so basicly the trafic lights have to switch lights on regular basis, but would also affect other commands, such as when the light is red the car cant move

is there anyway of doing this?
Sponsor
Sponsor
Sponsor
sponsor
pavol




PostPosted: Fri Jan 13, 2006 10:12 pm   Post subject: (No subject)

you could use the Snip! command to Snip! a procedure that will run things simultaneously

Let's keep him on the right track, here. No mentioning the f or p words.
Cervantes




PostPosted: Fri Jan 13, 2006 10:16 pm   Post subject: (No subject)

Are you drawing this, or using parallelput?

There is no way to execute two sets of code simultaneously. You can sort of do it, but it's quite a ways off, and you'll be selling your soul to the devil to do it.

Instead, put everything in your loop. If you don't want your input to pause (assuming you're using getch. If you're using get, switch to getch Wink), wrap an if hasch around your getch line:

code:

loop
  if hasch then
    getch (ch)
  end if
end loop
aznrex




PostPosted: Fri Jan 13, 2006 10:33 pm   Post subject: (No subject)

no actualy i aint gonna use a getch, i am going to use mouse button wait, since i will redraw my physical town into turing. so example if the user press on the car, the car will move, but the problem is it doenst make sense if the car moves while its red light.
also since turing is waiting for the user to input a command everything pauses, that includes my traffic lights, i am actualy building a physical thing that i can use a circuit board to control using the parallel port cables
Cervantes




PostPosted: Sat Jan 14, 2006 10:30 am   Post subject: (No subject)

Instead of using Mouse.ButtonWait, use Mouse.Where. It won't pause your program, and you can do everything you can do with Mouse.ButtonWait. Using Mouse.Where, you can make a mimic of the Mouse.ButtonWait function that doesn't pause for input. You'll need to use some boolean variables to store data about the value of the mouse buttons.
aznrex




PostPosted: Sat Jan 14, 2006 1:59 pm   Post subject: (No subject)

oo, ok thanks
i will try and see if that works
codemage




PostPosted: Mon Jan 16, 2006 12:31 pm   Post subject: (No subject)

Please don't tell people to use Snips!
You'll Snip! up your whole program.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: