Picking up from the last post, I made a decisions on the menus, use both a window to kick off the game and an application defined menu with the Visual MUMPS User menu enhancement.
It’s quite simple to add/change items in the user menu the code to create this menu looks like this :
The clear routine loops to clear out all menu items. It’s good to start clean each time menus are being added, also there will be times when I will want the menus to be empty to only allow action in the open window. In the INIT routine the first four options are always put into the menu. The MUMPS has the ability to use post conditionals on certain commands, here the set command has post conditionals on the next menu items.
s:inning<1 z=$zwmenu(“Play Ball”,7,”s %cw%win1 d quit^bb.mps,play^bbplay.mps”)
In the line of code this menu item only gets set up when the variable inning is less than 1 (before the game starts). The call to $zwmenu has three parameters, menu text, number of menu item and the callback code to be run. The next two set commands in the text are used to set the callback code for the Quit item based on whether or not the game has started.
The next bit of functionality is the lineup and Pitcher change features. Show below is how the look in the original TS/2068 version.
In the GUI environment the set up is a bit different and easier to code and use. The players and pitchers are listed and those that are valid to be substituted have active radio buttons next to them. One to select the player to come out and the second column for who to put in. Then simply clicking the Sub button (or hitting “S”) will trigger the action. Then Bench players are highlighted in yellow on the lineup card. For the pitchers only starting pitchers and be selected before the game. Once the game starts then only relievers will be active to pick. For players once the game starts and a player is removed from the lineup then he is not eligible to be put back into the game.
When rosters or pitching changes are being made, all other windows are hidden until changes are completed, then those window will be redrawn. Modal windows are an enhancement to Visual MUMPS I will add to the list, but this is a minor challenge and doesn’t hamper the ability to write this game.
In the next post the Play Ball window will be created.