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

Username:   Password: 
 RegisterRegister   
 Digital Clock
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shabz_shabz




PostPosted: Mon Jun 11, 2007 7:27 pm   Post subject: Digital Clock

hi.. i made a remote control interface fr my class project..

and i have evrything done

but i need to know if there is any kind of turing code so that i can see digital time while running my program . so i can have the same time showin in the turing program as my pc.

pls let me know

if u want i can upload my turing program as well..

Thanks
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Mon Jun 11, 2007 7:45 pm   Post subject: RE:Digital Clock

Searching the Turing Documentation for time I came across the procedure (drum roll), time(). While I don't like procedures that modify your variables on you, I can't see any other function that returns just the time, but there is Time.Date if you want to look at that.
shabz_shabz




PostPosted: Mon Jun 11, 2007 8:12 pm   Post subject: RE:Digital Clock

var theDateTime, theDate, theTime : string
theDateTime := Time.Date
theDate := theDateTime (1 .. 9)
theTime := theDateTime (11 .. *)
put "Greetings!! The date and time today is ", Time.Date


but thas just shows if u run the program..

i want the time to keep running at the top - or whever i place it ..

i want a digital clock running forever changin each sec .. u noe wht i mean..

i want a digital clock to appear which has the same time as my pc
Clayton




PostPosted: Mon Jun 11, 2007 8:17 pm   Post subject: RE:Digital Clock

Do you mean in the titlebar?

Turing:

loop
    %whatever
    View.Set ("title:" + Time.Date)
end loo
shabz_shabz




PostPosted: Mon Jun 11, 2007 8:22 pm   Post subject: Re: Digital Clock

code:


loop
    %whatever
    View.Set ("title:" + Time.Date)
end loop


Thanks alot for your quick responses.

But how am i going to use that ?

this is my code as follows

code:

%Car Ineterface

setscreen ("graphics:1000;700")

var picID3 : int
picID3 := Pic.FileNew ("welcomescreen.jpg")
Pic.Draw (picID3, 50, 50, picCopy)

drawbox (492, 312, 620, 159, black) %around the enter logo button

var music : boolean := true     % regulates the music
process musik     % Plays ""Do Ya Thang"
    music := false
    loop
        exit when music
        Music.PlayFile ("Do Ya Thang.mp3")
        Music.PlayFileStop
    end loop
end musik

var p, i, g : int            % variables to track the mouse and mouse button
loop
    mousewhere (p, i, g) % reads x/y mouse coordinates and button status
    if p > 492 and i > 159 and p < 620 and i < 311 and g = 1 then       

        var picID1, picID2, picID4, picID5 : int



        picID2 := Pic.FileNew ("ferrari-front-end-wallpaper.jpg")

        picID4 := Pic.FileNew ("Picture1.jpg")
        picID1 := Pic.FileNew ("Picture7 777copy.jpg")

        Pic.Draw (picID2, 0, 0, picCopy)
        delay (2000)
        cls
        Pic.Draw (picID4, 0, 0, picCopy)
        delay (2000)
        cls

        %GUI.SetBackgroundColor (black)

        Pic.Draw (picID1, 50, 50, picCopy)


        drawbox (732, 230, 802, 148, white) %back

        drawbox (731, 414, 802, 334, white) %forward

        drawbox (712, 286, 644, 352, white) %forward left

        drawbox (890, 288, 823, 355, white) %forward right

        drawbox (717, 209, 651, 274, white) %forward left

        drawbox (891, 215, 822, 282, white) %forward right


        drawbox (818, 652, 740, 575, grey) %play button
        drawbox (836, 652, 913, 575, grey) %stop button

        %right bar decrease - left , increase right ,, up bar decrease - down , increase up ,, left bar decrease left, increase right,, down bar decrease down, increase up


        var x, y, b : int := 1 % variables to track the mouse and mouse button
        loop
            mousewhere (x, y, b) % reads x/y mouse coordinates and button status (1=down)
            if x > 733 and y > 148 and x < 802 and y < 230 and b = 1 then %back
                %parallelput (15)
                Draw.Text ("Back", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 380, 140, white)
            elsif x > 731 and y > 334 and x < 802 and y < 415 and b = 1 then       %forward
                Draw.Text ("Forward", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 380, 140, white)
                %parallelput (6)
            elsif x > 644 and y > 286 and x < 712 and y < 352 and b = 1 then %forwardleft
                Draw.Text ("Forward Left", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 480, 140, white)
                %parallelput (4)
            elsif x > 823 and y > 288 and x < 890 and y < 355 and b = 1 then %forwardright
                Draw.Text ("Forward Right", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 480, 140, white)
                %parallelput (10)
            elsif x > 651 and y > 209 and x < 717 and y < 274 and b = 1 then %backleft
                Draw.Text ("Back Left", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 480, 140, white)
                %parallelput (13)
            elsif x > 822 and y > 215 and x < 891 and y < 282 and b = 1 then %backright
                Draw.Text ("Back Right", 250, 220, Font.New ("Impact:25"), black)
                delay (50)
                drawfillbox (220, 300, 480, 140, white)
                %parallelput (3)

            elsif x > 740 and x < 818 and y > 575 and y < 652 and b = 1 then  %Music Play Button
                fork musik


                elsif x > 836 and    x < 913    and    y > 575     and   y < 652 and  b = 1 then           % Stops Music
                  music := true
                  Music.PlayFileStop

                 else                                                                    %stops car
                %parallelput (0)
            end if
        end loop




        %Car Ineterface


    end if
end loop





And yea that might work too, time and date in the title bar . but how? please guide me . im really lost.

ANd yea, if you can give me feedback too for my program it wuld be great. if u want to check download and open the file -
" 222222newnewnew.t "

download
http://www.megaupload.com/?d=Y0DELJ7D

I wuld be very delighted if u can check my program and giive me feedback as well


Thanks
shabz_shabz




PostPosted: Mon Jun 11, 2007 8:37 pm   Post subject: RE:Digital Clock

http://www.megaupload.com/?d=Y0DELJ7D

here , this is the rite one . i posted the wrong link earlier..

i posting this link again even tho i edited it in my previous post.

Waiting for replies

Thanks alot
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  [ 6 Posts ]
Jump to:   


Style:  
Search: