What Jessweee said but it also does things like... say for example:

You enter a village and a cutscene where the elder runs up to you and screams about the monster attacking, this a is a flag that is raised that tells the program that when you enter the village this cutscene has to play. There is another flag that goes up as well that tells the program not to play the scene again after it has played so that way, whenever you enter the village again the same cutscene doesn't play cause you've already beaten that scenario. This I learned the hard way with RPG Maker...