command name/flags(type
name, ...[type name, ...]) {commands}
Create a new command.
name
/flags
type name
[type name,...]
command delay(Double dt) {
until $elapsed >= $dt
}
delay 0:10:0
command track_source/wait/warn(Source src) {
# If the source is currently below the horizon, and the
# caller has asked to be told about this, output a warning.
if($warn & $el($src) < 0.0) {
print "Source ", $src, " is currently below the horizon."
}
# Tell the control system to track the source.
track $src
# If the caller wants us to wait until the source is acquired before
# returning, do so here.
if($wait) {
until $acquired(source)
}
}
This command can then be called like:
track_source/warn marsin which case
$warn would be true and $wait
would be false, or
track_source/warn/wait moonto make both
$warn and $wait true, or
track_source mercuryto make both
$warn and $wait false.
command offset_track(Source src, [Double az, Double el, Double dk]) {
offset az=$az, el=$el, dk=$dk
track $src
}
This command has one mandatory argument, followed by 3 optional
arguments. The optional arguments are passed to the builtin
"offset" command, where only the arguments that
are presented to the offset_track command actually become
arguments of the offset command. To be more precise, if
the optional $az argument is omitted when calling
offset_track, the corresponding optional $az argument of
the offset command will be assigned a nul value. For example:
offset_track moon, az=0:0:5, el=0:0:10would result in the
offset command installing new
tracking offsets for azimuth and elevation, but would leave the deck
angle offset unchanged.
The example defines a command that returns, via its arguments, the
current azimuth and elevation tracking offsets. When it is called, at
the end of the example, the values of the az_offset
and el_offset variables, which were passed to the
command, end up containing the azimuth and elevation offsets that were
queried within the command.
command azel_offsets(Double az, Double el) {
TrackingOffsets offsets = $tracking_offsets()
az = $offsets.az
el = $offsets.el
}
...
Double az_offset = 0
Double el_offset = 0
azel_offsets($az_offset, $y_offset)