There is no hard and fast rule about how much medication travelers can take with them. National laws vary but are generally in the range of 30 to 90 days of medication for travelers' personal consumption, and may include differing amounts depending on whether the medication is or is not accompanied by a physician's prescription. Similarly, countries may have laws allowing the importation (i.e., having them shipped from abroad) of medications under specified conditions.
However, carrying some common OTC medications containing opioid-derivatives such as tramadol and codeine, etc., can get you imprisoned in place like Greece, Dubai, etc., unless you are also carrying a prescription. Even carrying any prescription drugs containing an opioid-derivative can get you into trouble, e.g., a British women was arrested in Egypt when airport Customs found several hundred Tramadol painkillers in her luggage.
Thai embassy websites publish information on travel with prescription medicines into and out of Thailand, including the maximum in each medication you can only bring. They have to be in their original packaging, though.
As countries post information online about what can and cannot be taken into a country, it make sense to do some research before traveling. I understand that staying in Bangkok or Bali prisons is not a pleasant experience.