There is a little bit more to gaming than there is to regular simulation because gaming requires user intervention. Thus, instead of just running the simulation, the game is first started, and then the user can change things as the simulation progresses.
:SCREEN STARTGAME
COMMAND,"",0,0,0,0,,,GAME>GAMEINTERVAL|10
COMMAND,"",0,0,0,0,,,MENU>GAME|O
CLOSESCREEN,"",0,0,0,0,,,,GAMECONTROL
This sets up the gaming interval, starts the game, and goes to the game control screen. Once the game is started, input controls will only work on gaming variables. Using input controls on model Constants or Lookups will just give the message ERROR or gray the control.
:SCREEN GAMECONTROL
TEXTONLY,"Game Control",50,0,0,0,C|Arial|24|BU|200-55-0,
RECTANGLE,"",13,10,15,7,C||||0-0-255
TEXTONLY,"Time = ",22,12,0,0,R
SHOWVAR,"Time%4.0f",22,12,0,0,L
WIPTOOL,"GR1",40,10,58,55,,,CUSTOM>WIP1
BUTTON,"Forward",20,25,0,0,C,Ff,GAME>GAMEON
BUTTON,"Backup",20,35,0,0,C,Ff,GAME>BACKUP
TEXTONLY,"Natural Resource Utilization Per Person",20,45,0,0,C
MODVAR,"natural resource utilization normal",15,50,10,0,L,[0|2]
TEXTONLY,"Fraction of Capital Invested",20,65,0,0,C
SLIDEVAR,"capital investment rate normal",5,70,30,10,H,[0|0.1|.005]
BUTTON,"Perform detailed analysis",20,90,0,0,C,,SPECIAL>ALIASSCREEN|ARETURN|GAMECONTROL,ANALYSIS
TEXTONLY,"End the Game and Return to Main Menu",70,73,0,0,C|Arial|14|B|0-0-255,
BUTTON,"End Game",70,80,0,0,C,,GAME>ENDGAME,MAIN
The game control screen has SLIDEVAR controls to change the gaming variables, displays a work-in-progress graph on the right, and shows the current time at the top. The user can go forward in time or back up in time, and also perform model analysis. Notice the use of the ALIASSCREEN command so that model analysis returns the user to the game control screen and not the main menu.