Routines
This page is a collection of short routines that can be used as subroutines in larger programs. By contrast, the Sample Programs page links to entire games (that may use some of these routines). Technique Examples contains yet a third type of program — short programs that may be of some value by themselves, but are present here mainly to demonstrate the use of some programming technique in an actual program.
When contributing routines, please follow these guidelines:
- A routine should be self-contained, and relatively short in length.
- A routine should be thoroughly tested to make sure it works correctly.
- Include inc:routine as the starting point for pages.
- When the routine page is finished, link to it from here.
List & Matrix Routines
- First Non-Zero Element — Finds the first nonzero element in a list.
- List Search — Returns the first occurrence of an element in a list, or 0 if it wasn't found.
- List Frequency — Finds the frequency of values in a list.
String Routines
- Reverse String — Reverses a string.
- Pad String — Pads the end of a string with spaces to be a specified length.
Text Manipulation
- Highlight Text — Displays inverted, black-on-white text.
- Large Textbox — Displays a dialog with an arbitrary amount of text.
Graphics Routines
- Invert Screen — Inverts the entire graph screen.
Miscellaneous Routines
- High Scores — Displays and stores a high score table.