The best way to cope with a strong temptation to smoke is to quickly remove yourself from the situation that is causing the temptation. Don't worry about "how it will look" if you leave a party, wedding reception, or public function to avoid the temptation to smoke. You have an important reason for leaving.
When you cannot remove yourself from a difficult situation, or when the temptation to smoke is triggered by something other than a place or event, consider what you can do, think about, or tell yourself that will help you cope with the temptation. Use some activity to distract yourself for about 20 minutes.