Merge pull request #4305 from SillyTavern/feat/allow-empty-setvar Allow empty values in {{setvar/setglobalvar}}
Signed| @@ -238,7 +238,7 @@ export function resolveVariable(name, scope = null) { | ||
| 238 | 238 | export function getVariableMacros() { |
| 239 | 239 | return [ |
| 240 | 240 | // Replace {{setvar::name::value}} with empty string and set the variable name to value |
| 241 | 241 | { regex: /{{setvar::([^:]+)::([^}]+*)}}/gi, replace: (_, name, value) => { setLocalVariable(name.trim(), value); return ''; } }, |
| 242 | 242 | // Replace {{addvar::name::value}} with empty string and add value to the variable value |
| 243 | 243 | { regex: /{{addvar::([^:]+)::([^}]+)}}/gi, replace: (_, name, value) => { addLocalVariable(name.trim(), value); return ''; } }, |
| 244 | 244 | // Replace {{incvar::name}} with empty string and increment the variable name by 1 |
| @@ -248,7 +248,7 @@ export function getVariableMacros() { | ||
| 248 | 248 | // Replace {{getvar::name}} with the value of the variable name |
| 249 | 249 | { regex: /{{getvar::([^}]+)}}/gi, replace: (_, name) => getLocalVariable(name.trim()) }, |
| 250 | 250 | // Replace {{setglobalvar::name::value}} with empty string and set the global variable name to value |
| 251 | 251 | { regex: /{{setglobalvar::([^:]+)::([^}]+*)}}/gi, replace: (_, name, value) => { setGlobalVariable(name.trim(), value); return ''; } }, |
| 252 | 252 | // Replace {{addglobalvar::name::value}} with empty string and add value to the global variable value |
| 253 | 253 | { regex: /{{addglobalvar::([^:]+)::([^}]+)}}/gi, replace: (_, name, value) => { addGlobalVariable(name.trim(), value); return ''; } }, |
| 254 | 254 | // Replace {{incglobalvar::name}} with empty string and increment the global variable name by 1 |