User Tools

Site Tools


howtos:toolcoding:common_history_and_background_checks

This is an old revision of the document!


Many views require that a history be selected (if running in a simulator) and/or a background scenario be picked in. In these cases a section of code near the top of the view - following the object declarations - is used to check that the required history and/or background is in place. If not in place the code advises the user and quits.

Common code sections are listed below.

Simulator - history and background required

boolean $answer
if $history == false
	say ("This view requires a history.")
	listen ("                              enter to continue >> ",$answer)
	quit (-1)
endif
if $background == false
	say ("This view requires a background scenario.")
	listen ("                              enter to continue >> ",$answer)
	quit (-1)
endif

FIXME - do we have a best practice on the quit() return code?

howtos/toolcoding/common_history_and_background_checks.1284487768.txt.gz · Last modified: 2010/09/14 18:09 by shona.weldon