# Room 83: Castle Dungeon Cell

This is the interior of a castle dungeon cell where Rosella is held captive. The room contains a skeleton (bones), a whip attached to the wall, chains securing the wall, an ominous machine, a high window, and a locked door. The room connects to the castle throne room (room 86). The cell has two states based on game progress: initially the door is locked (global109 < 5), but after progressing through the escape quest, the door becomes unlocked (global109 >= 5). When global109 equals 99, the player can escape through a secret passage. If entering the room for the first time (global109 = 0), the guard escorts Rosella back to her cell.

## Look Description

"You have found yourself in a HORRIBLE cell! It looks as if others have found their way here, too. Hopefully, you won't end up like them!"

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look` / `look around` / `look room` / `look castle` | "You have found yourself in a HORRIBLE cell! It looks as if others have found their way here, too. Hopefully, you won't end up like them!" (Print 83 0) |
| TODO | Look | `look skeleton` / `look bone` | "At least two unfortunate individuals have met their end here." (Print 83 1) |
| TODO | Look | `look machine` | "An ominous machine lurks in the corner of this cell. As to its purpose; you don't want to know!" (Print 83 2) |
| TODO | Look | `look whip` | "A whip hangs on the wall." (Print 83 3) |
| TODO | Look | `look chain` | "The chains are securely attached to the wall." (Print 83 4) |
| TODO | Look | `look window` | "The window is too high." (Print 83 5) |
| TODO | Look | `look wall` | "There is nothing of importance on the walls." (Print 83 6) |
| TODO | Look | `look down` / `look dirt` | "There is nothing of interest on the floor." (Print 83 7) |
| TODO | Action | `use machine` / `turn on machine` / `turn/wheel` | "You don't know how to use this machine, and you don't EVER want to know!" (Print 83 8) |
| TODO | Get | `get whip` | "The whip is securely attached to the wall. Besides, you wouldn't want it." (Print 83 9) |
| TODO | Get | `get chain` | "The chains are securely attached to the wall." (Print 83 4) |
| TODO | Action | `open window` | "The windows do not open." (Print 83 10) |
| TODO | Action | `break window` | "That would not accomplish anything." (Print 83 11) |
| TODO | Action | `open door` (if global109 < 5) | "You can't. It's locked." (Print 83 12) |
| TODO | Action | `open door` (if global109 >= 5) | "Try just walking through the doorway." (Print 83 13) |
| TODO | Action | `unlatch door` (if global109 < 5) | "You can't. You don't have the key." (Print 83 14) |
| TODO | Action | `unlatch door` (if global109 >= 5) | "It's not locked. In fact, it's still open!" (Print 83 15) |
| TODO | Talk | `call` / `help` / `save` | "No one is going to save you." (Print 83 16) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | takeBack | Entering room from room 86 or 0 when `global109 = 0` | Player is escorted by a guard back to their cell. Sequence: 30-second timer, message "You hear the henchmen returning.", guard actor (view 141) approaches player, player is forced to follow guard to the cell door (position 150,160), guard leads player to cell (150,225), then player is transported to room 86. Sets `global109` to track prisoner state. |
| TODO | Background | room exit | Continuous when `global109 = 99` and player touches control area $0040 | Player escapes through secret passage to room 86 |

## Technical Notes

- **Room Number**: 83
- **Picture**: 83
- **Region**: 604 (Castle dungeon area)
- **Exits**: East→86 (throne room), Secret passage East→86 (when global109 = 99)
- **Synonyms**: `room` = `cell`

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global100` | `0`, `1` | Time of day flag - when set, displays animated torches (view 512) and banner (view 649) |
| `global101` | `1` | Room initialization flag - set to 1 on init |
| `global109` | `0` | Prisoner state - 0 means player is being escorted back to cell by guard |
| `global109` | `1-4` | Prisoner state - door is locked |
| `global109` | `>= 5` | Prisoner state - door is unlocked |
| `global109` | `99` | Prisoner state - player can escape through secret passage |

### Additional Technical Details

- Two pillar/bar views (view 634) at positions (55,78) and (267,78) with priority 4
- Two animated torch props (view 512) at positions (57,66) and (267,66) with priority 3, visible only when global100 is set
- Banner/view (view 649) at position (162,64), visible only when global100 is set
- Player enters at position (156,159) when coming from room 86 or starting, with special movement settings (xStep: 4, yStep: 2)
- Secret escape trigger: control area $0040 when global109 = 99 transports player to room 86
- Guard escort script uses view 141 for the henchman actor
