mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-01 11:56:48 +01:00
Fix /sub actually allowing more than two vals now
- Fix by subtracting all from the first value - Update the definition too
This commit is contained in:
parent
4855f25419
commit
224249a0d2
@ -730,7 +730,7 @@ function maxValuesCallback(args, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function subValuesCallback(args, value) {
|
function subValuesCallback(args, value) {
|
||||||
return performOperation(value, (array) => array[0] - array[1], false, args._scope);
|
return performOperation(value, (array) => array.reduce((a, b) => a - b, array.shift() ?? 0), false, args._scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
function divValuesCallback(args, value) {
|
function divValuesCallback(args, value) {
|
||||||
@ -1716,14 +1716,15 @@ export function registerVariableCommands() {
|
|||||||
returns: 'difference of the provided values',
|
returns: 'difference of the provided values',
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
SlashCommandArgument.fromProps({
|
SlashCommandArgument.fromProps({
|
||||||
description: 'values to find the difference',
|
description: 'values to subtract, starting form the first provided value',
|
||||||
typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],
|
typeList: [ARGUMENT_TYPE.NUMBER, ARGUMENT_TYPE.VARIABLE_NAME],
|
||||||
isRequired: true,
|
isRequired: true,
|
||||||
acceptsMultiple: true,
|
acceptsMultiple: true,
|
||||||
enumProvider: commonEnumProviders.variables('all'),
|
enumProvider: commonEnumProviders.numbersAndVariables,
|
||||||
forceEnum: false,
|
forceEnum: false,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
splitUnnamedArgument: true,
|
||||||
helpString: `
|
helpString: `
|
||||||
<div>
|
<div>
|
||||||
Performs a subtraction of the set of values and passes the result down the pipe.
|
Performs a subtraction of the set of values and passes the result down the pipe.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user