If something that's considered an illegal substance in the U.S. happened to be legal in another country that the ship stopped in, then it would be legal as long as you didn't bring it back onto the ship. Of course, you would need to check the laws of each country to determine that. However, if you have a legal prescription for a medicine with that substance in it, then it would be okay on the ship. An exception to that would be if you had a legal prescription for Marijuana from California. It's my understanding that's only legal within that state.