diff --git a/src/lib/ChatScreens/BackgroundDom.svelte b/src/lib/ChatScreens/BackgroundDom.svelte
index 9b11f0cf..0af7ff15 100644
--- a/src/lib/ChatScreens/BackgroundDom.svelte
+++ b/src/lib/ChatScreens/BackgroundDom.svelte
@@ -14,7 +14,7 @@
{#if selIdState.selId > -1}
{#key $ReloadGUIPointer}
- {#await ParseMarkdown(risuChatParser((backgroundHTML || '') + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
+ {#await ParseMarkdown(risuChatParser((backgroundHTML || '') + '\n' + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
{@html md}
{/await}
diff --git a/src/ts/process/scripts.ts b/src/ts/process/scripts.ts
index 1f126ccb..6db696b6 100644
--- a/src/ts/process/scripts.ts
+++ b/src/ts/process/scripts.ts
@@ -67,8 +67,8 @@ export async function importRegex(o?:customscript[]):Promise{
let bestMatchCache = new Map()
let processScriptCache = new Map()
-function cacheScript(scripts:customscript[], data:string, result:string){
- let hash = data + '|||'
+function cacheScript(scripts:customscript[], data:string, result:string, mode:ScriptMode){
+ let hash = data + '|||' + mode + '|||'
for(const script of scripts){
hash += `${script.in}|||${script.out}|||${script.flag}|||${script.ableFlag}|||${script.type}`
}
@@ -81,8 +81,8 @@ function cacheScript(scripts:customscript[], data:string, result:string){
}
-function getScriptCache(scripts:customscript[], data:string){
- let hash = data + '|||'
+function getScriptCache(scripts:customscript[], data:string, mode:ScriptMode){
+ let hash = data + '|||' + mode + '|||'
for(const script of scripts){
hash += `${script.in}|||${script.out}|||${script.flag}|||${script.ableFlag}|||${script.type}`
}
@@ -97,7 +97,7 @@ export function resetScriptCache(){
export async function processScriptFull(char:character|groupChat|simpleCharacterArgument, data:string, mode:ScriptMode, chatID = -1, cbsConditions:CbsConditions = {}){
let db = getDatabase()
const originalData = data
- const cached = getScriptCache((db.globalscript ?? []).concat(char.customscript), originalData)
+ const cached = getScriptCache((db.globalscript ?? []).concat(char.customscript), originalData, mode)
if(cached){
return {data: cached, emoChanged: false}
}
@@ -110,7 +110,7 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
})
data = await runLuaEditTrigger(char, mode, data)
if(scripts.length === 0){
- cacheScript(scripts, originalData, data)
+ cacheScript(scripts, originalData, data, mode)
return {data, emoChanged}
}
function executeScript(pscript:pScript){
@@ -345,7 +345,7 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
}
}
- cacheScript(scripts, originalData, data)
+ cacheScript(scripts, originalData, data, mode)
return {data, emoChanged}
}