A method for automatically milking animals by means of a milking machine provided to automatically connect teat cups to the teats of a milking animal and automatically milking the animal, wherein the milking machine is controlled by a computer, and the computer is further provided to control if an animal is allowed to be milked, is provided. The method includes the steps of: - using a meal criteria parameter for each animal to be served by the milking machine, - measuring the time since the milking animal was last milked, - allowing the milking animal to be milked if the measured time is larger than a milking allowance parameter, and - setting the milking allowance parameter based on the meal criteria parameter.