diff --git a/README.md b/README.md
index d912340..6fbd6de 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,13 @@ An immersive RPG extension for browsers that tracks character stats, scene infor
## 🆕 What's New
-### v3.3.3
+### v3.4.0
-- Strengthened default prompts to not include user's persona in the characters' section.
-- Updated some descriptions for buttons and custom fields.
+- Added History Persistance in Edit Trackers that allows you to control how many past trackers in the chat history to include.
+- New mobile displays were added that show all the most important trackers from the panel as small, floating widgets around the RPG Companion button, when the main panel is closed.
+- Added CYOA toggle.
+- Added Deception System toggle.
+- The trackers are no longer sent together with an image generation request.
**Special thanks to all the other contributors for this project:**
Paperboygold, Munimunigamer, Subarashimo, Lilminzyu, Claude, IDeathByte, Chungchandev, Joenunezb, Amauragis, and Tomt610.
diff --git a/index.js b/index.js
index cef4158..dfc4861 100644
--- a/index.js
+++ b/index.js
@@ -377,6 +377,16 @@ async function initUI() {
saveSettings();
});
+ $('#rpg-toggle-deception').on('change', function() {
+ extensionSettings.enableDeceptionSystem = $(this).prop('checked');
+ saveSettings();
+ });
+
+ $('#rpg-toggle-cyoa').on('change', function() {
+ extensionSettings.enableCYOA = $(this).prop('checked');
+ saveSettings();
+ });
+
$('#rpg-toggle-spotify-music').on('change', function() {
extensionSettings.enableSpotifyMusic = $(this).prop('checked');
saveSettings();
@@ -554,6 +564,18 @@ async function initUI() {
updateFeatureTogglesVisibility();
});
+ $('#rpg-toggle-show-deception-toggle').on('change', function() {
+ extensionSettings.showDeceptionToggle = $(this).prop('checked');
+ saveSettings();
+ updateFeatureTogglesVisibility();
+ });
+
+ $('#rpg-toggle-show-cyoa-toggle').on('change', function() {
+ extensionSettings.showCYOAToggle = $(this).prop('checked');
+ saveSettings();
+ updateFeatureTogglesVisibility();
+ });
+
$('#rpg-toggle-show-spotify-toggle').on('change', function() {
extensionSettings.showSpotifyToggle = $(this).prop('checked');
saveSettings();
@@ -851,6 +873,8 @@ async function initUI() {
$('#rpg-toggle-thoughts-in-chat').prop('checked', extensionSettings.showThoughtsInChat);
$('#rpg-toggle-html-prompt').prop('checked', extensionSettings.enableHtmlPrompt);
$('#rpg-toggle-dialogue-coloring').prop('checked', extensionSettings.enableDialogueColoring);
+ $('#rpg-toggle-deception').prop('checked', extensionSettings.enableDeceptionSystem ?? false);
+ $('#rpg-toggle-cyoa').prop('checked', extensionSettings.enableCYOA ?? false);
$('#rpg-toggle-spotify-music').prop('checked', extensionSettings.enableSpotifyMusic);
$('#rpg-toggle-dynamic-weather').prop('checked', extensionSettings.enableDynamicWeather);
@@ -859,6 +883,8 @@ async function initUI() {
// Feature toggle visibility settings
$('#rpg-toggle-show-html-toggle').prop('checked', extensionSettings.showHtmlToggle ?? true);
$('#rpg-toggle-show-dialogue-coloring-toggle').prop('checked', extensionSettings.showDialogueColoringToggle ?? true);
+ $('#rpg-toggle-show-deception-toggle').prop('checked', extensionSettings.showDeceptionToggle ?? true);
+ $('#rpg-toggle-show-cyoa-toggle').prop('checked', extensionSettings.showCYOAToggle ?? true);
$('#rpg-toggle-show-spotify-toggle').prop('checked', extensionSettings.showSpotifyToggle ?? true);
$('#rpg-toggle-show-dynamic-weather-toggle').prop('checked', extensionSettings.showDynamicWeatherToggle ?? true);
$('#rpg-toggle-show-narrator-mode').prop('checked', extensionSettings.showNarratorMode ?? true);
@@ -928,7 +954,6 @@ async function initUI() {
$('#rpg-generation-mode').val(extensionSettings.generationMode);
$('#rpg-skip-guided-mode').val(extensionSettings.skipInjectionsForGuided);
- $('#rpg-save-tracker-history').prop('checked', extensionSettings.saveTrackerHistory);
updatePanelVisibility();
updateSectionVisibility();
diff --git a/settings.html b/settings.html
index fd392ad..0a09928 100644
--- a/settings.html
+++ b/settings.html
@@ -48,7 +48,7 @@
- v3.3.3
+ v3.4.0
diff --git a/src/core/persistence.js b/src/core/persistence.js
index 65a783b..8384308 100644
--- a/src/core/persistence.js
+++ b/src/core/persistence.js
@@ -100,6 +100,24 @@ export function loadSettings() {
settingsChanged = true;
}
+ // Migration to version 4: Enable FAB widgets by default
+ if (currentVersion < 4) {
+ // console.log('[RPG Companion] Migrating settings to version 4 (enabling FAB widgets)');
+ if (!extensionSettings.mobileFabWidgets) {
+ extensionSettings.mobileFabWidgets = {};
+ }
+ extensionSettings.mobileFabWidgets.enabled = true;
+ extensionSettings.mobileFabWidgets.weatherIcon = { enabled: true };
+ extensionSettings.mobileFabWidgets.weatherDesc = { enabled: true };
+ extensionSettings.mobileFabWidgets.clock = { enabled: true };
+ extensionSettings.mobileFabWidgets.date = { enabled: true };
+ extensionSettings.mobileFabWidgets.location = { enabled: true };
+ extensionSettings.mobileFabWidgets.stats = { enabled: true };
+ extensionSettings.mobileFabWidgets.attributes = { enabled: true };
+ extensionSettings.settingsVersion = 4;
+ settingsChanged = true;
+ }
+
// Save migrated settings
if (settingsChanged) {
saveSettings();
@@ -741,8 +759,8 @@ export function createPreset(name) {
id: presetId,
name: name,
trackerConfig: JSON.parse(JSON.stringify(extensionSettings.trackerConfig)),
- historyPersistence: extensionSettings.historyPersistence
- ? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
+ historyPersistence: extensionSettings.historyPersistence
+ ? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
: null
};
// Also set it as the active preset so edits go to the new preset
@@ -760,8 +778,8 @@ export function saveToPreset(presetId) {
const preset = extensionSettings.presetManager.presets[presetId];
if (preset) {
preset.trackerConfig = JSON.parse(JSON.stringify(extensionSettings.trackerConfig));
- preset.historyPersistence = extensionSettings.historyPersistence
- ? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
+ preset.historyPersistence = extensionSettings.historyPersistence
+ ? JSON.parse(JSON.stringify(extensionSettings.historyPersistence))
: null;
saveSettings();
// console.log(`[RPG Companion] Saved current config to preset "${preset.name}"`);
@@ -904,7 +922,7 @@ export function hasPresetAssociation() {
*/
export function autoSwitchPresetForEntity() {
const associatedPresetId = getPresetForCurrentEntity();
-
+
// If there's a character-specific preset, use it
if (associatedPresetId && associatedPresetId !== extensionSettings.presetManager.activePresetId) {
// Check if the preset still exists
@@ -915,17 +933,17 @@ export function autoSwitchPresetForEntity() {
removePresetAssociationForCurrentEntity();
}
}
-
+
// No character association - fall back to default preset if set
if (!associatedPresetId) {
const defaultPresetId = extensionSettings.presetManager.defaultPresetId;
- if (defaultPresetId &&
+ if (defaultPresetId &&
defaultPresetId !== extensionSettings.presetManager.activePresetId &&
extensionSettings.presetManager.presets[defaultPresetId]) {
return loadPreset(defaultPresetId);
}
}
-
+
return false;
}
diff --git a/src/core/state.js b/src/core/state.js
index b1cedb9..5e9dedd 100644
--- a/src/core/state.js
+++ b/src/core/state.js
@@ -10,7 +10,7 @@
* Extension settings - persisted to SillyTavern settings
*/
export let extensionSettings = {
- settingsVersion: 3, // Version number for settings migrations (v3 = JSON format)
+ settingsVersion: 4, // Version number for settings migrations (v4 = FAB widgets enabled by default)
enabled: true,
autoUpdate: false,
updateDepth: 4, // How many messages to include in the context
@@ -27,6 +27,10 @@ export let extensionSettings = {
customHtmlPrompt: '', // Custom HTML prompt text (empty = use default)
enableDialogueColoring: false, // Enable dialogue coloring prompt injection
customDialogueColoringPrompt: '', // Custom dialogue coloring prompt text (empty = use default)
+ enableDeceptionSystem: false, // Enable deception tracking with tags
+ customDeceptionPrompt: '', // Custom deception prompt text (empty = use default)
+ enableCYOA: false, // Enable "Choose Your Own Adventure" formatting with action choices
+ customCYOAPrompt: '', // Custom CYOA prompt text (empty = use default)
enableSpotifyMusic: false, // Enable Spotify music integration (asks AI for Spotify URLs)
customSpotifyPrompt: '', // Custom Spotify prompt text (empty = use default)
@@ -34,6 +38,8 @@ export let extensionSettings = {
dismissedHolidayPromo: false, // User dismissed the holiday promotion banner
showHtmlToggle: true, // Show Immersive HTML toggle in main panel
showDialogueColoringToggle: true, // Show Dialogue Coloring toggle in main panel (enabled by default)
+ showDeceptionToggle: true, // Show Deception System toggle in main panel
+ showCYOAToggle: true, // Show CYOA toggle in main panel
showSpotifyToggle: true, // Show Spotify Music toggle in main panel
showDynamicWeatherToggle: true, // Show Dynamic Weather Effects toggle in main panel
@@ -42,7 +48,6 @@ export let extensionSettings = {
skipInjectionsForGuided: 'none', // skip injections for instruct injections and quiet prompts (GuidedGenerations compatibility)
enableRandomizedPlot: true, // Show randomized plot progression button above chat input
enableNaturalPlot: true, // Show natural plot progression button above chat input
- saveTrackerHistory: false, // Save tracker data in chat history for each message
// History persistence settings - inject selected tracker data into historical messages
historyPersistence: {
enabled: false, // Master toggle for history persistence feature
@@ -67,14 +72,14 @@ export let extensionSettings = {
}, // Saved position for mobile FAB button
// Mobile FAB widget display options (8-position system around the button)
mobileFabWidgets: {
- enabled: false, // Master toggle for FAB widgets
- weatherIcon: { enabled: false, position: 0 }, // Weather emoji (☀️, 🌧️, etc.)
- weatherDesc: { enabled: false, position: 1 }, // Weather description text
- clock: { enabled: false, position: 2 }, // Current time display
- date: { enabled: false, position: 3 }, // Date display
- location: { enabled: false, position: 4 }, // Location name
- stats: { enabled: false, position: 5 }, // All stats as compact numbers
- attributes: { enabled: false, position: 6 } // Compact RPG attributes display
+ enabled: true, // Master toggle for FAB widgets
+ weatherIcon: { enabled: true, position: 0 }, // Weather emoji (☀️, 🌧️, etc.)
+ weatherDesc: { enabled: true, position: 1 }, // Weather description text
+ clock: { enabled: true, position: 2 }, // Current time display
+ date: { enabled: true, position: 3 }, // Date display
+ location: { enabled: true, position: 4 }, // Location name
+ stats: { enabled: true, position: 5 }, // All stats as compact numbers
+ attributes: { enabled: true, position: 6 } // Compact RPG attributes display
},
userStats: JSON.stringify({
stats: [
diff --git a/src/systems/features/plotProgression.js b/src/systems/features/plotProgression.js
index ff61c41..89b5439 100644
--- a/src/systems/features/plotProgression.js
+++ b/src/systems/features/plotProgression.js
@@ -5,7 +5,7 @@
import { togglePlotButtons } from '../ui/layout.js';
import { extensionSettings, setIsPlotProgression } from '../../core/state.js';
-import { DEFAULT_HTML_PROMPT, DEFAULT_DIALOGUE_COLORING_PROMPT } from '../generation/promptBuilder.js';
+import { DEFAULT_HTML_PROMPT, DEFAULT_DIALOGUE_COLORING_PROMPT, DEFAULT_DECEPTION_PROMPT, DEFAULT_CYOA_PROMPT } from '../generation/promptBuilder.js';
import { Generate } from '../../../../../../../script.js';
/**
@@ -121,6 +121,20 @@ export async function sendPlotProgression(type) {
prompt += '\n\n' + dialogueColoringPromptText;
}
+ // Add Deception System prompt if enabled
+ if (extensionSettings.enableDeceptionSystem) {
+ // Use custom Deception prompt if set, otherwise use default
+ const deceptionPromptText = extensionSettings.customDeceptionPrompt || DEFAULT_DECEPTION_PROMPT;
+ prompt += '\n\n' + deceptionPromptText;
+ }
+
+ // Add CYOA prompt if enabled
+ if (extensionSettings.enableCYOA) {
+ // Use custom CYOA prompt if set, otherwise use default
+ const cyoaPromptText = extensionSettings.customCYOAPrompt || DEFAULT_CYOA_PROMPT;
+ prompt += '\n\n' + cyoaPromptText;
+ }
+
// Set flag to indicate we're doing plot progression
// This will be used by onMessageReceived to clear the prompt after generation completes
setIsPlotProgression(true);
diff --git a/src/systems/generation/apiClient.js b/src/systems/generation/apiClient.js
index 234a649..751e28a 100644
--- a/src/systems/generation/apiClient.js
+++ b/src/systems/generation/apiClient.js
@@ -304,21 +304,6 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
lastGeneratedData.characterThoughts = parsedData.characterThoughts;
}
- // When saveTrackerHistory is enabled, store tracker data on the user's message too
- // This allows scrolling through history and seeing trackers at each point
- if (extensionSettings.saveTrackerHistory && lastMessage && lastMessage.is_user) {
- if (!lastMessage.extra) {
- lastMessage.extra = {};
- }
- lastMessage.extra.rpg_companion_data = {
- userStats: parsedData.userStats,
- infoBox: parsedData.infoBox,
- characterThoughts: parsedData.characterThoughts,
- timestamp: Date.now()
- };
- // console.log('[RPG Companion] 💾 Stored tracker data on user message for history');
- }
-
// Also store on assistant message if present (existing behavior)
if (lastMessage && !lastMessage.is_user) {
if (!lastMessage.extra) {
diff --git a/src/systems/generation/injector.js b/src/systems/generation/injector.js
index 0e87a70..616644a 100644
--- a/src/systems/generation/injector.js
+++ b/src/systems/generation/injector.js
@@ -23,6 +23,8 @@ import {
formatHistoricalTrackerData,
DEFAULT_HTML_PROMPT,
DEFAULT_DIALOGUE_COLORING_PROMPT,
+ DEFAULT_DECEPTION_PROMPT,
+ DEFAULT_CYOA_PROMPT,
DEFAULT_SPOTIFY_PROMPT,
SPOTIFY_FORMAT_INSTRUCTION
} from './promptBuilder.js';
@@ -125,7 +127,7 @@ function buildHistoricalContextMap() {
}
// Build the context wrapper
- const preamble = historyPersistence.contextPreamble || '[Context at this point:]';
+ const preamble = historyPersistence.contextPreamble || 'Context for that moment:';
const wrappedContext = `\n${preamble}\n${formattedContext}`;
// Determine which message index to store based on injection position
@@ -261,8 +263,8 @@ export async function onGenerationStarted(type, data, dryRun) {
// console.log('[RPG Companion] Committed Prompt:', committedTrackerData);
// Skip tracker injection for image generation requests
- if (data?.quietImage) {
- // console.log('[RPG Companion] Detected image generation (quietImage=true), skipping tracker injection');
+ if (data?.quietImage || data?.quiet_image || data?.isImageGeneration) {
+ // console.log('[RPG Companion] Detected image generation, skipping tracker injection');
return;
}
@@ -467,7 +469,7 @@ export async function onGenerationStarted(type, data, dryRun) {
if (extensionSettings.enableHtmlPrompt && !shouldSuppress) {
// Use custom HTML prompt if set, otherwise use default
const htmlPromptText = extensionSettings.customHtmlPrompt || DEFAULT_HTML_PROMPT;
- const htmlPrompt = `\n${htmlPromptText}`;
+ const htmlPrompt = `\n- ${htmlPromptText}\n`;
setExtensionPrompt('rpg-companion-html', htmlPrompt, extension_prompt_types.IN_CHAT, 0, false);
// console.log('[RPG Companion] Injected HTML prompt at depth 0 for together mode');
@@ -480,7 +482,7 @@ export async function onGenerationStarted(type, data, dryRun) {
if (extensionSettings.enableDialogueColoring && !shouldSuppress) {
// Use custom Dialogue Coloring prompt if set, otherwise use default
const dialogueColoringPromptText = extensionSettings.customDialogueColoringPrompt || DEFAULT_DIALOGUE_COLORING_PROMPT;
- const dialogueColoringPrompt = `\n${dialogueColoringPromptText}`;
+ const dialogueColoringPrompt = `\n- ${dialogueColoringPromptText}\n`;
setExtensionPrompt('rpg-companion-dialogue-coloring', dialogueColoringPrompt, extension_prompt_types.IN_CHAT, 0, false);
// console.log('[RPG Companion] Injected Dialogue Coloring prompt at depth 0 for together mode');
@@ -489,11 +491,24 @@ export async function onGenerationStarted(type, data, dryRun) {
setExtensionPrompt('rpg-companion-dialogue-coloring', '', extension_prompt_types.IN_CHAT, 0, false);
}
+ // Inject Deception System prompt separately at depth 0 if enabled
+ if (extensionSettings.enableDeceptionSystem && !shouldSuppress) {
+ // Use custom Deception prompt if set, otherwise use default
+ const deceptionPromptText = extensionSettings.customDeceptionPrompt || DEFAULT_DECEPTION_PROMPT;
+ const deceptionPrompt = `\n- ${deceptionPromptText}\n`;
+
+ setExtensionPrompt('rpg-companion-deception', deceptionPrompt, extension_prompt_types.IN_CHAT, 0, false);
+ // console.log('[RPG Companion] Injected Deception System prompt at depth 0 for together mode');
+ } else {
+ // Clear Deception System prompt if disabled
+ setExtensionPrompt('rpg-companion-deception', '', extension_prompt_types.IN_CHAT, 0, false);
+ }
+
// Inject Spotify prompt separately at depth 0 if enabled
if (extensionSettings.enableSpotifyMusic && !shouldSuppress) {
// Use custom Spotify prompt if set, otherwise use default
const spotifyPromptText = extensionSettings.customSpotifyPrompt || DEFAULT_SPOTIFY_PROMPT;
- const spotifyPrompt = `\n${spotifyPromptText} ${SPOTIFY_FORMAT_INSTRUCTION}`;
+ const spotifyPrompt = `\n- ${spotifyPromptText} ${SPOTIFY_FORMAT_INSTRUCTION}\n`;
setExtensionPrompt('rpg-companion-spotify', spotifyPrompt, extension_prompt_types.IN_CHAT, 0, false);
// console.log('[RPG Companion] Injected Spotify prompt at depth 0 for together mode');
@@ -501,6 +516,20 @@ export async function onGenerationStarted(type, data, dryRun) {
// Clear Spotify prompt if disabled
setExtensionPrompt('rpg-companion-spotify', '', extension_prompt_types.IN_CHAT, 0, false);
}
+
+ // Inject CYOA prompt separately at depth 0 if enabled (injected last to appear last in prompt)
+ if (extensionSettings.enableCYOA && !shouldSuppress) {
+ // Use custom CYOA prompt if set, otherwise use default
+ const cyoaPromptText = extensionSettings.customCYOAPrompt || DEFAULT_CYOA_PROMPT;
+ const cyoaPrompt = `\n- ${cyoaPromptText}\n`;
+
+ setExtensionPrompt('rpg-companion-zzz-cyoa', cyoaPrompt, extension_prompt_types.IN_CHAT, 0, false);
+ // console.log('[RPG Companion] Injected CYOA prompt at depth 0 for together mode');
+ } else {
+ // Clear CYOA prompt if disabled
+ setExtensionPrompt('rpg-companion-zzz-cyoa', '', extension_prompt_types.IN_CHAT, 0, false);
+ }
+
} else if (extensionSettings.generationMode === 'separate' || extensionSettings.generationMode === 'external') {
// In SEPARATE and EXTERNAL modes, inject the contextual summary for main roleplay generation
const contextSummary = generateContextualSummary();
@@ -528,7 +557,7 @@ Ensure these details naturally reflect and influence the narrative. Character be
if (extensionSettings.enableHtmlPrompt && !shouldSuppress) {
// Use custom HTML prompt if set, otherwise use default
const htmlPromptText = extensionSettings.customHtmlPrompt || DEFAULT_HTML_PROMPT;
- const htmlPrompt = `\n${htmlPromptText}`;
+ const htmlPrompt = `\n- ${htmlPromptText}\n`;
setExtensionPrompt('rpg-companion-html', htmlPrompt, extension_prompt_types.IN_CHAT, 0, false);
// console.log('[RPG Companion] Injected HTML prompt at depth 0 for separate/external mode');
@@ -537,11 +566,37 @@ Ensure these details naturally reflect and influence the narrative. Character be
setExtensionPrompt('rpg-companion-html', '', extension_prompt_types.IN_CHAT, 0, false);
}
+ // Inject Dialogue Coloring prompt separately at depth 0 if enabled
+ if (extensionSettings.enableDialogueColoring && !shouldSuppress) {
+ // Use custom Dialogue Coloring prompt if set, otherwise use default
+ const dialogueColoringPromptText = extensionSettings.customDialogueColoringPrompt || DEFAULT_DIALOGUE_COLORING_PROMPT;
+ const dialogueColoringPrompt = `\n- ${dialogueColoringPromptText}\n`;
+
+ setExtensionPrompt('rpg-companion-dialogue-coloring', dialogueColoringPrompt, extension_prompt_types.IN_CHAT, 0, false);
+ // console.log('[RPG Companion] Injected Dialogue Coloring prompt at depth 0 for separate/external mode');
+ } else {
+ // Clear Dialogue Coloring prompt if disabled
+ setExtensionPrompt('rpg-companion-dialogue-coloring', '', extension_prompt_types.IN_CHAT, 0, false);
+ }
+
+ // Inject Deception System prompt separately at depth 0 if enabled
+ if (extensionSettings.enableDeceptionSystem && !shouldSuppress) {
+ // Use custom Deception prompt if set, otherwise use default
+ const deceptionPromptText = extensionSettings.customDeceptionPrompt || DEFAULT_DECEPTION_PROMPT;
+ const deceptionPrompt = `\n- ${deceptionPromptText}\n`;
+
+ setExtensionPrompt('rpg-companion-deception', deceptionPrompt, extension_prompt_types.IN_CHAT, 0, false);
+ // console.log('[RPG Companion] Injected Deception System prompt at depth 0 for separate/external mode');
+ } else {
+ // Clear Deception System prompt if disabled
+ setExtensionPrompt('rpg-companion-deception', '', extension_prompt_types.IN_CHAT, 0, false);
+ }
+
// Inject Spotify prompt separately at depth 0 if enabled
if (extensionSettings.enableSpotifyMusic && !shouldSuppress) {
// Use custom Spotify prompt if set, otherwise use default
const spotifyPromptText = extensionSettings.customSpotifyPrompt || DEFAULT_SPOTIFY_PROMPT;
- const spotifyPrompt = `\n${spotifyPromptText} ${SPOTIFY_FORMAT_INSTRUCTION}`;
+ const spotifyPrompt = `\n- ${spotifyPromptText} ${SPOTIFY_FORMAT_INSTRUCTION}\n`;
setExtensionPrompt('rpg-companion-spotify', spotifyPrompt, extension_prompt_types.IN_CHAT, 0, false);
// console.log('[RPG Companion] Injected Spotify prompt at depth 0 for separate/external mode');
@@ -550,6 +605,19 @@ Ensure these details naturally reflect and influence the narrative. Character be
setExtensionPrompt('rpg-companion-spotify', '', extension_prompt_types.IN_CHAT, 0, false);
}
+ // Inject CYOA prompt separately at depth 0 if enabled (injected last to appear last in prompt)
+ if (extensionSettings.enableCYOA && !shouldSuppress) {
+ // Use custom CYOA prompt if set, otherwise use default
+ const cyoaPromptText = extensionSettings.customCYOAPrompt || DEFAULT_CYOA_PROMPT;
+ const cyoaPrompt = `\n- ${cyoaPromptText}\n`;
+
+ setExtensionPrompt('rpg-companion-zzz-cyoa', cyoaPrompt, extension_prompt_types.IN_CHAT, 0, false);
+ // console.log('[RPG Companion] Injected CYOA prompt at depth 0 for separate/external mode');
+ } else {
+ // Clear CYOA prompt if disabled
+ setExtensionPrompt('rpg-companion-zzz-cyoa', '', extension_prompt_types.IN_CHAT, 0, false);
+ }
+
// Clear together mode injections
setExtensionPrompt('rpg-companion-inject', '', extension_prompt_types.IN_CHAT, 0, false);
setExtensionPrompt('rpg-companion-example', '', extension_prompt_types.IN_CHAT, 0, false);
@@ -559,6 +627,9 @@ Ensure these details naturally reflect and influence the narrative. Character be
setExtensionPrompt('rpg-companion-example', '', extension_prompt_types.IN_CHAT, 0, false);
setExtensionPrompt('rpg-companion-context', '', extension_prompt_types.IN_CHAT, 1, false);
setExtensionPrompt('rpg-companion-html', '', extension_prompt_types.IN_CHAT, 0, false);
+ setExtensionPrompt('rpg-companion-dialogue-coloring', '', extension_prompt_types.IN_CHAT, 0, false);
+ setExtensionPrompt('rpg-companion-deception', '', extension_prompt_types.IN_CHAT, 0, false);
+ setExtensionPrompt('rpg-companion-zzz-cyoa', '', extension_prompt_types.IN_CHAT, 0, false);
setExtensionPrompt('rpg-companion-spotify', '', extension_prompt_types.IN_CHAT, 0, false);
}
diff --git a/src/systems/generation/promptBuilder.js b/src/systems/generation/promptBuilder.js
index 1a90832..53d1f45 100644
--- a/src/systems/generation/promptBuilder.js
+++ b/src/systems/generation/promptBuilder.js
@@ -28,6 +28,16 @@ export const DEFAULT_HTML_PROMPT = `If appropriate, include inline HTML, CSS, an
*/
export const DEFAULT_DIALOGUE_COLORING_PROMPT = `Wrap all character/NPC "dialogues" in unique tags, exemplary: "You're pretty good." Assign a distinct color to each speaker and reuse it whenever they speak again.`;
+/**
+ * Default Deception System prompt text
+ */
+export const DEFAULT_DECEPTION_PROMPT = `When a character is lying or deceiving, you should follow up that line with the tag, containing a brief description of the truth and the lie's reason, using the template below (replace placeholders in brackets). This will be hidden from the user's view, but not to you, making it useful for future consequences: [Character] is [lying/deceiving/omitting], the truth is [truth]. Reason: [reason].`;
+
+/**
+ * Default CYOA prompt text
+ */
+export const DEFAULT_CYOA_PROMPT = `Since this is a "Choose Your Own Adventure" type of game, you must finish your response by creating a numbered list of 5 different possible action or dialogue options (depending on the scene) for the user to choose from. Make sure they all fit their persona well. They will respond with their choice on how to progress.`;
+
/**
* Default Spotify music prompt text (customizable by users)
*/
@@ -229,7 +239,6 @@ function buildAttributesString() {
*/
export function generateTrackerExample() {
let example = '';
- const useXmlTags = extensionSettings.saveTrackerHistory;
// Use COMMITTED data for generation context, not displayed data
// Apply locks before sending to AI (for JSON format only)
@@ -310,19 +319,11 @@ export function generateTrackerInstructions(includeHtmlPrompt = true, includeCon
// Only add tracker instructions if at least one tracker is enabled
if (hasAnyTrackers) {
- // Determine format based on saveTrackerHistory setting
- const useXmlTags = extensionSettings.saveTrackerHistory;
- const openTag = useXmlTags ? '\n' : '';
- const closeTag = useXmlTags ? '\n' : '';
const codeBlockMarker = '';
const endCodeBlockMarker = '';
// Universal instruction header
- if (useXmlTags) {
- instructions += `\nAt the start of every reply, you must attach an update to the trackers in EXACTLY the JSON format shown below, enclosed in XML tags. `;
- } else {
- instructions += '\nAt the start of every reply, you must attach an update to the trackers in EXACTLY the JSON format shown below as a single unified JSON object containing all enabled tracker fields. ';
- }
+ instructions += '\nAt the start of every reply, you must attach an update to the trackers in EXACTLY the JSON format shown below as a single unified JSON object containing all enabled tracker fields. ';
// Append custom instruction portion if available
const customPrompt = extensionSettings.customTrackerInstructionsPrompt;
@@ -789,7 +790,7 @@ export function formatHistoricalTrackerData(trackerData, trackerConfig, userName
let statsFormatted = '';
// Custom stats with persistInHistory enabled
- if (userStatsData.stats && Array.isArray(userStatsData.stats)) {
+ if (userStatsData.stats && Array.isArray(userStatsData.stats) && userStatsConfig.customStats) {
for (const stat of userStatsData.stats) {
const configStat = userStatsConfig.customStats.find(s => s.id === stat.id);
if (configStat?.persistInHistory && stat.value !== undefined) {
@@ -1169,7 +1170,7 @@ export async function generateSeparateUpdatePrompt() {
continue;
}
- const preamble = historyPersistence.contextPreamble || '[Context at this point:]';
+ const preamble = historyPersistence.contextPreamble || 'Context for that moment:';
const wrappedContext = `\n${preamble}\n${formattedContext}`;
// Determine target message based on position
diff --git a/src/systems/integration/sillytavern.js b/src/systems/integration/sillytavern.js
index 18321cd..3816433 100644
--- a/src/systems/integration/sillytavern.js
+++ b/src/systems/integration/sillytavern.js
@@ -204,20 +204,16 @@ export async function onMessageReceived(data) {
// Remove the tracker code blocks from the visible message
let cleanedMessage = responseText;
- // Only remove trackers if saveTrackerHistory is disabled
- // When enabled, trackers are in XML tags which SillyTavern auto-hides
- if (!extensionSettings.saveTrackerHistory) {
- // Note: JSON code blocks are hidden from display by regex script (but preserved in message data)
+ // Note: JSON code blocks are hidden from display by regex script (but preserved in message data)
- // Remove old text format code blocks (legacy support)
- cleanedMessage = cleanedMessage.replace(/```[^`]*?Stats\s*\n\s*---[^`]*?```\s*/gi, '');
- cleanedMessage = cleanedMessage.replace(/```[^`]*?Info Box\s*\n\s*---[^`]*?```\s*/gi, '');
- cleanedMessage = cleanedMessage.replace(/```[^`]*?Present Characters\s*\n\s*---[^`]*?```\s*/gi, '');
- // Remove any stray "---" dividers that might appear after the code blocks
- cleanedMessage = cleanedMessage.replace(/^\s*---\s*$/gm, '');
- // Clean up multiple consecutive newlines
- cleanedMessage = cleanedMessage.replace(/\n{3,}/g, '\n\n');
- }
+ // Remove old text format code blocks (legacy support)
+ cleanedMessage = cleanedMessage.replace(/```[^`]*?Stats\s*\n\s*---[^`]*?```\s*/gi, '');
+ cleanedMessage = cleanedMessage.replace(/```[^`]*?Info Box\s*\n\s*---[^`]*?```\s*/gi, '');
+ cleanedMessage = cleanedMessage.replace(/```[^`]*?Present Characters\s*\n\s*---[^`]*?```\s*/gi, '');
+ // Remove any stray "---" dividers that might appear after the code blocks
+ cleanedMessage = cleanedMessage.replace(/^\s*---\s*$/gm, '');
+ // Clean up multiple consecutive newlines
+ cleanedMessage = cleanedMessage.replace(/\n{3,}/g, '\n\n');
// Note: XML tags are automatically hidden by SillyTavern
// Note: tags are also automatically hidden by SillyTavern
diff --git a/src/systems/ui/promptsEditor.js b/src/systems/ui/promptsEditor.js
index 59273da..45aadcc 100644
--- a/src/systems/ui/promptsEditor.js
+++ b/src/systems/ui/promptsEditor.js
@@ -4,7 +4,7 @@
*/
import { extensionSettings } from '../../core/state.js';
import { saveSettings } from '../../core/persistence.js';
-import { DEFAULT_HTML_PROMPT, DEFAULT_DIALOGUE_COLORING_PROMPT, DEFAULT_SPOTIFY_PROMPT, DEFAULT_NARRATOR_PROMPT } from '../generation/promptBuilder.js';
+import { DEFAULT_HTML_PROMPT, DEFAULT_DIALOGUE_COLORING_PROMPT, DEFAULT_DECEPTION_PROMPT, DEFAULT_CYOA_PROMPT, DEFAULT_SPOTIFY_PROMPT, DEFAULT_NARRATOR_PROMPT } from '../generation/promptBuilder.js';
let $editorModal = null;
let tempPrompts = null; // Temporary prompts for cancel functionality
@@ -13,6 +13,8 @@ let tempPrompts = null; // Temporary prompts for cancel functionality
const DEFAULT_PROMPTS = {
html: DEFAULT_HTML_PROMPT,
dialogueColoring: DEFAULT_DIALOGUE_COLORING_PROMPT,
+ deception: DEFAULT_DECEPTION_PROMPT,
+ cyoa: DEFAULT_CYOA_PROMPT,
spotify: DEFAULT_SPOTIFY_PROMPT,
narrator: DEFAULT_NARRATOR_PROMPT,
plotRandom: 'Actually, the scene is getting stale. Introduce {{random::stakes::a plot twist::a new character::a cataclysm::a fourth-wall-breaking joke::a sudden atmospheric phenomenon::a plot hook::a running gag::an ecchi scenario::Death from Discworld::a new stake::a drama::a conflict::an angered entity::a god::a vision::a prophetic dream::Il Dottore from Genshin Impact::a new development::a civilian in need::an emotional bit::a threat::a villain::an important memory recollection::a marriage proposal::a date idea::an angry horde of villagers with pitchforks::a talking animal::an enemy::a cliffhanger::a short omniscient POV shift to a completely different character::a quest::an unexpected revelation::a scandal::an evil clone::death of an important character::harm to an important character::a romantic setup::a gossip::a messenger::a plot point from the past::a plot hole::a tragedy::a ghost::an otherworldly occurrence::a plot device::a curse::a magic device::a rival::an unexpected pregnancy::a brothel::a prostitute::a new location::a past lover::a completely random thing::a what-if scenario::a significant choice::war::love::a monster::lewd undertones::Professor Mari::a travelling troupe::a secret::a fortune-teller::something completely different::a killer::a murder mystery::a mystery::a skill check::a deus ex machina::three raccoons in a trench coat::a pet::a slave::an orphan::a psycho::tentacles::"there is only one bed" trope::accidental marriage::a fun twist::a boss battle::sexy corn::an eldritch horror::a character getting hungry, thirsty, or exhausted::horniness::a need for a bathroom break need::someone fainting::an assassination attempt::a meta narration of this all being an out of hand DND session::a dungeon::a friend in need::an old friend::a small time skip::a scene shift::Aurora Borealis, at this time of year, at this time of day, at this part of the country::a grand ball::a surprise party::zombies::foreshadowing::a Spanish Inquisition (nobody expects it)::a natural plot progression}} to make things more interesting! Be creative, but stay grounded in the setting.',
@@ -93,6 +95,8 @@ function openPromptsEditor() {
tempPrompts = {
html: extensionSettings.customHtmlPrompt || '',
dialogueColoring: extensionSettings.customDialogueColoringPrompt || '',
+ deception: extensionSettings.customDeceptionPrompt || '',
+ cyoa: extensionSettings.customCYOAPrompt || '',
spotify: extensionSettings.customSpotifyPrompt || '',
narrator: extensionSettings.customNarratorPrompt || '',
plotRandom: extensionSettings.customPlotRandomPrompt || '',
@@ -106,6 +110,8 @@ function openPromptsEditor() {
// Load current values or defaults
$('#rpg-prompt-html').val(extensionSettings.customHtmlPrompt || DEFAULT_PROMPTS.html);
$('#rpg-prompt-dialogue-coloring').val(extensionSettings.customDialogueColoringPrompt || DEFAULT_PROMPTS.dialogueColoring);
+ $('#rpg-prompt-deception').val(extensionSettings.customDeceptionPrompt || DEFAULT_PROMPTS.deception);
+ $('#rpg-prompt-cyoa').val(extensionSettings.customCYOAPrompt || DEFAULT_PROMPTS.cyoa);
$('#rpg-prompt-spotify').val(extensionSettings.customSpotifyPrompt || DEFAULT_PROMPTS.spotify);
$('#rpg-prompt-narrator').val(extensionSettings.customNarratorPrompt || DEFAULT_PROMPTS.narrator);
$('#rpg-prompt-plot-random').val(extensionSettings.customPlotRandomPrompt || DEFAULT_PROMPTS.plotRandom);
@@ -143,6 +149,8 @@ function closePromptsEditor() {
function savePrompts() {
extensionSettings.customHtmlPrompt = $('#rpg-prompt-html').val().trim();
extensionSettings.customDialogueColoringPrompt = $('#rpg-prompt-dialogue-coloring').val().trim();
+ extensionSettings.customDeceptionPrompt = $('#rpg-prompt-deception').val().trim();
+ extensionSettings.customCYOAPrompt = $('#rpg-prompt-cyoa').val().trim();
extensionSettings.customSpotifyPrompt = $('#rpg-prompt-spotify').val().trim();
extensionSettings.customNarratorPrompt = $('#rpg-prompt-narrator').val().trim();
extensionSettings.customPlotRandomPrompt = $('#rpg-prompt-plot-random').val().trim();
@@ -171,6 +179,12 @@ function restorePromptToDefault(promptType) {
case 'dialogueColoring':
extensionSettings.customDialogueColoringPrompt = '';
break;
+ case 'deception':
+ extensionSettings.customDeceptionPrompt = '';
+ break;
+ case 'cyoa':
+ extensionSettings.customCYOAPrompt = '';
+ break;
case 'spotify':
extensionSettings.customSpotifyPrompt = '';
break;
@@ -206,6 +220,8 @@ function restorePromptToDefault(promptType) {
function restoreAllToDefaults() {
$('#rpg-prompt-html').val(DEFAULT_PROMPTS.html);
$('#rpg-prompt-dialogue-coloring').val(DEFAULT_PROMPTS.dialogueColoring);
+ $('#rpg-prompt-deception').val(DEFAULT_PROMPTS.deception);
+ $('#rpg-prompt-cyoa').val(DEFAULT_PROMPTS.cyoa);
$('#rpg-prompt-spotify').val(DEFAULT_PROMPTS.spotify);
$('#rpg-prompt-narrator').val(DEFAULT_PROMPTS.narrator);
$('#rpg-prompt-plot-random').val(DEFAULT_PROMPTS.plotRandom);
@@ -218,6 +234,8 @@ function restoreAllToDefaults() {
// Clear all custom prompts
extensionSettings.customHtmlPrompt = '';
extensionSettings.customDialogueColoringPrompt = '';
+ extensionSettings.customDeceptionPrompt = '';
+ extensionSettings.customCYOAPrompt = '';
extensionSettings.customSpotifyPrompt = '';
extensionSettings.customNarratorPrompt = '';
extensionSettings.customPlotRandomPrompt = '';
diff --git a/src/systems/ui/theme.js b/src/systems/ui/theme.js
index ef7a8ee..81d5366 100644
--- a/src/systems/ui/theme.js
+++ b/src/systems/ui/theme.js
@@ -138,6 +138,8 @@ export function updateFeatureTogglesVisibility() {
const $featuresRow = $('#rpg-features-row');
const $htmlToggle = $('#rpg-html-toggle-wrapper');
const $dialogueColoringToggle = $('#rpg-dialogue-coloring-toggle-wrapper');
+ const $deceptionToggle = $('#rpg-deception-toggle-wrapper');
+ const $cyoaToggle = $('#rpg-cyoa-toggle-wrapper');
const $spotifyToggle = $('#rpg-spotify-toggle-wrapper');
const $dynamicWeatherToggle = $('#rpg-dynamic-weather-toggle-wrapper');
@@ -147,6 +149,8 @@ export function updateFeatureTogglesVisibility() {
// Show/hide individual toggles
$htmlToggle.toggle(extensionSettings.showHtmlToggle);
$dialogueColoringToggle.toggle(extensionSettings.showDialogueColoringToggle);
+ $deceptionToggle.toggle(extensionSettings.showDeceptionToggle ?? true);
+ $cyoaToggle.toggle(extensionSettings.showCYOAToggle ?? true);
$spotifyToggle.toggle(extensionSettings.showSpotifyToggle);
$dynamicWeatherToggle.toggle(extensionSettings.showDynamicWeatherToggle);
@@ -156,6 +160,8 @@ export function updateFeatureTogglesVisibility() {
// Hide entire row if all toggles are hidden
const anyVisible = extensionSettings.showHtmlToggle ||
extensionSettings.showDialogueColoringToggle ||
+ (extensionSettings.showDeceptionToggle ?? true) ||
+ (extensionSettings.showCYOAToggle ?? true) ||
extensionSettings.showSpotifyToggle ||
extensionSettings.showDynamicWeatherToggle ||
extensionSettings.showNarratorMode ||
diff --git a/src/systems/ui/trackerEditor.js b/src/systems/ui/trackerEditor.js
index 0f3ec82..2d98f88 100644
--- a/src/systems/ui/trackerEditor.js
+++ b/src/systems/ui/trackerEditor.js
@@ -1392,15 +1392,15 @@ function renderHistoryPersistenceTab() {
html += '';
html += ``;
html += ``;
html += '
';
// Custom preamble
html += '';
- html += ``;
- html += ``;
+ html += ``;
+ html += ``;
html += '
';
// User Stats section - which stats to persist
diff --git a/style.css b/style.css
index 80fbf1e..d3a7f10 100644
--- a/style.css
+++ b/style.css
@@ -4002,7 +4002,6 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
display: flex;
gap: 0;
border-bottom: 2px solid var(--rpg-border);
- margin-bottom: 1em;
}
.rpg-editor-tab {
@@ -10205,3 +10204,84 @@ body[data-theme="cyberpunk"] .rpg-music-widget-play {
100% { transform: rotate(360deg); }
}
+/* ============================================
+ FAB WIDGET THEME VARIATIONS
+ ============================================ */
+
+/* Sci-Fi / Synthwave Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="sci-fi"]) .rpg-fab-widget {
+ background: rgba(10, 14, 39, 0.95);
+ border: 1px solid rgba(139, 0, 255, 0.5);
+ color: #00fff9;
+ box-shadow: 0 3px 12px rgba(139, 0, 255, 0.3), 0 0 8px rgba(255, 0, 110, 0.2);
+}
+
+body:has(.rpg-panel[data-theme="sci-fi"]) .rpg-fab-widget:hover {
+ border-color: rgba(255, 0, 110, 0.7);
+ box-shadow: 0 4px 16px rgba(139, 0, 255, 0.5), 0 0 12px rgba(255, 0, 110, 0.4);
+}
+
+/* Fantasy / Rustic Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="fantasy"]) .rpg-fab-widget {
+ background: rgba(43, 24, 16, 0.95);
+ border: 1px solid rgba(139, 105, 20, 0.6);
+ color: #f4e8d0;
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6), 0 0 1px rgba(212, 175, 55, 0.3);
+}
+
+body:has(.rpg-panel[data-theme="fantasy"]) .rpg-fab-widget:hover {
+ border-color: rgba(212, 175, 55, 0.8);
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 8px rgba(212, 175, 55, 0.4);
+}
+
+/* Cyberpunk Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="cyberpunk"]) .rpg-fab-widget {
+ background: rgba(15, 5, 25, 0.95);
+ border: 1px solid rgba(255, 0, 255, 0.4);
+ color: #00ffff;
+ box-shadow: 0 3px 12px rgba(255, 0, 255, 0.3), 0 0 8px rgba(0, 255, 255, 0.2);
+}
+
+body:has(.rpg-panel[data-theme="cyberpunk"]) .rpg-fab-widget:hover {
+ border-color: rgba(0, 255, 255, 0.7);
+ box-shadow: 0 4px 16px rgba(255, 0, 255, 0.5), 0 0 12px rgba(0, 255, 255, 0.4);
+}
+
+/* Minimal Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="minimal"]) .rpg-fab-widget {
+ background: rgba(245, 245, 250, 0.98);
+ border: 1px solid rgba(200, 200, 210, 0.8);
+ color: #2c3e50;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+}
+
+body:has(.rpg-panel[data-theme="minimal"]) .rpg-fab-widget:hover {
+ border-color: rgba(52, 152, 219, 0.6);
+ box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
+}
+
+/* Dark Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="dark"]) .rpg-fab-widget {
+ background: rgba(25, 25, 35, 0.95);
+ border: 1px solid rgba(70, 70, 90, 0.6);
+ color: #e0e0e0;
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
+}
+
+body:has(.rpg-panel[data-theme="dark"]) .rpg-fab-widget:hover {
+ border-color: rgba(100, 100, 130, 0.8);
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
+}
+
+/* Light Theme for FAB Widgets */
+body:has(.rpg-panel[data-theme="light"]) .rpg-fab-widget {
+ background: rgba(255, 255, 255, 0.98);
+ border: 1px solid rgba(220, 220, 230, 0.8);
+ color: #2c3e50;
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
+}
+
+body:has(.rpg-panel[data-theme="light"]) .rpg-fab-widget:hover {
+ border-color: rgba(52, 152, 219, 0.6);
+ box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
+}
diff --git a/template.html b/template.html
index ea4241c..40d9f27 100644
--- a/template.html
+++ b/template.html
@@ -90,6 +90,24 @@
+
+
+
+
+
+
+
+
+
+