Tips and Tricks for the ST Owner
By Heidi Brumbaugh
START Programs Editor
GOTO Where the Whimsy Takes You
GFA BASIC's procedures encourage programmers to use structured programming
to solve problems. GFA BASIC's ON GOSUB command and the new SELECT CASE
syntax in version 3.0 render the GOTO statement practically a dinosaur.
However, GFA goes so far as to prevent you from using GOTO inside FOR NEXT
loops, procedures and (in 3.0) functions. The following program:
FOR i=1 TO 10
IF i=5
GOTO getout
ENDIF
NEXT I
'
getout:
PRINT "Out of the loop; i is"'i
will generate an error message because of the GOTO statement inside the FOR NEXT loop. There is a way around this limitation, however. Although you cannot GOTO out of a procedure, you can RESUME out of an error-trapping routine, and since you can generate an error using the ERROR command you can effectively use RESUME to go anywhere in a program:
ON ERROR GOSUB goto_getout
FOR i=1 TO 10
IF i=5
ERROR 100
ENDIF
NEXT I
'
getout:
PRINT "Out of the loop; i is"'I
END
PROCEDURE goto_getout
IF ERR=100
RESUME getout
ENDIF
RETURN
This program will jump out of the FOR NEXT loop when the error is encountered (I used error 100 because it wouldn't occur naturally in a program). The program will continue at the label getout and print the value of i, which will be 5.
This trick will work from inside procedures or functions. You can even RESUME to a label inside a different procedure; however, doing this may generate an error or have unexpected results.
Help to Escape
If you are using a GEM version of ST Writer pressing [Esc] doesn't
always bring you back to the GEM menu bar. This happens frequently in the
newest version (published in the April 1989 issue of START) and is caused
by the mouse being on the top line of the ST Writer screen - regardless
of whether the mouse pointer is visible. Simply move the mouse down a little
to return to the menu.
Pixel Ruler
Ever needed precise pixel measurements to incorporate images from a
picture into your program? Frank Cohen, author of Boingo in this issue,
solved this problem by creating a ruler which measures off pixels. This
ruler is included in one of his data files for Boingo; to use it yourself
simply load the file BOINKMEN.PC1 (from BOINGO.ARC) into a paint program.
Draw over the Boingo character images and save the picture out under a
different name (for example, RULER.PC1). Be sure not to alter the original
BOINKMEN.PC1 file from your game disk or Boingo will not play properly.
ARC on IBM
The Archives Utilities Set (ARC) is a standard not just in the ST world
but for most microcomputers. Thus if you have an IBM PC or compatible you
can download ST programs from your favorite online service, un-ARC them
right away on you PC and then loan them directly to your ST since it can
read an MS-DOS-formatted disks directly. (Of course, you can still only
run ST programs on an ST.)
Bouncing Along
Spend a lazy day blowing bubbles playing Taito's new fast-action arcade
game, Bubble Bobble. This game pits you, Brontosaurus Bub or Bob, against
armies of fiends and beasties. Bubbles are breakable, but it turns out
you can bounce on most of the bubbles in the game. In order to bounce,
press the trigger and move the stick to jump onto the bubble. Once you
are bouncing, do not release the joystick button or move the stick; they
must remain in the same position. This is a tricky maneuver, but one well
worth the practice time.
Got an ST trick or tip to share? We're interested in tips for the rank beginner or expert programmer, for exploring the Desktop or for getting the most out of any popular ST program. Send your tips to the Clipboard, START Magazine, 544 Second Street, San Francisco, CA 94107.