TV Show Pilot Generator
Create the logline for your next binge-worthy series.
Select the Genre
Choose the Protagonist
What is the Inciting Incident?
Select the Setting
Ready for the Greenlight
Combine the elements to create your pilot episode concept.
Your TV Show Concept
${synopsis}
`; const outputDisplay = document.getElementById('output-display'); if(outputDisplay) outputDisplay.innerHTML = outputHTML; if (formContainer) formContainer.classList.add('hidden'); const tabContainer = document.getElementById('tab-container'); if (tabContainer) tabContainer.classList.add('hidden'); if (navButtons) navButtons.classList.add('hidden'); if (outputSection) outputSection.classList.remove('hidden'); } function downloadPDF() { const { jsPDF } = window.jspdf; if (!downloadBtn) return; downloadBtn.textContent = 'Formatting Script...'; downloadBtn.disabled = true; try { const genre = document.querySelector('#genre option:checked').text; const setting = document.querySelector('#setting option:checked').text; const protagonist = document.querySelector('#protagonist option:checked').text; const incident = document.querySelector('#incident option:checked').text; const showTitle = `${setting.split(' ')[1]} ${genre.split(' ')[1]}`.toUpperCase(); const author = "Generated Script"; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); doc.setFont('Courier', 'normal'); doc.setFontSize(12); const leftMargin = 15; const usableWidth = doc.internal.pageSize.getWidth() - leftMargin * 2; let yPos = 30; // --- PDF Template: TV Pilot Script --- // Title Page doc.setFontSize(18); doc.text(showTitle, doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 20; doc.setFontSize(12); doc.text(`Written by`, doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 7; doc.text(author, doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 40; // First Scene const sceneHeading = `INT. ${setting.toUpperCase()} - DAY`; const actionText = `The story opens on ${protagonist.toUpperCase()}, right in the moment they ${incident}. The world around them is chaotic, reflecting the sudden shift in their reality.`; const dialogue = "What have I gotten myself into?"; doc.text("FADE IN:", leftMargin, yPos); yPos += 10; doc.text(sceneHeading, leftMargin, yPos); yPos += 10; const actionLines = doc.splitTextToSize(actionText, usableWidth); doc.text(actionLines, leftMargin, yPos); yPos += (actionLines.length * 5) + 10; doc.text(protagonist.toUpperCase(), doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 5; doc.text(dialogue, doc.internal.pageSize.getWidth() / 2, yPos, { align: 'center' }); yPos += 20; doc.text("FADE OUT.", leftMargin, yPos); doc.save(`${showTitle.replace(/\s/g, '_')}_Pilot.pdf`); } catch (error) { console.error("Error generating PDF:", error); alert("An error occurred while generating the PDF. Please try again."); } finally { downloadBtn.textContent = 'Download Pilot Script Page (PDF)'; downloadBtn.disabled = false; } } // --- Initial Setup --- showTab(currentTab); });