When You May Take a Painkiller on Shabbat

You may take a painkiller on Shabbat if the pain affects the entire body or if the pain keeps you awake.
Note This also becomes the criterion for whether to take the pain killer during the daytime: if the pain you feel during the day would keep you awake if you were trying to sleep.