Loop within a function? Show me how

Blitz3D Forums/Blitz3D Beginners Area/Loop within a function? Show me how

jigga619(Posted 2008) [#1]
I made a program with several functions in it. Each function is basically a SEPERATE screen showing JPG images.


The problem is I need a LOOP within each function and when I do try to make a loop, it NEVER shows the images that are suppose to be shown. Instead the program goes to the function and Freezes up. for example


;initiate settings and stuff

;MAIN GAME LOOP

while not keydown(1)

; just 1 function



if such and such

thisscreen()

endif


wend






function thisscreen()

while not keydown(1); my loop that never works in the function

drawimage 1,20,20

if such and such
do this
endif


wend

end function



;and this is where the program freezes up. How can I
;correctly add a CONDITIONAL loop to a FUNCTION?


Nate the Great(Posted 2008) [#2]
are you still using cls and flip in the second loop? sometimes not flipping the buffers causes my computer to freeze.


GfK(Posted 2008) [#3]
drawimage 1,20,20
Are you even allowed to use numbers as variable names?

sometimes not flipping the buffers causes my computer to freeze.
This will never cause your computer to freeze.

By not flipping the buffers, you never see anything that's been drawn to the backbuffer. But the program *is* still running.


Ross C(Posted 2008) [#4]
Yeah, 1 probably isnt a valid image handle, as it's a memory pointer, and 1 is awfully low.


Nate the Great(Posted 2008) [#5]
GFK

IDK why it causes my comp to freeze maybe it is something about vista. It doesn't happen on my other comp.


Andy(Posted 2008) [#6]
put a 'flip' before 'wend'


jigga619(Posted 2008) [#7]
Thanks I got it to work.