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

Username:   Password: 
 RegisterRegister   
 Get that doesn't pause
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Taur




PostPosted: Wed Dec 14, 2005 6:10 pm   Post subject: Get that doesn't pause

is there a way to use get without pausing everything else? I tried making a procedure and then calling get in it, but it still pauses it. the only other way I can think of is making a new get procedure by using keys and stuff, I could do it but I was wondering if there was an easier way?
Sponsor
Sponsor
Sponsor
sponsor
pkchris




PostPosted: Wed Dec 14, 2005 6:26 pm   Post subject: (No subject)

Maybe if you put it in a process then used fork.

code:

process getpro
get whatever
end getpro
fork getpro
Taur




PostPosted: Wed Dec 14, 2005 6:31 pm   Post subject: (No subject)

I don't understand that fork does Confused
pkchris




PostPosted: Wed Dec 14, 2005 6:36 pm   Post subject: (No subject)

"Fork" just makes a process run seperate so that you can have other stuff going on at the same time. Check out Turing Help for more info. Wink
Paul




PostPosted: Wed Dec 14, 2005 6:55 pm   Post subject: (No subject)

The general concensus is to avoid using processes and forks in your programs.
read up on the advanced input tutorial
and also in general Input.KeyDown then F9 (turing's reference).
Taur




PostPosted: Wed Dec 14, 2005 7:16 pm   Post subject: (No subject)

what has that got to do with using a get that doesn't pause?
Paul




PostPosted: Wed Dec 14, 2005 7:28 pm   Post subject: (No subject)

Perhaps if you'd read the tutorial, its about input. What is get? its input.
Check out this old typing game I made with Input.KeyDown.

This requires getting the user's input without pausing the game. Get it?
Taur




PostPosted: Wed Dec 14, 2005 7:35 pm   Post subject: (No subject)

I aldready considered that and I posted in my title, it would take a bit of coding and 1 line would be much easier if not much more efficient, but I guess it's the only way
Sponsor
Sponsor
Sponsor
sponsor
md




PostPosted: Wed Dec 14, 2005 8:12 pm   Post subject: (No subject)

easy and how you do something aren't always the same. So what if it's more then one line, write a procedure! You probably should be doing so anyways. If you ask for help don't complain because the answers given are "too hard" or are "more then a line".
Taur




PostPosted: Wed Dec 14, 2005 8:47 pm   Post subject: (No subject)

sorry but I was looking for a build in turing procedure because mine might be less efficient..
Paul




PostPosted: Wed Dec 14, 2005 8:54 pm   Post subject: (No subject)

Its ok.
But you have to realize that turing is not meant for that sort of thing. Turing is a learning language, where you should build everything from scratch, and you're only given a few things for you to work with.

Things like C++ have huge amounts pre-made things that comes in its libraries.

Have fun being creative! Very Happy
Taur




PostPosted: Thu Dec 15, 2005 8:02 pm   Post subject: (No subject)

okay thx

I finished it, it works pretty good with the exception of the little black boxy thingy Razz but yah thx for everything
Albrecd




PostPosted: Tue Dec 20, 2005 9:19 am   Post subject: (No subject)

Or, A much simpler way would be to use:

code:
var input : char

put "Please Type A Letter"
input := getchar
put "Your Letter Was: ",input
Cervantes




PostPosted: Tue Dec 20, 2005 1:50 pm   Post subject: (No subject)

Hmm? That still pauses.
If you want to use getch/getchar, you need to wrap it in an if hasch statement:
code:

var input := ""
for i : 0 .. maxx
    if hasch then
        input += getchar
    end if
    locate (1, 1)
    put input
    Draw.Dot (i, 50, black)
    delay (10)
end for

Although, this would be better if instead of having a delay, you had a loop that accepted input. (Think: what happens if you press a key while the delay is on, then lift the key before the key is lifted?)
code:

var input := ""
var time_enter : int

for i : 0 .. maxx
    time_enter := Time.Elapsed
    loop
        if hasch then
            input += getchar
        end if
        exit when Time.Elapsed - time_enter >= 10
    end loop
    locate (1, 1)
    put input
    Draw.Dot (i, 50, black)
end for
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  [ 14 Posts ]
Jump to:   


Style:  
Search: