PDA

Click to See Complete Forum and Search --> : Loop with an unknown end?


SteveCRM
Jul 4th, 2000, 08:59 AM
Okay, I know this makes a loop go for 1000 whatevers.
Dim i as integer
For i = 1 to 1000
'all my code in here
Next i

But Im making an online game (almost done too :)) but I want a loop to keep send my coordinates to the other person, but I don't want to use a timer, because that defeats the purpose of using BitBlt. And I don't know how long each game is going to go on. Anyone got any ideas?

Fox
Jul 4th, 2000, 09:05 AM
You have done a game without any idea how to do that? wow ;)

ok, heres the idea: Make a loop that runs all the time till you exit the program. There you can make timing with GetTickCount or something and send whatever all the time. Looks like this:


'Declares
Dim Active as Boolean

'Form_Load
Active = True
While Active = True
'Game comes here ;)

DoEvents
Wend
End

'Form_Unload
Active = False

Fox
Jul 4th, 2000, 09:06 AM
(Don't forget to show the Form before running the loop ;))

SteveCRM
Jul 4th, 2000, 09:08 AM
Thanks fox, I'll give it a try.

SteveCRM
Jul 4th, 2000, 09:10 AM
Oh boy, I must be loosing it, the answers are so easy yet I never find them :(. Thanks fox! :)

Fox
Jul 4th, 2000, 09:16 AM
no problem ;)