blitz3d counting error  


Attention! 👉Starting November 2024, BlitzCoder.org will now be BlitzBasic.org.

 

Tweet
Doggie
While Not KeyHit(28)
Cls
UpdateGUI(  )
Text 710,40,"Hit Enter to Stop"
If MilliSecs() > tmrSparks + 100 Then
tmrSparks=MilliSecs() 

frmSparks=( frmSparks + 1 ); Mod TotalFrames 
If frmSparks>TotalFrames Then frmSparks=1
SendMessage( lbl002, "LM_SETTEXT", "Frame #:  " + (frmSparks+1))
End If 
 testanim=LoadImage (imagename$ +(frmsparks) +".bmp")

DrawImage testanim,20,50

Flip
Cls
Wend
;Frame=numofframes
SendMessage( lbl002, "LM_SETTEXT", "Frame #:  " + Frame )
         TestImage=LoadImage (imagename$ +(Frame) +".bmp")
         DrawBlock TestImage,20,50

This will go about 19 or so times then give an image not found error.
I can't understand how that could be. I took out the "Mod TotalFrames" from the counting code but it acts the same with or with out it.
I think it's why I had to limit the number of frames to 20 and I shouldn't have to. This should be as simple as code gets...
Any ideas? Thanks

Doggie commented:

couldn't get the "code format" to work...sorry

BlitzCoder commented:

What does your debuginfo say on your Image handle? Have you tried this with just the basics and without your GUI code?

couldn't get the "code format" to work...sorry

just updated it. instead of 3x period signs (.) you use apostrophes (`), add blitzbasic after the first three on top and you're good to go.

Doggie commented:

It errors with image not found which makes no sense whatsoever unless the frame count somehow got ahead of the totalframes
and it's looking for one frame more than exists or somehow goes to 0 but neither of these things should be able to happen.
I think there's an internal bug in Blitz ...the gui code doesn't change any values so it shouldn't matter.
how can it go through the loop 19 times then all of a sudden???? Nope, thanks for looking.

  BlitzCoder commented:

I think there's an internal bug in Blitz ...the gui code doesn't change any values so it shouldn't matter. how can it go through the loop 19 times then all of a sudden????

so you are just trying to load past 20 images and this does not work? that would be very weird.

perhaps try your image as global like a type or dim or nullify the image handle before loading it again with the next one.

DIM testanim(imagecount)
Doggie commented:

What I'm attempting: since I had to limit frames to 20 I decided what if I make a version which does not produce an animstrip? Just paint and save as many frames
as I want and instead of animating with loadanimimage I'll just load each saved bmp by number and I should then be able to create unlimited frames.
I'll keep the animstrip version and a version without animstrips since I don't know how to save a gif in blitz3d I use a freeware gifmaker and load in all the bmps...
since testanim changes everytime it loads a bmp why would it need to be in an array? Maybe if somehow I preloaded every frame into a big array before flipping through
them but I don't know how to do that. It is really weird...

UPDATE: Good call! I used freeimage testanim right before loading each frame and it's working fine. Thanks!

BlitzCoder commented:

Great! glad you got that sorted out Doggie

Doggie commented:

Me too. Now if I can only find code sample to save to animated GIF I'll have a pretty complete animator.

BlitzCoder commented:

I have not come across any blitz3d/plus way of saving animated gifs, there's freeimage for blitzmax and this recently code archive that I posted. will checkout more if there's something related that I could find.

Doggie commented:

Thanks. Be sure to let me know if you find anything. I haven't seen any. I updated today to load GIFAnimator while AnimToy is running by using execfile.
Other than the logo of SSuite.com you wouldn't know it's not part of the program.

Reply To Topic (minimum 10 characters)

Please log in to reply