And, if the players don't follow the "script"? Railroading?
I think the concern of rail-roading has been addressed in a number of responses already.
In a real rail-road, you can't leave the scene until you do the expected thing. That's what's annoying about it.
What most people agree here, is that the GM adapts the material to a fitting reaction and consequence to the player's unexpected action.
In reality, when a player doesn't do the expected thing, it comes in 2 flavors:
1) they're trying to "quit" the mission
2) they're trying to "solve" the mission, in an unanticipated way
#1 is easy, let them start quitting, and start showing them consequences as the bad guy moves forward un-impeded. They'll either get back to the mission, or accept the consequences, which continue to roll forward while they "do something else" which you can run for them.
#2 is also easy. Pause the game, adjust the "script" to react to the new change, which will probably replace a few encounters and reveal information early, and move them to a different point in the story arc, which is the whole point of finishing any encounter.
Remember, it's not a rail-road to have consequences for the PCs actions or inaction. "I don't want to find the kidnapped mayor" means the bad guy moves forward. The world is not static. A rail-road is where the party can't choose to be inactive, or a specific action. They're not allowed to. A choice with a bad consequence (that a rational person would never make) is not the same as a lack of choice enforced by the GM who nullifies every action but the acceptable one.
The reality for most GMs is, whether they write it down before the game, or make it up on the fly, once they say, "the party hears a rumor about killings on the docks" it's been planned out. They have an idea of a clue to drop for the party to find. They have an idea of who the bad guy is, even if it's only in their head. At that point, a path has been drawn from party in the bar to party confronting the bad guy. A good GM keeps adjusting that path as the party advances through the story, based on what they do, and how they want to approach the problem. In any even, the goal is to always end at the party confronting the bad guy, though the image of what that scene looks like may keep changing.