I would start with replacing the TPS, there is a reason that code is being thrown, and from the what you said here:
"I am not sure if this is significant but my my car came up with error code 24 which means Throttle Position Sensor (TPS) signal out of range i have looked it up but i am not sure if that is what is causing it. I had been driving it before but some times the power loss light would stay on and the car would idle higher. But it has done that before and ran perfectly fine."
That would lead me to believe the TPS is causing your trouble, also I would change the plugs, battery power has nothing to do with the plugs working, once the engine is running the alternator takes over, you will also want to check the condition of your cap and rotor, look for corrosion under the cap, then I would check the spark plug wires, this can be done this way, wait till its dark have some one crank the engine and at the same time look for any stray sparks that would indicated a bad wire, Another thing you may want to check is the connections at the starter, battery and the ground, if you have any corrosion at the ground where it attaches to the body you will want to clean it and make sure it has a good connection.