Compare commits

...

2 Commits

Author SHA1 Message Date
Ho-spair 495c08cb0f modify algorithm 2024-05-15 18:24:23 +08:00
Ho-spair 3f5f8a7f16 modify [function] processPrompt 2024-05-15 17:05:30 +08:00
2 changed files with 16 additions and 8 deletions

View File

@ -497,10 +497,14 @@ function processPrompt(prompt) {
raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
if (raw.match("%dest"))
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
if (raw.match("%arg2"))
raw = raw.replace(/%arg2/g, luatr(data[4]));
if (raw.match("%arg"))
raw = raw.replace(/%arg/g, luatr(data[3]));
if (data.length > 3) {
for (let i = data.length - 1; i > 3; i--) {
raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), luatr(data[i]));
}
raw = raw.replace(new RegExp("%arg", "g"), luatr(data[3]));
}
return raw;
}

View File

@ -21,10 +21,14 @@ function processPrompt(prompt) {
raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
if (raw.match("%dest"))
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
if (raw.match("%arg2"))
raw = raw.replace(/%arg2/g, luatr(data[4]));
if (raw.match("%arg"))
raw = raw.replace(/%arg/g, luatr(data[3]));
if (data.length > 3) {
for (let i = 4; i < data.length; i++) {
raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]);
}
raw = raw.replace(new RegExp("%arg", "g"), data[3]);
}
return raw;
}