General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)


This handy command enables you to easily add sound effects to your GHS runs. Why would you want to do that? As the command name suggests, it could be used to make a noise when an error is encountered.

The full syntax is,

ERROR (ALARM) filespec

where the named file is a WAV type file or other type of audio file that Windows recognizes. This form of the ERROR command does nothing but play the sound file. It need not be associated with an error.

The ERROR (ALARM) thing crept into GHS/GLM to support onboard applications where an audible alarm was desired to warn of certain loading conditions, not errors encountered in processing GHS code. But it could be connected in such a way that if your GHS run encounters a snag, it makes some remark -- preferably something appropriate, not something that startles everyone in the room.

When GHS encounters an error, it executes the ESC macro (assuming one exists) instead of just stopping. This gives you an opportunity to do something useful after an error. Also the ERRMSG system variable will be found to contain information about the nature of the error.

Below is a bit of code you can copy and paste to your GHS.LF (or make a GHS.LF text file in your GHS program or library folder if one does not exist).

 macro ArmAlarm
   macro esc
     error (alarm) ^ERROR.WAV
     template t "Error" /size:large
     exit noesc
   macro noesc
     macro esc
   set error=-3

To activate it simply execute the ArmAlarm macro. For example, .ArmAlarm could be placed at the top of any run file. Note that after it handles an error it deletes the ESC macro. Thus it remains inactive until ArmAlarm is executed again.

This assumes that you have a file named ERROR.WAV in your library or program folder. To get the one we have selected for this purpose, copy and paste the code below to the command line in GHS or BHS. It downloads the WAV file and moves it to your library folder as ERROR.WAV.

copy "" TEMP.WAV
erase TEMP.WAV

Click here if you want to listen to COW025.WAV before downloading.

Obviously you will substitute a different ERROR.WAV and have a lot of fun with this -- if you have nothing better to do.
Questions, comments, or requests?
Contact Creative Systems, Inc.

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

Click here for an index to this and previous COWs