Hi
I read carefully all your concerns and I am sorry for your situation.
With regards to your stomach pain it may be from gastritis( acute or cronic) or ulcer. 
 so at this situation I would recommend to do 
upper endoscopy.
 with regards to your semi solid motion it may be from
- hiperacidity of stomach, 
- disbacteriosis( from the use of different medicines)
- acute gastroenteritis
 So, I would advice to start the treatment with
probiotics, antiacides, tasectan  
I would recommend olso changing your lifestyle like:
-use plenty of water
- use foods reached in fibers(vegetables and fruits)
- avoid spicy foods, fatty
 If iT is not enough please consult a gastroenetrologist.
 Wishing you the best
 Dr.Klerida