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

WAIT IDLE

It was once said that idle hands lead to idle minds. But GHS gives you a perfect alternative.

Most of us think the WAIT command is only useful for pausing at a point in a run file or setting the "frame rate" of our clever Condition Graphics animations. In fact, it allows for some quite powerful GHS trickery. COW139 introduced the relatively new (and cool) WAIT BREAK "debugger" feature. This week we focus on the not as new but equally cool WAIT IDLE.

WAIT IDLE does one very simple thing: it tells GHS how often to continuously call a macro, called IDLE, whenever GHS is sitting idle. To use it is very simple:

WAIT IDLE 1 `using a one second interval

MACRO idle
 \ The time is {time}. Let's do something cool...
/

If we were to run these commands in a run file, we would see a continuous string of messages like the following:


Well, I guess now we need to do something cool. Long ago, COW049 introduced the MESSAGE SEND feature, which allows you to send a message to another instance of GHS. This allows macros and templates to be run from a separate instance--freeing up your primary instance of GHS for command input. Wouldn't it be handy to have a little side pane that existed separately from your GHS session but displayed all of your user variables and their assignments? Yes, it would be.

Here is a run file that implements such a gadget. It makes use of an IDLE macro and a WAIT IDLE command to send continuous macro calls to a GHSOS session running a template. The macro simply updates and repopulates the template, giving you added visibility of the user variables in your main session. You can even edit the variable assignments in the template and the GHSOS session will send a message back to the main session updating the variable. Here's how it looks:


You will notice that when a new variable is defined (or an old variable deleted) in the main session, you'll need to press the "Update Variable List" button in the template. Other than that, the variable assignments will update automatically.

And one more thing: you don't actually need WAIT IDLE at all to use an IDLE macro. It only sets the interval between calls, which default to one second if not otherwise specified. So maybe it's not as powerful as we initially thought....

Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

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

www.ghsport.com

Click here for an index to this and previous COWs