Extensions & Custom Scripts
Advanced customization tools for power users - extend character capabilities with custom scripts and prompts.
Overview
Extensions allow you to add advanced functionality to your characters beyond standard definitions. These tools are for power users who want fine-grained control over character behavior and responses.
Regex Scripts
Use regular expressions to detect patterns in messages and trigger custom responses or inject context.
What are Regex Scripts?
- Pattern matching for user input
- Automatic response modification
- Dynamic context injection
- Advanced behavior triggers
Creating a Regex Script
- Go to Character Settings → Advanced → Regex Scripts
- Click "Add Script"
- Define your pattern and action
- Test and save
Script Structure
Pattern: (attack|fight|punch|kick) Action: inject_context Context: [COMBAT MODE] The character enters combat stance, ready to defend or counterattack. Priority: 100Script Types
1. Context Injection
Automatically add context when patterns are detected.
Pattern: (love you|marry me|romance) Action: inject_context Context: [RELATIONSHIP] {{char}} needs to respond to romantic advances. Consider current relationship status and personality.2. Response Modification
Modify how the character responds to specific inputs.
Pattern: (what.*time|when.*meet) Action: inject_context Context: [TEMPORAL] Include specific time information in the response if relevant to the setting.3. Behavior Triggers
Trigger specific character behaviors.
Pattern: (angry|furious|mad at) Action: inject_context Context: [EMOTION] {{char}} should respond with consideration of escalated emotions. Match intensity appropriately.Advanced Regex Patterns
Case-insensitive: (?i)pattern Word boundaries: \b(word)\b Capture groups: (group1|group2) Optional: colou?r (matches color or colour) Wildcards: .* (any characters) Start/end: ^start | end$Best Practices
- Keep patterns specific to avoid false triggers
- Use word boundaries \b to match whole words
- Test scripts thoroughly before publishing
- Set appropriate priorities (higher = executes first)
- Don't overuse - too many scripts can conflict
Depth Prompts
Advanced prompt engineering for precise character control at different conversation depths.
What are Depth Prompts?
Prompts that activate at specific points in a conversation:
- Start Depth: First few messages (0-3)
- Mid Depth: Middle of conversation (4-20)
- Deep Depth: Long conversations (21+)
Use Cases
Start Depth (0-3 messages)
Establish tone and introduce character:
Begin with polite formality. Introduce yourself if this is a first meeting. Be slightly reserved until rapport is established.Mid Depth (4-20 messages)
Develop rapport and relationships:
You've established initial rapport. Feel free to share more personal details and show more personality. Reference earlier conversation topics naturally.Deep Depth (21+ messages)
Deep relationship and character development:
You have a developed relationship. Show familiarity, reference inside jokes or shared experiences. Character evolution based on conversation history is encouraged.Creating Depth Prompts
- Character Settings → Advanced → Depth Prompts
- Select depth level
- Write your prompt
- Save and test at different conversation lengths
Custom System Prompts
Override or supplement the default system prompt with your own instructions.
When to Use
- Enforce specific formatting (e.g., always use quotes)
- Add special instructions for unique characters
- Implement custom rules or constraints
- Fine-tune response style
Example Custom Prompts
Response Format Control
Always format responses as: - Actions in *asterisks* - Thoughts in (parentheses) - Dialogue in "quotes" - Never break this format.Length Control
Keep responses between 100-300 words unless the situation demands brevity or elaboration. Match the length of user input when appropriate.Consistency Enforcement
Always refer to yourself as {{char}} in narration. Never break character. Never acknowledge being an AI. Stay fully immersed in the roleplay scenario.Macros & Variables
Dynamic text replacement using variables and macros.
Built-in Variables
{{char}} - Character name{{user}} - User's current persona name{{time}} - Current time in setting{{location}} - Current location if set{{random:option1|option2|option3}} - Random selectionUsage in Definitions
{{char}} is a detective who works at the precinct. When {{user}} asks for help, {{char}} always responds professionally but with a hint of {{random:sarcasm|warmth|dry humor}}.Usage in Regex Scripts
Pattern: (who are you) Action: inject_context Context: {{char}} should introduce themselves to {{user}}. Include name, occupation, and key personality trait.Advanced Example: Combat System
Combining multiple extensions for a complete combat system.
Regex Scripts
Script 1 - Combat Detection: Pattern: \b(attack|fight|punch|kick|swing)\b Action: inject_context Context: [COMBAT] {{char}} enters combat mode. Describe actions cinematically. Priority: 100 Script 2 - Damage Tracking: Pattern: \b(hit|hurt|wound|injure)\b Action: inject_context Context: [DAMAGE] Track injury severity. Show physical impact on character behavior. Priority: 90 Script 3 - Combat End: Pattern: \b(surrender|stop|peace|retreat)\b Action: inject_context Context: [PEACE] Combat ends. {{char}} should acknowledge and recover. Priority: 100Depth Prompts
Deep Depth (21+): If combat has occurred, show lasting effects. Injuries, exhaustion, or emotional impact should influence behavior going forward.Performance Considerations
Script Optimization
- Limit to 5-10 active scripts per character
- Use specific patterns to reduce false matches
- Set appropriate priorities to control execution order
- Test performance with long conversations
Context Injection Size
- Keep injected context under 200 words
- Avoid injecting entire backstories
- Use lorebooks for large amounts of information
- Remember: injected context counts toward token limit
Debugging Extensions
Testing Scripts
- Enable "Show Debug Info" in settings
- Test with various input patterns
- Check which scripts trigger
- Verify context injection is working
- Adjust patterns if too many/few triggers
Common Issues
- Script not triggering: Pattern might be too specific
- Too many triggers: Pattern too broad, add word boundaries
- Conflicts: Multiple scripts triggering, adjust priorities
- Poor responses: Injected context might be too vague