Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SLEEP: work-around
#1
this is the work-around for SLEEP keyword. currrently FB using straight of milliseconds measurement from the API. example below is methods to use usual SLEEP in seconds.

Code:
print "testing sleep 2 seconds"

sec = 1000
sleep 2*sec

print "wake-up now."
print
input "press ENTER to exit...",pause
= inc(¢) Big Grin
Reply
#2
Milliseconds is a better idea overall

And you know..

QB:
Sleep 2

FB:
Sleep 2000


It's not that hard to translate Smile
Reply
#3
BTW, that's a conversion, not a work-around.

A workaround would be more like (using QB code for fun):

A$=input$(1)

or do: loop until inkey$<>""

Because, you are working *around* the keyword SLEEP. :bounce:
ric Carr
Reply
#4
Eric Carr, the creator of Spinball here!
I found Spinball at the ABC packets back in 1999 when i started submitting there....a long time ago.

Welcome!

(FB is magic!)

Perhaps you are planning a FB port of Spinball?

And for SLEEP it was never a safe QB keyword: crashed when used with multikey routines, did'nt work compiled with QB4.0 (the thing people used before ffix).

So if we have a SLEEP with microsecond accuracy we can't complain. How many SLEEP's will you have to change in a normal program? three or four. The problem would be if v1ctor had enforced the use of LET Big Grin
Antoni
Reply
#5
Quote:Eric Carr, the creator of Spinball here!
I found Spinball at the ABC packets back in 1999 when i started submitting there....a long time ago.

Welcome!

Thanks!

Yeah, those were the days. I actually made that game in '96, I think it was the April '96 packet.. Wow, so long ago..

Thought I would jump on the FB bandwagon. :-)


Quote:Perhaps you are planning a FB port of Spinball?

Perhaps.... I was thinking something 3dish... Using sdl / opengl.. Maybe I'll make a 3D (still 2D levels and gameplay) Spinball remake... I just don't have too much free time these days. What with job, consulting on the side, and .... playing computer games.. .. Smile

I'm also addin some new features to that cool FBIde program written by VonGodric. That's C++ though, not basic.
ric Carr
Reply
#6
I have found SLEEP n unreliable after using PLAY etc. If others have similar difficulties try using SOUND 30000, n to create inadible sound but a simlar delay. This is how I created a menu of all the PLAY tunes someone kindly uploaded from the old ABC site.

Gordon
Reply
#7
FB doesn't have PLAY or SOUND... :???:
Reply
#8
Quote:BTW, that's a conversion, not a work-around.

A workaround would be more like (using QB code for fun):

A$=input$(1)

or do: loop until inkey$<>""

Because, you are working *around* the keyword SLEEP. :bounce:
Hmm...

Code:
secondstowait = 2
t! = TIMER
DO:LOOP WHILE t!+secondstowait>TIMER

Any objections versus this "workaround"? Wink

EDIT: I like this one better than sleep because inside the do loop loop you can do something, like updating sound or GFX, while sleep is just sitting there playing pocket billard.
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Reply
#9
Quote:EDIT: I like this one better than sleep because inside the do loop loop you can do something, like updating sound or GFX, while sleep is just sitting there playing pocket billard.

Yes, idealy you would never use sleep, you would loop and capture keypresses in your main game loop. Basically an advanced version of what you posted. :-)

I rarely used sleep, maybe to pause at some text screen but that's about it.

Eric
ric Carr
Reply
#10
I've found that in QB, SLEEP 2 pauses two seconds but you can press a key and the pause will be broken, so you can use it as a "timed 'press a key'".

So I took this old code of mine which used a SLEEP seconds% and changed it to SLEEP seconds% * 1000 in FB... But alas, pressing a key didn't break the pause. I have yet to isolate a SLEEP command and try it to check if it is a different behaviour between QB and FB or simply my bad program logic.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)