Heroin addict Mark Renton and his circle of friends are introduced: amoral con artist Simon "Sick Boy" Williamson (also an addict), simple-minded, friendly Daniel "Spud" Murphy (another addict), clean-cut athlete Tommy MacKenzie, and psychopath Francis "Franco" Begbie, who picks fights with people who get in his way.
Renton decides to quit heroin and buys opium rectal suppositories from dealer Mikey Forrester to ease the transition. After his final hit (and a violent spell of diarrhea caused by cessation of heroin) he locks himself into a cheap hotel room to endure withdrawal. He later goes with his friends to a club, finding that his sex drive has returned, he eventually leaves with a young woman named Diane, and they have sex in her home. In the morning, he realises that Diane is a 15-year-old schoolgirl and that her "flatmates" are actually her parents. Anxious, Renton tries to ignore the incident, but is forced to remain in touch after Diane blackmails him.
Spud, Sick Boy, and Renton start using heroin again. Tommy, whose girlfriend dumped him after a chain of events initiated by Renton, begins using as well. One day the group's heroin-induced stupor is abruptly interrupted when Allison, their friend and fellow addict, discovers that her infant daughter Dawn has died from neglect without any of the group noticing. All are horrified, especially Sick Boy, who is implied to have secretly been Dawn's father.
Renton and Spud are caught stealing from a bookshop and arrested. Spud goes to prison, but Renton avoids punishment by entering a Drug Interventions Programme, where he is given methadone. Despite support from his family, Renton is desperate for a more substantial high and escapes to his drug dealer's flat, where he nearly dies of an overdose, and his dealer sends him to hospital in a taxicab. After he leaves the hospital Renton's parents take him home and lock him in his old bedroom to force him through withdrawal. As Renton goes through severe withdrawal symptoms, he has nightmares of Diane singing on the bed, his friends giving him advice, Allison's dead baby crawling on the ceiling, and an imagined TV game show in which host Dale Winton asks Renton's parents questions about HIV.
Renton is finally roused from his nightmares and hallucinations by his parents, who tell him he needs to get tested. Despite years of sharing syringes with other addicts, Renton tests negative. Low-spirited and depressed, he visits Tommy, who has succumbed to addiction and is now severely ill and HIV-positive. Renton moves to London and takes a job as a property letting agent. He begins to enjoy his new life of sobriety and saves up money on the side while corresponding with Diane. However, Begbie, who has committed an armed robbery, and Sick Boy, now a pimp and drug dealer, move into Renton's bedsit unannounced, to Renton's annoyance.
In Edinburgh, Tommy dies from HIV-related toxoplasmosis and the three travel back to Scotland for his funeral. They meet Spud, who has been released from prison. Sick Boy suggests a lucrative but dangerous heroin transaction, but needs Renton to supply half of the initial ÂŁ4,000. Renton injects himself with a sample to test the heroin's purity. The four sell the heroin to a dealer for ÂŁ16,000. During their celebration at a pub, Renton secretly suggests to Spud that they steal the money, but Spud is too scared of Begbie to even consider it. Renton is finally fed up with Begbie after witnessing him glass and then severely beat a man who he bumped into, causing beer to be spilt on him. Early in the morning as the others sleep, Renton quietly takes the money from sleeping Begbie's arms. Spud wakes up just as Renton is leaving the hotel room. The pair stare at each other for a few moments until Renton walks out, Spud remains silent and does not tell the others. When Begbie awakens, he destroys the hotel room in a violent rage, the police arrive causing Spud and Sick Boy to flee. Renton reiterates his vow to live a stable, traditional life and leaves Spud ÂŁ2,000.

Question: Why does Renton lock himself into a hotel room?
Answer: To endure withdrawal.