
-----------------------------------
bc123
Sat Oct 17, 2009 3:30 pm

Confused??
-----------------------------------
Hey i wanted to know how to make a pause like for eg.


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

-----------------------------------
Tony
Sat Oct 17, 2009 3:36 pm

RE:Confused??
-----------------------------------
why would you want to pause there?

-----------------------------------
Kharybdis
Sat Oct 17, 2009 3:38 pm

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.
Sat Oct 17, 2009 4:04 pm

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
Sat Oct 17, 2009 4:27 pm

RE:Confused??
-----------------------------------
http://compsci.ca/blog/wp-content/uploads/2007/06/loading_bar_decision.png

[url=http://compsci.ca/blog/now-loading-loading-bar-anti-pattern/]Now Loading? Loading Bar anti-pattern

-----------------------------------
ecookman
Sun Oct 18, 2009 8:34 pm

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
Mon Oct 19, 2009 8:49 pm

Re: 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

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
Mon Oct 19, 2009 9:39 pm

RE:Confused??
-----------------------------------
also, that code is horrible.

-----------------------------------
Insectoid
Tue Oct 20, 2009 10:49 am

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)


loop
    put "How the hell will I make this display over and over again?!"
end loop


-----------------------------------
ecookman
Tue Oct 20, 2009 3:23 pm

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
Tue Oct 20, 2009 7:26 pm

RE:Confused??
-----------------------------------
No..I was trying to make the syntax tag work...

-----------------------------------
Tony
Tue Oct 20, 2009 7:39 pm

Re: RE:Confused??
-----------------------------------
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.

-----------------------------------
Brandon T Parsons
Tue Oct 20, 2009 10:50 pm

Re: RE:Confused??
-----------------------------------
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.


%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
Tue Oct 20, 2009 11:08 pm

Re: Confused??
-----------------------------------
Brandon, your explanation is fine, although the amount of comments seems to be excessive.

Oh, and this reminds me of the [url=http://compsci.ca/v3/viewtopic.php?t=671]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.

-----------------------------------
Brandon T Parsons
Tue Oct 20, 2009 11:21 pm

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.

-----------------------------------
Tony
Tue Oct 20, 2009 11:31 pm

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.

-----------------------------------
Brandon T Parsons
Tue Oct 20, 2009 11:43 pm

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.
