Customizing the menubar is very easy. To do so, you simply just need to modify menubar.sc and game.sh. The menubar.sc script contains all the code for setting up the menubar, and handling the items clicked. The game.sh header is where you put the defines for it's item IDs.
First we need to open the the menubar script. Open the game and the Game Explorer will load.
Click on the script folder and the list of scripts in your game will appear on the right, along with a preview of the first script. |
Scroll down the list until you see the "MenuBar" script. Double click on it, and the script editor will open up with it. |
Scroll down the script until you see the TheMenuBar instance. In it's init() method are a bunch of AddMenu() kernel calls. These add the menus to the menubar. The AddMenu calls take two parameters. The first is the menu caption string, the second is the items string. It is quite straight forward. For more detailed information on it, you can see the section in the Kernel Add Menu section from the SCI Studio Help File.
Each menu you add has it's own ID. The first menu item of the first menu has the ID of $0101. The second menu item of the first menu has the ID of $0102". The first menu item of the second menu has the ID of $0201, and so on. It is good practice to create defines for these in game.sh so they can be accessed by name.
Scroll down TheMenuBar instance until you find the handleEvent() method. This is where you can check which item had been clicked and perform the appropriate task.
In game.sh, item $0101 is defined as MENU_ABOUT, item $0102 is defined as MENU_HELP, and so on. It's simply a big switch statement. Create cases for all the items you add, and you're done!
It's as simple as that! You now know how to make a complete SCI game. It is recommended that you read over this tutorial once more. Much of the stuff which may have confused you before will be much clearer. Continue on for information on additional resources for further SCI learning.
< Previous: Chapter 24 - Using The Print Procedures Next: Chapter 26 - Game Maintenance >Top
You can help keep The Sierra Help Pages and its affiliates alive by helping to defray some of the costs of hosting this site. If it has been of help to you, please consider contributing to help keep it online.Thank you.
The Sierra Help Pages | Sierra Game Help | Walkthroughs | Hints, Tips & Spoilers | Utilities | Links | SHP Forums | Search
© 2013 to present The Sierra Help Pages. All rights reserved. All Sierra games, artwork and music © Sierra.