Virtual "pet"

hi, anyone remember those tamigotchi or digimon toys where you had to keep a pet alive? well i was wondering, how would i go about making one? i would need to know how to make random events happen and how to make the character perform certain functions such as going to a shop. also i would need to know how to make meters for food, energy, health… and a day counter for time alive (every 5mins is a day).
thanks for any help :}

PS. Need help with preloader, have downloaded tho component but will not work!!!
also does anyone know of how to put passwords on flash apps???