Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

causing pauses using graphics

PluralOfJesusPluralOfJesus Member Posts: 1
Hi, I'm trying to create a pause in my program as i display different graphics (in a loop) but i'm trying to find a way to create the pause where it doesn't matter on the processor speed of the computer. sleep statements can be bipassed by hitting space and for, next loops are dependant on the computers processor speed. wondering if you know of any other ways i could set this up. thanks.

~Josh

Comments

  • retrogeekretrogeek Member Posts: 93
    : Hi, I'm trying to create a pause in my program as i display different graphics (in a loop) but i'm trying to find a way to create the pause where it doesn't matter on the processor speed of the computer. sleep statements can be bipassed by hitting space and for, next loops are dependant on the computers processor speed. wondering if you know of any other ways i could set this up. thanks.
    :
    : ~Josh
    :

    Check out the "WAIT" statement. Or, try "ON TIMER".

    rg
  • the walrusthe walrus Member Posts: 249
    [b][red]This message was edited by the walrus at 2003-3-10 12:0:19[/red][/b][hr]
    [code]
    StartTimer = TIMER
    DO UNTIL TIMER - StartTimer >= [italic]Seconds[/italic]: LOOP[/code]

    just substitute [italic]Seconds[/italic] for a number in seconds that you want it to pause...the problem with this is Seconds cant be too small (like .001) or else it wont have an effect...ive had to try to create a game that would pause just enough so that on real fast computers it would run normally, but it wouldnt go to slow on slow computers...to do this i used a for next loop with a variable (ie For xl = 1 to xPause: Next)...then at the beginning of the program i used something like:

    [code]
    SUB SetSystem
    DIM FindTK AS INTEGER, STim AS DOUBLE, L2 AS INTEGER
    CLS
    PRINT "Setting for system..."
    L2 = 1
    ReFndTK: STim = TIMER
    FOR Loops2 = 1 to L2
    FOR Loops = 1 to 1000: FOR FindTK = 1 TO 30000: NEXT: NEXT
    NEXT
    IF TIMER - STim = 0 THEN L2 = L2 * 2: GOTO ReFndTK
    TimerK = (1000 * L2) / (TIMER - STim) / 1.9
    CLS
    END SUB

    SUB Hold (hLength as DOUBLE)
    Dim STim AS INTEGER
    FOR Loops = 1 TO (TimerK * hLength): FOR STim = 1 TO 3000: NEXT: NEXT
    END SUB[/code]

    then whenever i want it to pause:
    [code]
    DIM SHARED TimerK AS DOUBLE
    SetSystem

    [red][/red]
    'to pause for .01 interval
    Hold .01
    [red][/red]
    'to pause for .1 interval
    Hold .1
    [red][/red][/code]


  • tlmcduffietlmcduffie Member Posts: 9
    : Hi, I'm trying to create a pause in my program as i display different graphics (in a loop) but i'm trying to find a way to create the pause where it doesn't matter on the processor speed of the computer. sleep statements can be bipassed by hitting space and for, next loops are dependant on the computers processor speed. wondering if you know of any other ways i could set this up. thanks.
    :
    : ~Josh
    :

    Here is a sample program using a subroutine that will pause for approximately 5 seconds. It uses the system clock, so your processor speed will not matter. Keystrokes during the pause won't hurt either. You may copy and paste it. Hope this helps ! Good Luck !!


    print "This is now"
    gosub haltRoutine
    print "This is about 5 seconds later"
    end

    haltRoutine:
    t$=time$
    startSecond%=val(mid$(t$,7,2))
    secondDiff%=0
    do
    t$=time$
    currSecond%=val(mid$(t$,7,2))
    secondDiff%=abs(currSecond%-startSecond%)
    if secondDiff%> 4 then
    exit do
    end if
    loop
    return

  • Folker FritzFolker Fritz Member Posts: 19
    : [code]
    : StartTimer = TIMER
    : DO UNTIL TIMER - StartTimer >= [italic]Seconds[/italic]: LOOP[/code]


    that's the best way to do it and how i do it now too. but when i was new in programming in qbasic i have used the PLAY command.

    [code]
    PLAY "l64n0"
    [/code]

    where l64 is the speed, a lower number is slower (longer pause) and a higher number (64 is maximal value) is the faster. n0 is the pause, n0n0 whould be two of them...
Sign In or Register to comment.