Overview
This prompt aims to guide developers in creating structured JavaScript scripts for AI Dungeon, enhancing gameplay through organized coding practices. Programmers and game designers will benefit by gaining a clear framework for implementing customizable features in their projects.
Prompt Overview
Purpose: This set of scripts enhances the AI Dungeon experience by providing modular functionalities for input, context, and output management.
Audience: These scripts are designed for developers looking to customize and improve their AI Dungeon gameplay through JavaScript.
Distinctive Feature: Each script type serves a unique role, ensuring a well-structured approach to modifying game interactions and narrative flow.
Outcome: Implementing these scripts will lead to a more engaging and dynamic storytelling experience for players in AI Dungeon.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Creative Writing & Storytelling, Development Tools & DevOps, General Business Operations
- Techniques: Decomposition, Prompt Templates, Structured Output
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Create a comprehensive JavaScript script set for AI Dungeon, incorporating the features described by the user. Organize the scripts into four distinct types:
1. Shared Library
2. Input Modifier
3. Context Modifier
4. Output Modifier
The scripts should utilize the predefined Scripting API, specifically:
– The global state object to maintain game data.
– The info object for accessing player input, AI memory, and story context.
– The History object where relevant.
### Script Details
– Shared Library Script:
– Initialize any necessary state variables and general functions for use throughout the scripts.
– Input Modifier Script:
– Intercept and analyze the player’s input text before AI processing.
– Detect keywords or commands and update relevant state variables accordingly.
– Context Modifier Script:
– Modify the AI’s narrative context before generation.
– Inject pertinent information derived from current state variables into the AI’s memory or story info, influencing future AI responses dynamically.
– Output Modifier Script:
– Process the AI’s generated response before it is shown to the player.
– Modify the output text as needed (e.g., correcting errors, adding cosmetic enhancements) to ensure game consistency.
### Code Guidelines
– Do not produce ad hoc or unstructured code.
– Deliver clean, modular, and commented JavaScript segments for each script category that can be directly implemented into AI Dungeon.
– Focus on clarity and include:
– Variable declarations
– Example keyword detection
– Reputation management
– Context injection based on reputation
– Placeholder output modifications that can be customized later.
### Output Format
Provide four clearly labeled JavaScript code blocks for each script type:
– Shared Library (.js)
– Input Modifier (.js)
– Context Modifier (.js)
– Output Modifier (.js)
Each block should include comments explaining key parts of the code, how it relates to the Scripting API, and its intended purpose.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Open your preferred coding environment for JavaScript.
- Create four separate JavaScript files for each script type.
- Paste the prompt into your environment for reference.
- Develop each script according to the specified guidelines.
- Test the scripts within AI Dungeon for functionality.
Tips for Best Results
- Shared Library: Initialize global variables and utility functions for consistent state management across scripts.
- Input Modifier: Analyze player input for keywords, adjusting game state variables to reflect player intentions before AI processing.
- Context Modifier: Inject relevant state information into the AI’s memory, enhancing narrative context based on current game dynamics.
- Output Modifier: Refine AI responses by correcting errors and enhancing text for clarity and consistency before presenting to the player.
FAQ
- What is a Shared Library script in AI Dungeon?
A Shared Library script initializes state variables and functions for use across other scripts. - How does an Input Modifier script work?
It intercepts player input, analyzes it for keywords, and updates state variables accordingly. - What does a Context Modifier script do?
It modifies the AI's narrative context by injecting relevant state information into the AI's memory. - What is the purpose of an Output Modifier script?
It processes the AI's response before display, ensuring consistency and correcting any errors.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


