Help with Arduino program

Ya basically lol. I used the search function a little and found some stuff but basically the two questions Im having trouble with are what functions to use for switching modes such as Click once for mode 1 and twice for mode 2. Also ive read that when you take the atmega328 out of the arduino and put it into a circut, you need a crystal oscillator. Is that needed if I plan on putting it on a perf board. Once I can get help with the mode ill see what code I can put together and show you