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

Username:   Password: 
 RegisterRegister   
 Confused??
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bc123




PostPosted: Sat Oct 17, 2009 3:30 pm   Post subject: Confused??

Hey i wanted to know how to make a pause like for eg.

Turing:

var pin : int
locate (1,30)
put "Pin Cracker"
put "please enter 10 digit pin number"
get pin
put "proccessing"
heres wait i want a pause to act like it is realy processing XD any ideas?
put "Your 10 digit pin is : ", pin

help me plzz! XD
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sat Oct 17, 2009 3:36 pm   Post subject: RE:Confused??

why would you want to pause there?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Kharybdis




PostPosted: Sat Oct 17, 2009 3:38 pm   Post subject: RE:Confused??

Instead of a pause, try to make a small loading bar. Pauses (i think you mean the command delay here) are useless and make people irritated when they use your program. Trust me, there's going to be enough pausing if you go into higher programming... where one computation takes like a day to complete (at least on turing).
andrew.




PostPosted: Sat Oct 17, 2009 4:04 pm   Post subject: RE:Confused??

You can use a delay, but it's pointless. If you really want to do it though, use the command "delay (time)" where time is the time in milliseconds it should pause for.
Tony




PostPosted: Sat Oct 17, 2009 4:27 pm   Post subject: RE:Confused??

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Now Loading? Loading Bar anti-pattern
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ecookman




PostPosted: Sun Oct 18, 2009 8:34 pm   Post subject: RE:Confused??

loop
delay (300)
cls
put "loading."

delay (300)
cls
put "loading.."

delay (300)
cls
put "loading..."

delay (300)
cls
put "loading.."

delay (300)
cls
put "loading."

delay (300)
cls
put "loading"

end loop
SNIPERDUDE




PostPosted: Mon Oct 19, 2009 8:49 pm   Post subject: Re: RE:Confused??

ecookman @ October 18th 2009 wrote:
loop
delay (300)
cls
put "loading."

delay (300)
cls
put "loading.."

delay (300)
cls
put "loading..."

delay (300)
cls
put "loading.."

delay (300)
cls
put "loading."

delay (300)
cls
put "loading"

end loop


A) Use code tags!

B) Same as with a loading bar, it is not needed if it takes under 3 seconds to load the programme.
Tony




PostPosted: Mon Oct 19, 2009 9:39 pm   Post subject: RE:Confused??

also, that code is horrible.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Tue Oct 20, 2009 10:49 am   Post subject: RE:Confused??

ecookman, notice how you are doing almost the same thing over and over again? Hmm...it's almost like it's repeating itself, defined as repetition. Things happening more than once. What kind of structure makes things happen more than once (repeating itself; repetition)

Turing:

loop
    put "How the hell will I make this display over and over again?!"
end loop
ecookman




PostPosted: Tue Oct 20, 2009 3:23 pm   Post subject: RE:Confused??

Yes, yes that's all nice and good, but what is so horrible about my . .. ... animation. I thought it was clever. >_>

(Wow inscetoid 5 edits...couldn't fit all of that anger at one time eh?)
Insectoid




PostPosted: Tue Oct 20, 2009 7:26 pm   Post subject: RE:Confused??

No..I was trying to make the syntax tag work...
Tony




PostPosted: Tue Oct 20, 2009 7:39 pm   Post subject: Re: RE:Confused??

ecookman @ Tue Oct 20, 2009 3:23 pm wrote:
I thought it was clever.

Repeating the same block of code 6 times is not clever.

You can figure out the number of periods needed with a single for-loop.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Brandon T Parsons




PostPosted: Tue Oct 20, 2009 10:50 pm   Post subject: Re: RE:Confused??

Tony @ Tue Oct 20, 2009 9:09 pm wrote:
ecookman @ Tue Oct 20, 2009 3:23 pm wrote:
I thought it was clever.

Repeating the same block of code 6 times is not clever.

You can figure out the number of periods needed with a single for-loop.


Don't forget to mention his code is in a loop, with no exit statement, so it will continue forever unless the program is closed which is not what the poster wanted.


On topic, if you want to make a loading bar you could simply

first, you need to know the Draw.Box command

the Draw.Box syntax is Draw.Box (x1, y1, x2, y2, color) and what it does it is draws a box starting at the position x1,y1 with an ending position of x2,y2 and the color of the box will be what color you specify.

Turing:

%clearing the screen to remove any clutter
cls

%draws the margins of the loading bar
Draw.Box (200, 100, 500, 200, black)

for i : 200 .. 500 %starting from the first x value (x1), going to the second x value  (x2)
    %it will draw a box with the first x changed to whatever the loop number currently is to create an illusion of the bar being filled
    Draw.Box (i, 100, 500, 200, black)
    %adds a delay so it seems to be loading
    delay (25)
end for


You can change "black" to whatever color you want the bar to be (you made need to use the number of the color, for example 10 is light green) and you can change the "starting/ending" x values to change the width of the bar, just be sure to edit the for loop, and change the Y values also to change the height of the bar.

Note: Changing the X and Y values will also move the position of the bar, for example if x1 is 1,and y1 is 1 then the bar will start at 1,1 (bottom left corner) and if x2 is 20, and y2 is 20, the bar will end at 20,20.

-
Sorry if my explanation is terrible, I'm bad at explaining things, I'm working on it though.
Tony




PostPosted: Tue Oct 20, 2009 11:08 pm   Post subject: Re: Confused??

Brandon, your explanation is fine, although the amount of comments seems to be excessive.

Oh, and this reminds me of the old topic from 2003 where we've done some GUI elements, including loading bars (meant for actual loading). Sample screen shot is attached. It's a good thread, though I can't say the same about the actual code anymore.



Picture 4.png
 Description:
preview of loading bar GUI element
 Filesize:  4.11 KB
 Viewed:  2667 Time(s)

Picture 4.png


Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Brandon T Parsons




PostPosted: Tue Oct 20, 2009 11:21 pm   Post subject: Re: Confused??

Okay, I'll cut down on the commenting, was just making sure people could understand exactly what was happening, most of my code doesn't go into very detailed comments like that.
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: