Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solved! But.... new problem

2 views
Skip to first unread message

Knudsen

unread,
Aug 27, 2000, 3:00:00 AM8/27/00
to
I had problems with various FMTRAKKER zips I had picked up. They all
seemed to be missing a file "HSC.BI" So I emailed the guy who wrote it, and he
sent me the missing file. Now it works perfectly, and plays in the background
as well. Easy to implement too, just merge his code into your file and stick
the playtune statement into your main loop.

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?

B. Muck

unread,
Aug 28, 2000, 3:00:00 AM8/28/00
to
DATA statements need to be placed in the main module. Honestly, there aren't
too many reasons to use DATA statements anymore. There's a lot of different
ways to achieve the effects of a DATA statement such as using random access or
binary files.

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

0 new messages