---------------------------------------------------------------------- Menu demonstration ------------------ An Alan IF System coding example By Stephen Griffiths Player Commands available in this 'game': menu - see the demonstration north,east etc - just there so you've got some non-menu commands quit - exit the program ---------------------------------------------------------------------- Somewhere In A Hypothetical Game. You are in a room dimly lit only by the full moon shining through a small window high on the eastern wall. A thick swirling mist several inches thick cloaks the floor. Many fascinating objects and items of furniture festooned with cobwebs fill the room. Well, no, not really! Actually this location is empty and exists for no reason other than to have a place to start from in this demonstration. > menu (The purpose of this program is to provide source code which demonstrates how to program menus in 'Alan'. This program demonstrates two different menu-selection methods which may be a little confusing. Also the menus are not very well laid out, sorry, as I had trouble thinking of enough menu topics to adequately illustrate the programming techniques in the source code.) Main Menu Select an option: A - Playing, & writing, I.F. (uses 'a,b,c' verbs) B - Misc. Notes. (uses 'choose topic' verb) Q - Quit this menu. > a General Interactive Fiction Information Select an option: A - Commons Commands used to play I.F. games B - Writing I.F. games with the 'Alan' system (Enter P for previous menu, Q to quit menu and return to game.) > a Standard Interactive Fiction Commands Select an option: A - Moving around. B - Interacting with objects. C - Interacting with characters. D - Miscellaneous commands. (Enter P for previous menu, Q to quit menu and return to game.) > d Game Status inventory (abbr. i ) - list objects being carried look (abbr. l ) - repeat description of current location score - display game points currently earned Stopping and starting game save - save current game state to a disk file restore - restore previously saved game from disk file restart - start playing game again quit - exit the game Miscellaneous brief - only describe a location when first visit it verbose - display description each time visit a location wait (abbr. z ) - do nothing for a turn (Enter P for previous menu, Q to quit menu and return to game.) > p Standard Interactive Fiction Commands Select an option: A - Moving around. B - Interacting with objects. C - Interacting with characters. D - Miscellaneous commands. (Enter P for previous menu, Q to quit menu and return to game.) > q Ok. Back to the game .... Somewhere In A Hypothetical Game. You are in a room dimly lit only by the full moon shining through a small window high on the eastern wall. A thick swirling mist several inches thick cloaks the floor. Many fascinating objects and items of furniture festooned with cobwebs fill the room. Well, no, not really! Actually this location is empty and exists for no reason other than to have a place to start from in this demonstration. > menu (The purpose of this program is to provide source code which demonstrates how to program menus in 'Alan'. This program demonstrates two different menu-selection methods which may be a little confusing. Also the menus are not very well laid out, sorry, as I had trouble thinking of enough menu topics to adequately illustrate the programming techniques in the source code.) Main Menu Select an option: A - Playing, & writing, I.F. (uses 'a,b,c' verbs) B - Misc. Notes. (uses 'choose topic' verb) Q - Quit this menu. > b Notes are available on the following topics: Enter 'topic n' or 't n' where 'n' is the number of your choice 1 - Why doesn't this menu use a,b,c options. 2 - Why have a 'topic' verb? 3 - Limitations of this menu system. 4 - A third item selection method. 5 - Non-text 'action' items. 6 - Who wrote this program? 7 - Why? (Enter P for previous menu, Q to quit menu and return to game.) > topic 2 You can't use 1,2,3 etc as Alan verbs because a command can't start with a number. So you can define a command like 'choose n' abbreviated to 'c n' where n is the number of the option required. (In this demo the verb is 'topic n' coz the abbreviation 'c' is already defined as a verb for the a,b,c style of menu-selection. Of course, in a real game you wouldn't mix and match the two selection methods as this demonstration does. (Enter P for previous menu, Q to quit menu and return to game.) > p Notes are available on the following topics: Enter 'topic n' or 't n' where 'n' is the number of your choice 1 - Why doesn't this menu use a,b,c options. 2 - Why have a 'topic' verb? 3 - Limitations of this menu system. 4 - A third item selection method. 5 - Non-text 'action' items. 6 - Who wrote this program? 7 - Why? (Enter P for previous menu, Q to quit menu and return to game.) > topic 7 I wrote this program because I hoped that other Alan programmers would find it useful. You're welcome to use this code as a basis for your own menus. I hope you'll share any improvements and new ideas for the benefit of the Alan programming 'community.' (Enter P for previous menu, Q to quit menu and return to game.) > q Ok. Back to the game .... Somewhere In A Hypothetical Game. You are in a room dimly lit only by the full moon shining through a small window high on the eastern wall. A thick swirling mist several inches thick cloaks the floor. Many fascinating objects and items of furniture festooned with cobwebs fill the room. Well, no, not really! Actually this location is empty and exists for no reason other than to have a place to start from in this demonstration.