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

Username:   Password: 
 RegisterRegister   
 Problem with 2 Processes (1 for, 1 get) - Please help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CoRruPt-




PostPosted: Tue Jun 08, 2004 9:28 am   Post subject: Problem with 2 Processes (1 for, 1 get) - Please help

code:

process a
for decreasing x: 60..1
delay(1000)
locate(1,1)
put x..
end for
end a

process b
var whatever: string
locate(14,15)
put "Blah blah"..
locate(15,15)
get whatever
end b

fork a
fork b


Well, I have a problem with process, for and get. See, I want to locate the get in a specific location (in this case, (15,15)). The for is also located specifically (1,1). However, when the for script runs (a counting down "effect"), the get variable is relocated next to the running for. Is there any way to fix the get to a specific spot and not have it move around? And is there any way to remove the get prompt without the user having to type anything (ie: disappears after x seconds)?

Thanks in advance.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jun 08, 2004 11:09 am   Post subject: (No subject)

you don't use processes. bad bad CoRuPt- Laughing

seriously, processes mess things up since they're random. As in the order in which each line gets executed is random, so at first it will locate (1,1) from a, then locate(14,15) from b then back to put x from a... and x ends up in the middle of the screen Rolling Eyes

Keep it all together man
code:

var temp : string := ""
var c : string (1)
var counter : int := 60
var sysTime1, sysTime2 : int


sysTime1 := Time.Elapsed
loop
    exit when counter < 0
    sysTime2 := Time.Elapsed
    if sysTime2 > (sysTime1 + 1000) then
        sysTime1 := Time.Elapsed
        counter -= 1
    end if
    locate (1, 1)
    put counter

    if hasch then
        getch (c)
        temp += c
    end if

    locate (14, 15)
    put temp
end loop
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: