Writer Philip Ardagh kicked off the schools programme at the Edinburgh International Book Festival with a lively and witty hour-long session for around 170 children from the city's Balgreen, Sciennes and Orwell primary schools.
On the theme of how inventions have contributed to our knowledge, Ardagh linked the ideas in two books of his Wow! series, Discoveries that Changed the World books and Get A Life! , which tells the chronological story of historical figures, by concentrating on Louis Pasteur's research into microbes.
He made a mad dash down the centuries and as the children answered questions, he invited them onto the stage to re-enact history. In a mock Victorian hospital setting, the children - kitted out in funny costumes, including goggles and bloody aprons - played patient, doctor and nurse during an operation to saw off a man's leg. Through jokey encouragement by Ardagh, they gradually discovered how surgery was made less painful, first by using alcohol, then by coshing the patient over the head, before the adoption of anaesthetic.
The festival's author in residence, Vivien French, says writing stories is similar to eating chocolate; you want to go on and on.
"How is a story structured?" she asked her audience. With a beginning, middle and end, was the response. Dividing her flipchart into columns, she asked the children to call out feelings. "By the end, those feelings and problems within the story must be sorted out." she said.
French gave an example of an unresolved conclusion: "The waves rose around the boat higher and higher." The children realised this was unsatisfactory because the reader would want to know what happened next.
With the end pointing the way forward, the young authors began a story about a dog called Biscuit, who was excited. "We must know why he feels this way, so that the story makes sense." said French. "And make sure your story has a shape. If you simply say it's his birthday and he gets lots of bones, there's no hook to keep the audience interested."
When the children showed Biscuit's feelings using their own facial expressions, French suggested they make a word picture to help them think of the right words for their story. They came up with a well-paced tale involving wild bears and surprise parties.
Around 100 teenagers from Leith Academy, Craigmount High, Boroughmuir and the Royal High in Edinburgh turned out to see Mary Hooper, formerly a short story writer for teen magazines such as Just Seventeen and Jackie. These days she is better known for her successful Megan books, which begin with the tale of a pregnant 14-year-old.
"As an author, you're like God,"she told them. "Megan didn't know until the end of book one whether she'd keep the baby. But as the author, of course, you do."
She suggested budding story writers should send their work to magazines, because as teenagers they knew all about teenage concerns. But she added a cautionary tale. "I remember getting a manuscript back from an editor once marked 'show, don't tell'. I threw it on top of the wardrobe." Later she realised that it meant she ought to let her characters speak for themselves through their actions and dialogue.
Most of the young people present had read the Megan books and one question - from a boy - caused some laughter: "Do you think your books are a good contraceptive?" Her new novel, Bethany, due out in August next year, will tell the story of a girl who meets someone in an Internet chatroom.
Writer Alan Durant, a Manchester United fan, was keen to show the 100 children from Edinburgh's Balgreen and Wardie primary schools that you don't have to love football to enjoy his books.
"Sport is a great topic to write about,"said Durant, "because you can cover all sorts of themes, including fair play, team spirit, justice and relationships.
"Write about your own life and what interests you. Even an event that happens to you at breakfast could be the start of an interesting story." He showed off his notebook, saying every author should carry one. "It's difficult to get ideas and equally difficult to keep them in your memory."
Durant also warned that to be a writer you must be a keen reader. "Look out for unusual names; they could be the start of an exciting new character."
Signs can be useful too. "I visit a school in a tough part of Swansea,"he said. "One day I spotted some graffiti which read in large letters, 'Is there life after death?' I couldn't read the smaller writing underneath so I went closer. It read: 'Trespass here and you'll find out.' " The festival offered more variety in this year's schools programme than ever before, giving young people the chance to meet writers such as Anne Fine and Eoin Colfer as well as to attend storytelling sessions, workshops and an exhibition by children's illustrators. The hubbub that preceded sessions and the enthusiastic response to each author showed they were having a great time just being there. What's more, they left with a greater appreciation of both writing and reading.
The Edinburgh International Book Festival schools' programme is sponsored by TES Scotland