We will define Rooms with a passage with the [room] tag: :: Your House | Kitchen [room] /* areaName and roomName are parsed out of the passage name and placed in _areaName and _roomName. In this example, _areaName=="Your House" and _roomName=="Kitchen". */ <> <> <> The room description on the initial visit. <> <> <> The room description on return visits. <> <> < <> <> < <> <> <> <> <> These Location passages are not meant to be visited directly. Instead, they are evaluated by the main Location-Based-Adventure passage. Since the passage is re-evaluated each iteration during play, TwineScript flow control may be used to gate off, enable, or disable various portions of the room passage. During game initialization, all [room] passages are looped through and evaluated, with the current room set to whatever room is being evaluated (so that Room.addObject() will work). All sections other than <> are ignored. This is used to initially populate the room inventories. Every room has a GeneralInventory. They are initialized into the Game.RoomInventory object, keyed by "areaName|roomName". In the location-based adventure mode, the passage for the current room is evaluated in a loop: - <> selects the image shown for the room on the map and renders the map. If no <> is specified, it is set automagically after the passage is evaluated, to "Areas/<_areaName>/<_roomName>". - <> Clears the room description area to the left of the map, evaluates the twinescript in the macro payload, and renders it into that room description area. - <> - Loops through the room's inventory and... - The descriptions of the objects in the room are rendered infocom-style into the room description area, appended beneath the room description. - Those objects' InRoom interaction links are appended to a div at the bottom of the scrolling text area below the map/room_desc area. - FIXME: Should the list of things in the room instead be in the interact area, with each obj desc being a link that pops up a context menu for that object? I think so. Maybe we can just use a popup for the context menu, that might be easier than a jquery floating context menu. We can just pop up the whole examine window with all the manipulation options that we already implemented for the inventories and stuff. - How should we implement the way that Inform has a long description that is displayed before the item has been picked up and dropped again? How do we put links into that desc that do stuff? This would also be useful for scenery, etc. - We can just list the exits the same way. Clicking on an open exit will move you through it. Clicking a closed exit will pop up an interact popup. - <> appends an exit/feature link to the same div that the object/interaction links were. - <> sections are ignored at this time. - When the player clicks an option in the div full of interaction links, the whole div is replaced with a greyed out version of the selected option, the same way the <> macro works. FIXME: How does this interact with the object popups in the above FIXME? - Whatever action is associated with that link is evaluated. and the results appended to the scrolling text area. - Moving to a different room is accomplished with a macro that: - Creates a checkpoint for the back/fwd/replay passage buttons. - Changes variables that contain the current room/area. - Then when the loop repeats, the new area/room info is rendered into the appropriate places. - The process repeats, re-evaluating the passage, re-rendering the map (in case player actions changed something), re-rendering the room description (ditto), and redisplaying the available options. - Branching away from location-based adventure mode and into a narrative scene is accomplished by Playing some other passage. Returning to location-based adventure mode is accomplished by Playing the Location-Based-Adventure passage again.