I downloaded and ran the code. The first thing that happened was a bad variable was reported.
I'm pretty sure that you can't define a variable as a number. It needs to start with a letter or a word.
4#
5#
6#
...etc
These Won't do.
I changed each of these to
Row4#
Row5#
Row6#
...etc
And it ran... until it couldn't find 'drvlst#'
I changed:
IF SPRITE COLLISION (mousep#,drvlst#)=1
show sprite drvlst#
else
if sprite exist (drvlst#)=1
hide sprite drvlst#
ENDIF
endif
to:
if sprite exist (drvlst#)=1
IF SPRITE COLLISION (mousep#,drvlst#)=1
show sprite drvlst#
else
if sprite exist (drvlst#)=1
hide sprite drvlst#
ENDIF
endif
endif
Now, I know that 'drvlst#' should exist because the code 'get's the image near the beginning. Since I couldn't solve this issue quickly(i'm at work), I just put a 'if sprite exist (drvlst#)=1 ... endif' to at least get the code to run...
Aha!! It worked. The application popped up and I had a list of what was in my 'program files' directory. Once I clicked on the directory combo box, I could then click and highlight files... However, I could not change directories..? It never closed on me, either.
Anyway, below are some tips that I have found useful, and have noticed might have burnt you out. I hope you don't take it personally. I only wanted to share.
I changed the 'SET WINDOW LAYOUT 0,0,1' to 'SET WINDOW LAYOUT 0,1,2' so that I could move it around while I was testing it. (this can be changed when the app is ready to launch for commercial use...
)
IF k#=0
g#=0
endif
IF k#= -169
g#=20
endif
Is much more aesthetically pleasing and organized as:
IF k#=0 then g#=0
IF k#= -169 then g#=20
I would group commands together with some spaces so that it looks a little cleaner. This will also make it easier for your debugging purposes as well as for others that might be debugging. I commend you on your remarks, however. That is a habit that I have been slowly picking up. (shooting myself in the foot!)
set window on
set window layout 0,1,2
set display mode 468,418,32
load image "highlight.bmp",1,1
`delcaring sprite varaibles for easier reading and programming
browser#=11
checka#=12
checkb#=20
drvlst#=13
scroll#=14
mainbar#=15
MOUSEP#=2
mousel#=16
background#=3
load image "file browser.bmp",browser#,1
load image "check.bmp",checka#,1
`drvlst
create bitmap drvlst#,261,70
INK RGB(1,15,3),0
BOX 0,20,261,70
ink RGB(255,255,255),0
box 1,21,260,69
get image drvlst#,0,0,261,70,1
`end drvlst
load image "scroll bar.bmp",scroll#,1
load image "main bar.bmp",mainbar#,1
LOAD IMAGE "MOUSE.BMP",mousel#,1
get image mousep#,0,0,1,1,1
set text font "arial"
set text size 12
`background
create bitmap 2,455,339
ink rgb (255,255,255),0
box 0,0,455,339
get image background#,0,0,455,339,1
`highlight sprite
`SET UP SPRITES
sprite mainbar#,10,329,mainbar#
set sprite priority mainbar#,14
hide sprite mainbar#
sprite scroll#,27,330,scroll#
hide sprite scroll#
set sprite priority scroll#,15
`top check
sprite checka#,252,38,checka#
hide sprite checka#
`Bottom Check
SPRITE checkb#,333,359,checka#
HIDE SPRITE checkb#
`**************************************************
set dir "c:program files"
do
SET CURRENT BITMAP 0
set sprite priority checka#,12
set sprite priority checkb#,13
`background
paste image background#,9,66,100
if b#>60
show sprite mainbar#
show sprite scroll#
endif
ink RGB(1,1,1),0
`sets each row to start 72 px for the top cause sprite is covering top
Row4#=72
Row5#=72
Row6#=72
Row7#=72
Row8#=72
Row10#=72
Row11#=72
Row12#=72
Row13#=72
`starting the checklist
`and setting the cursor to print 20 lins at a time inc xpost 170 and line spacing 12px same as font size
perform checklist for files
find first
b#=checklist quantity()
for a=1 to b#
find next
a#=get file type()
if a <=20
set cursor 10+k#,Row4#
inc Row4#,12
endif
if a > 20
set cursor 180+k#,Row5#
inc Row5#,12
endif
if a > 40
set cursor 350+k#,Row6#
inc Row6#,12
endif
if a > 60
set cursor 520+k#,Row7#
inc Row7#,12
endif
if a > 80
set cursor 690+k#,Row8#
inc Row8#,12
endif
if a > 100
set cursor 860+k#,Row10#
inc Row10#,12
endif
if a > 120
set cursor 1030+k#,Row11#
inc Row11#,12
endif
if a > 140
set cursor 1200+k#,Row12#
inc Row12#,12
endif
`******************************************************************
Row90#=checklist value a(a)
`endif this code below is what actually prints the checklist on the screen. It will check and see if
`if the string /file name is longer than 170 px or 28 character and reduce it so it fitst properly.
`it also makes sure if it is a directory that it has extension .dir on it else it prints the normal file name
`and extension if the file name is longer than 170 it adds ... and dir to it.
`it servers no purpose in the acutal progam as of now exepct to let me know if a file is a dir for testing purpoes
if text width (checklist string$(a)) > 170
print left$(checklist string$(a),28)+"...."
if Row90#=1
print left$(checklist string$(a),28)+".dir"
endif
else
if Row90#=1
print checklist string$(a)+".dir"
else
print checklist string$(a)
endif
endif
next a
`setinng 2 sprites at mouse current pos
`1 for scrolling 1 for pin pointing
`and showing/hiding sprites when hit
sprite mousep#,mousex(),mousey(),mousep#
sprite mousel#,mousex(),mousey(),mousel#
`checka sprite
if sprite collision (mousep#,checka#)=1
show sprite checka#
else hide sprite checka#
endif
if sprite collision (mousep#,checka#)=1 and mouseclick()=1
sprite drvlst#,8,39,drvlst#
SET SPRITE PRIORITY drvlst#,25
endif
if sprite exist (drvlst#)=1
IF SPRITE COLLISION (mousep#,drvlst#)=1
show sprite drvlst#
else
if sprite exist (drvlst#)=1
hide sprite drvlst#
endif
endif
endif
if sprite collision (mousep#,checkb#)=1
show sprite checkb#
else hide sprite checkb#
endif
sprite browser#,0,0,browser#
set sprite priority browser#,browser#
`##############################
` keeping scroll sprite from going off the page
stop#=337+sprite x(scroll#)-sprite x(scroll#)
end#=27-sprite x(scroll#)+sprite x(scroll#)
if sprite x (scroll#) < 27
sprite scroll#,end#,330,scroll#
endif
if sprite x (scroll#) >337
sprite scroll#,stop#,330,scroll#
endif
if sprite collision (mousel#,scroll#)=1 and mouseclick()=1
sprite scroll#,mousex(),330,scroll#
if escapekey()=1
endif
endif
`page movment
`this is for scrolling of the text
`it will scroll -170 px to the left for each row of "20 lines of text" divided
` buy the width of the bar and ho many total rows of text the
page#= (int(b#/20))
k#=0
for r = 1 to page#
if sprite x(scroll#) > 710/r
inc k#,r/r+-170
endif
next r
`checkling to see witch row we are currently on
`checks up to 8 rows * 20 files per row = 160 files total at the moment
if k#=0 then g#=0
IF k#= -169 then g#=20
IF k#= -338 then g#=40
IF k#= -507 then g#=60
IF k#= -676 then g#=80
IF k#= -845 then g#=100
IF k#= -1014 then g#=120
IF k#= -1183 then g#=140
IF k#= -1352 then g#=160
` getting mouse position
line#=mousey()/12-5
`
`first if statement set so when drvlst menu drops down it doesnt interfere with selecting...
`checklist items.
if sprite exist (drvlst#)=1
if sprite collision (mousep#,drvlst#)=0
endif
`prints current checklist when mouse is clicked and hilights current one with sprite
`tells what row is being clicked and where the mouse is on that row
`1st columb
if mouseclick()=1 and mousex() < 180 and mousey()<312 and mousey() >71
hh#=text width (checklist string$(line#+g#))
sprite 1,10,line#*12+60,1
set sprite alpha 1,50
set sprite priority 1,100
size sprite 1,hh#+16,12
`print text
clic$=checklist string$(line#+G#)
endif
`2nd columb
if mouseclick()=1 and mousex()>180 and mousex()< 350 and mousey()<312 and mousey() >71
rr#=text width (checklist string$(line#+20+g#))
sprite 1,180,line#*12+60,1
set sprite alpha 1,50
set sprite priority 1,100
size sprite 1,rr#+16,12
`prints text
clic$=checklist string$(line#+20+G#)
endif
`3rd columb
if mouseclick()=1 and mousex() >=350 and mousex()<455 and mousey()<312 and mousey() >71
tt#=text width (checklist string$(line#+40+g#))
sprite 1,350,line#*12+60,1
size sprite 1,tt#+16,12
set sprite alpha 1,80
set sprite priority 1,100
`prints text
clic$=checklist string$(line#+40+G#)
endif
endif
`tried to do set dir clic$ but didn't work
text 110,362,clic$
loop
It looks cool!
As far as your programming level... There is some pretty good stuff in here. I would keep it up if I were you. This could be a handy function for people in the community to use when saving, loading games/pics/etc.
Cheers!