GLBasic forum

Main forum => GLBasic - en => Topic started by: spacefractal on 2010-Mar-07

Title: editor jumps annorying on "no file" on exit.
Post by: spacefractal on 2010-Mar-07
how do I detect if a sprite exists or not, whithout the editor jump to that line on exists... which is pretty annoyring.

I use something like this:

GETSPRITESIZE t, XX, YY

And if XX is 0, I asume there is no sprite here and do some code here.

If a do its on a TRY command, the editor just annoyring jump there instead.

I hate when the editor jump to these commands on exists, so I need to scroll where I was code every time, when I known there is no bug here......

I need to find a with to detect if a sprite exists or not WITHOUT these annoyring jumps.

PS. It might have caused by LOADSPRITE when no file found, but I dont think that is a issue, but using DOESFILEEXIST now instead to avoid that editor jump.
Title: Re: editor jumps annorying on "no file" on exit.
Post by: Moru on 2010-Mar-07
Do you have some code example on how you do it?
Title: Re: editor jumps annorying on "no file" on exit.
Post by: MrTAToad on 2010-Mar-07
Sounds like you need to use GENSPRITE() to find the first free sprite.
Title: Re: editor jumps annorying on "no file" on exit.
Post by: spacefractal on 2010-Mar-07
the code its self works as it should.

This is just do I wanted to automatic load the files with might have varied length of animations.

I now use this:

Code (glbasic) Select

FOR r=1 TO MAXANIMHEADS
FOR i=1 TO 10
t=r*10+i-1
A$="headtile_"+r+"_"+i+".png"
IF DOESFILEEXIST(A$)=1
DEBUG A$+" "+t+"\n"
LOADSPRITE A$, t
ELSE
BREAK
ENDIF
NEXT
NEXT


In the old code, I loaded the sprite regaardless the file was exists or not, then use BREAK when the size of sprite was zero. The code elsewise ran fine, but just jump into the GETSPRITESIZE command (after the LOAD command)after the app exists....

PS. Im are aware of the GENSPRITE(), but is not required in this app.
Title: Re: editor jumps annorying on "no file" on exit.
Post by: Kitty Hello on 2010-Mar-08
I don't get it. What's the problem again?