study 10 of 10
When something is wrong
Mistakes are part of writing scripts. OType tries to catch them before they reach the music, and to say plainly what is wrong. This study shows what an error looks like, what happens to a file that has one, and the few limits that keep every run short.
Reading an error
The checker on the computer, the VS Code extension and the unit itself apply the same rules, and write the same messages. Each one gives the file, the line, the function and what is wrong:
BASICS.OTY:8: bad_call: error: tr.add expects 1 argument (step), got 0
BASICS.OTY:4: bad_loop: error: l bound must be constant (a): use a number, a const, a param or an argument that is constant at every call
BASICS.OTY:10: ping: error: loop ping>pong>ping
On the unit, the screen shows a summary and the file /SCRIPTS/ERRORS.TXT holds the full list.
Only the faulty function is refused
An error refuses its own function, and the functions that call it; everything else in the file, and in the other files, still loads. One typo never empties your menu. A warning, such as an operation whose value is not used, lets the function load.
Every run ends
A script runs inside the Octatrack's own work, so it must never hang the machine. OType makes sure of it with three rules you have met:
- loop bounds are fixed before the run (
l 1 a:is refused); - a function never calls itself, even through others;
- calls and blocks nest at most eight deep.
From these, the checker computes each function's cost: the most work one run can do, in units of the
operations it uses. check -v prints it, for example max cost 176/4096; a function over
the budget is refused as too long. When it happens, look for a loop over all the steps inside another
loop, or a trk all around heavy work.
A few numbers to know
| a line | 128 characters, comment included |
| a text · a list | 127 characters · 16 numbers |
arguments · param · var | 4 · 8 · 16 per function |
| calls · blocks | 8 deep · 8 deep |
| numbers | whole, from −32768 to 32767 |
| the end box | 29 characters |
On the unit
An operation can still meet something the checker cannot know in advance: a track number out of range, a slot
that is empty. It is then skipped and counted, and the run goes on; the simulator lists what was skipped. A few
operations that would move audio while it plays, such as replacing a Flex slot in use, answer
STOP FIRST.
What you learned
FILE:LINE: function: error: …- every message says where and what
ERRORS.TXT- the full list, on the card
- refused
- only the faulty function and its callers
- cost
- the most work one run can do, checked against the budget