Liberty BASIC Community Forum
« COLECTION BOUNDS »

Welcome Guest. Please Login or Register.
Jan 22nd, 2018, 5:49pm


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: COLECTION BOUNDS  (Read 356 times)
kevin
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 418
xx COLECTION BOUNDS
« Thread started on: Jun 3rd, 2017, 08:06am »

IM GOING THROUGH ALL MY OLD lb THINGS that I made in the past
ive come over one that when I tried to run it, just comes up with an error sign saying "index 853 Outside of collection bounds

does any one know what this means??

Kevin
here is the code
Code:
'Run this program from the root LB directory
'so that it can find the sprite bitmaps.
nomainwin
UpperLeftX = 10
 UpperLeftY = 10

    'this is the sprite bitmap
    loadbmp "b5", "bmp\LED5.bmp"
    loadbmp "b4", "bmp\LED4.bmp"
    loadbmp "b3", "bmp\LED3.bmp"
    loadbmp "b2", "bmp\LED2.bmp"
    loadbmp "B1", "bmp\LED1.bmp"


    WindowHeight = 300:WindowWidth = 400

    'sprites can only appear in a graphics window or graphicbox
    open "sprite test" for graphics_nf_nsb as #wg

    'trap the close event so the code can issue
    'the proper CLOSE and END commands
    #wg "trapclose [quit]"

    'add a sprite
    #wg "addsprite bar b1 b2 b3 b4 b5"

    'give a location to sprite:
    #wg "spritexy bar 10 10"

    'cause images to show

    timer 500, [a]
    wait
    [a]
scan
print #wg, "cyclesprite bar 1"
      #wg "drawsprites"
wait

[quit]
timer 0
    unloadbmp "b1"
     unloadbmp "b2"
      unloadbmp "b3"
       unloadbmp "b4"
        unloadbmp "b5"
    close #wg:end

 

« Last Edit: Jun 3rd, 2017, 08:22am by kevin » User IP Logged

KEVIN
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: COLECTION BOUNDS
« Reply #1 on: Jun 3rd, 2017, 09:25am »

You have B1 and b1, if that does not fix it tell us which line it stops on. Use the debugger.
User IP Logged

kevin
Senior Member
ImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 418
xx Re: COLECTION BOUNDS
« Reply #2 on: Jun 3rd, 2017, 10:12am »

I have slightly alter the code correcting the mistakes with B1 and b1 to just b1 but it still hols at line with the same error msg
Code:
 loadbmp "b1", "bmp\LED1.bmp" 

I want to find out why its doing this or what is causing it so that I can prevent this in the Future
Code:
'Run this program from the root LB directory
'so that it can find the sprite bitmaps.
nomainwin
UpperLeftX = 10
 UpperLeftY = 10

    'this is the sprite bitmap
    loadbmp "b5", "bmp\LED5.bmp"
    loadbmp "b4", "bmp\LED4.bmp"
    loadbmp "b3", "bmp\LED3.bmp"
    loadbmp "b2", "bmp\LED2.bmp"
loadbmp "b1", "bmp\LED1.bmp"


    WindowHeight = 300:WindowWidth = 400

    'sprites can only appear in a graphics window or graphicbox
    open "sprite test" for graphics_nf_nsb as #wg

    'trap the close event so the code can issue
    'the proper CLOSE and END commands
    #wg "trapclose [quit]"

    'add a sprite
    #wg "addsprite b1 b1 b2 b3 b4 b5"

    'give a location to sprite:
    #wg "spritexy bar 10 10"

    'cause images to show

    timer 500, [a]
    wait
    [a]
scan
print #wg, "cyclesprite bar 1"
      #wg "drawsprites"
wait

[quit]
timer 0
    unloadbmp "b1"
     unloadbmp "b2"
      unloadbmp "b3"
       unloadbmp "b4"
        unloadbmp "b5"
    close #wg:end


 
« Last Edit: Jun 3rd, 2017, 10:15am by kevin » User IP Logged

KEVIN
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5618
xx Re: COLECTION BOUNDS
« Reply #3 on: Jun 3rd, 2017, 11:47am »

Check your bmp image, is it the same format as the other images, is it 24bit or 32bit, does it use the alpha channel? redo your image in paint and save it as exactly the same format as the other led images.
User IP Logged

CarlGundel
Administrator
ImageImageImageImageImage


member is offline

Avatar

author of Liberty BASIC


Homepage PM


Posts: 2833
xx Re: COLECTION BOUNDS
« Reply #4 on: Jun 3rd, 2017, 3:09pm »

on Jun 3rd, 2017, 11:47am, Rod wrote:
Check your bmp image, is it the same format as the other images, is it 24bit or 32bit, does it use the alpha channel? redo your image in paint and save it as exactly the same format as the other led images.

This may do the trick. Make a copy of the image as a backup, and then open the image and save it using Microsoft paintbrush (mspaint.exe).

I have seen this work for others.

BTW this is a good use for Lite Debug, when you have an error like that it may be able to open the debugger where the error happens.

-Carl
« Last Edit: Jun 3rd, 2017, 3:10pm by CarlGundel » User IP Logged

author of Liberty BASIC
http://www.libertybasic.com
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls