“Ship in a Bottle” is episode twelve of season six of Star Trek: The Next Generation.
Geordi and Data are on the holodeck running a Sherlock Holmes program when Geordi points out Data has apparently made a mistake in his deduction. It’s actually a problem with the holodeck’s spatial orientation system. Geordi contacts Barclay to fix it, who runs up as they leave. Barclay describes it as being a glitch in the matrix – years before the film that made that quote famous.
Barclay starts working on the holodeck and finds some protected files in the Holmes program. He unlocks and runs them and Professor James Moriarty appears. Barclay treats him like a normal character until Moriarty asks about Captain Picard, and realises Barclay doesn’t know anything about him.
Moriarty says no-one has given a second thought to him. Yes, he knows what he is; he explains his creation in “Elementary, Dear Data”. Has a way been found to allow Moriarty to leave the holodeck? Barclay tells him no, he can only exist in here (well, without technology from the future that is…). Moriarty says he should have realised Picard would do anything to release the hostage. How long has he been locked away? Barclay tells him about four years. It seemed longer. Moriarty was aware of the passage of time; he was left to go quietly mad. Barclay defends the captain and Moriarty asks to talk to Picard. Barclay will speak to him, but he has to store Moriarty in memory again. When Barclay has gone, Moriarty reappears.
The Enterprise is in a system to watch a unique event, the collision of two gas giants. In engineering, Geordi is briefing his staff; this may create a new star. Afterwards, Barclay joins Geordi and Data and explains. The captain heads to the holodeck with Data and Barclay. Inside, Captain Picard explains to Moriarty that they still don’t know how he became aware and have not forgotten him. But also have no idea as to how to get him to leave the holodeck. And is concerned that Moriarty experience the passage of time. Moriarty says he must leave. He’s told that he cannot exist outside the holodeck. The captain summons and exit and demonstrates with a book. The professor claims he is different. he has life and will, perhaps strong enough to allow him to exist outside the room. And strides into the corridor.
The captain wants Moriarty to accompany them to sickbay, where Dr Crusher confirms that yes, he is real. The captain will continue the investigation, but first they have to decide what to do with Moriarty. The professor asks what sea they sail, and could they go above deck? Weather permitting.
The captain takes him to Ten Forward, and explains this is a space ship. Moriarty is full of questions; so much to learn, he hardly knows where to start. The captain says there are books that can help. As for Moriarty’s plans, the captain would prefer he stay onboard for the moment. And criminality is not tolerated. Moriarty says his past is a fiction. But he is a man alone, out of time. There is a holodeck character, Countess Bartholomew, designed to be the love of his life. Moriarty would like her taken from the holodeck too. The captain says they don’t know how Moriarty became real, and can’t guarantee it can be done again. Later, in the conference room, the captain discusses the matter with Troi, the doctor, Barclay and Data.
The captain advised Moriarty to postpone any action. Then Riker contacts him from the bridge; the gas giants are beginning to merge. However, when the captain arrives on the bridge, command functions are rerouted. To Moriarty.
The Enterprise is now a little too close to what may become a star and has no control. And Moriarty is willing to sacrifice anything for him and his countess to become real.
Later, in Voyager, Barclay becomes heavily involved with holographic creations with intelligence, though his association with Dr Zimmerman.