Computer Science Canada

Confused??

Author:  bc123 [ 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

Author:  Tony [ Sat Oct 17, 2009 3:36 pm ]
Post subject:  RE:Confused??

why would you want to pause there?

Author:  Kharybdis [ 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).

Author:  andrew. [ 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.

Author:  Tony [ 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

Author:  ecookman [ 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

Author:  SNIPERDUDE [ 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.

Author:  Tony [ Mon Oct 19, 2009 9:39 pm ]
Post subject:  RE:Confused??

also, that code is horrible.

Author:  Insectoid [ 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

Author:  ecookman [ 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?)

Author:  Insectoid [ Tue Oct 20, 2009 7:26 pm ]
Post subject:  RE:Confused??

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

Author:  Tony [ 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.

Author:  Brandon T Parsons [ 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.

Author:  Tony [ 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.

Author:  Brandon T Parsons [ 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.

Author:  Tony [ Tue Oct 20, 2009 11:31 pm ]
Post subject:  RE:Confused??

comments should be addressing the why of the code, not the what. I think everybody should be able to figure out what Draw.Box or delay(25) do.

Author:  Brandon T Parsons [ Tue Oct 20, 2009 11:43 pm ]
Post subject:  Re: Confused??

True, I'll keep that in mind next time, anyways I got school in the morning, good night. Hoping to dig out some of my programs to submit just to see what other think of them but it'll have to wait until later when I'm not tired.


: