OK, that out of the way, I have a new problem.
What exactly are you not allowed to do in a SUB? I ran out of space in my
main file so I started trying to stick things into SUBS. However, this produces
all sorts of weird results. Some of the variables are carried over, and some
aren't.
Basically, I have a map editor for my scrolling engine, which uses Put
statements and x y offsets. The editor is perfect and blazingly fast in it's
original state. However, when I put my "Drawtile" routine into a SUB, the
screen won't redraw, yet the coordinates still change. Also the speed takes a
HUGE hit. The code in the sub is exactly the same as it was before. I used it
in the main file as a
GOSUB drawtile
drawtile:
blah blah
RETURN
Type thing and it works great. What is the difference between these types
of SUBs and the ones seperate from the main program? And how do I get the
variables to transfer to the SUB.
I just want it to work as it did before but in a seperate SUB to open space in
the mainfile and to generally organize the code. Is there some special syntax
for this? Any help is appreciated.
Oh yeah... apparently DATA statement don't work in a SUB. What gives?
Also, rather than use SUBs (GOSUB, RETURN etc...), try using subroutines. Click
on "Edit" and then "New Sub" to create one. Only variables that are either
declared as global (use COMMON SHARED for variables, DIM SHARED for arrays) or
passed to the subroutine in the calling parameters can be used/altered in both
the main module and the subroutine. Variables that are local only to
subroutines also lose their value after the subroutine has completed running.
Use the STATIC command to preserve their values between calls.
cheers,
Brendon
Be distinct, or be extinct.
http://members.aol.com/brainsawx