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

Username:   Password: 
 RegisterRegister   
 Window of Time
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Hakneedshelp




PostPosted: Wed Jan 18, 2017 7:07 pm   Post subject: Window of Time

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
My program is a bunch of procedures that are called from keyboard commands. (Input.KeyDown) It is a sort of reaction game. The procedure have to have a window of time to input the keyboard answer. For example, if you need to press F to survive, I need a window of time to press F, which I found to be not possible through delays or for loops.


Describe what you have tried to solve this problem
I tried to put the Input.KeyDown commands into the procedures, however, they programs jumps back into the procedures once theyre called out to a different procedure. I also tried to create that window of time through delays and for loops, but no commands can be inputted while a delay or for loop is active.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<>


Turing:


%here is a sample of the code...
procedure dodge1
put "Hello"
end dodge1


procedure bossfight1
Font.Draw("DODGE WITH F!",200,175,fontIDtext,black)
drawfillbox(0,0,maxx,maxy,7)
Font.Draw("GAME OVER",200,200,fontIDMainScreen,31)
end bossfight1



loop
    Input.KeyDown (chars) 
           
            if chars ('f') then 
                dodge1
             end if

    end loop 



Please specify what version of Turing you are using
Using Turing 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
NightOwl




PostPosted: Wed Jan 18, 2017 10:16 pm   Post subject: RE:Window of Time

I don't really understand your question. What do you mean by "A window of time"? Can you explain in more details about how you'd want the program to behave?
Hakneedshelp




PostPosted: Thu Jan 19, 2017 7:48 am   Post subject: Re: Window of Time

The Key actions cannot be inputted-In other words, i need a way to delay a certain amount of time while still being able to input key commands. using a standard delay doesn't work, nor does using a really long for loop.
Insectoid




PostPosted: Thu Jan 19, 2017 9:05 am   Post subject: RE:Window of Time

Time.Elapsed returns the number of milliseconds since the program started running. I'm sure you can find a way to use this to your advantage!
5c0r910n




PostPosted: Thu Jan 19, 2017 9:41 am   Post subject: RE:Window of Time

MOD EDIT: Try not to give out the answers guys. We'd rather help you figure it out for yourself.
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: