[feat] global scripts
This commit is contained in:
@@ -245,6 +245,12 @@ export function setDatabase(data:Database){
|
||||
data: []
|
||||
}]
|
||||
}
|
||||
if(checkNullish(data.loreBookPage) || data.loreBook.length < data.loreBookPage){
|
||||
data.loreBookPage = 0
|
||||
}
|
||||
if(checkNullish(data.globalscript)){
|
||||
data.globalscript = []
|
||||
}
|
||||
|
||||
|
||||
changeLanguage(data.language)
|
||||
@@ -474,6 +480,8 @@ export interface Database{
|
||||
token:string,
|
||||
model:string
|
||||
}
|
||||
globalscript: customscript[]
|
||||
|
||||
}
|
||||
|
||||
interface hordeConfig{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { get } from "svelte/store";
|
||||
import { CharEmotion, selectedCharID } from "../stores";
|
||||
import type { character } from "../database";
|
||||
import { DataBase, type character } from "../database";
|
||||
|
||||
const dreg = /{{data}}/g
|
||||
|
||||
@@ -11,7 +11,9 @@ export function processScript(char:character, data:string, mode:ScriptMode){
|
||||
}
|
||||
|
||||
export function processScriptFull(char:character, data:string, mode:ScriptMode){
|
||||
let db = get(DataBase)
|
||||
let emoChanged = false
|
||||
const scripts = char.customscript.concat(db.globalscript ?? [])
|
||||
for (const script of char.customscript){
|
||||
if(script.type === mode){
|
||||
const reg = new RegExp(script.in,'g')
|
||||
|
||||
Reference in New Issue
Block a user