By successfully connecting to an external display you have confirmed that the problem is within the screen components -- screen, inverter cable, video cable, or inverter. A question: When the screen is affected, is the backlight out, or do you have full backlight and the image is simply messed up? If the backlight goes out, I'd suspect the inverter cable, because that gets light to the screen, and if you have light but the image is messed up, I'd suspect the video cable. The cable may be bad, however by the way you describe it I'd be very curious to go inside the machine and see if it's simply loose, and being slightly pulled out of its port by the motion involved in opening the screen. You may get lucky and find it's only that. But if it's not loose or crimped, I'd proceed by replacing the video cable or the inverter cable, depending on your answer to the question above. You can plug your laptop's part number into iFixit's part-finding wizard in order to locate the appropriate cable.
I don't see a relevant 17" guide, but here's one for a 15" model which will give you an idea of the fun you're in for. If you get really lucky, the video cable may be loose where it attaches to the logic board, in which case you'll be able to tighten it simply by popping the top, and you won't have to open the screen hinge, etc.
PowerBook G4 Aluminum 15" 1-1.5 GHz Inverter/Antenna Cables Replacement