mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Trigger concatenation on NaN current value
This commit is contained in:
@ -37,7 +37,7 @@ function addLocalVariable(name, value) {
|
|||||||
const currentValue = getLocalVariable(name) || 0;
|
const currentValue = getLocalVariable(name) || 0;
|
||||||
const increment = Number(value);
|
const increment = Number(value);
|
||||||
|
|
||||||
if (isNaN(increment)) {
|
if (isNaN(increment) || isNaN(Number(currentValue))) {
|
||||||
const stringValue = String(currentValue || '') + value;
|
const stringValue = String(currentValue || '') + value;
|
||||||
setLocalVariable(name, stringValue);
|
setLocalVariable(name, stringValue);
|
||||||
return stringValue;
|
return stringValue;
|
||||||
@ -57,7 +57,7 @@ function addGlobalVariable(name, value) {
|
|||||||
const currentValue = getGlobalVariable(name) || 0;
|
const currentValue = getGlobalVariable(name) || 0;
|
||||||
const increment = Number(value);
|
const increment = Number(value);
|
||||||
|
|
||||||
if (isNaN(increment)) {
|
if (isNaN(increment)|| isNaN(Number(currentValue))) {
|
||||||
const stringValue = String(currentValue || '') + value;
|
const stringValue = String(currentValue || '') + value;
|
||||||
setGlobalVariable(name, stringValue);
|
setGlobalVariable(name, stringValue);
|
||||||
return stringValue;
|
return stringValue;
|
||||||
|
Reference in New Issue
Block a user