Selecting which variable is modifed based on the value of another variable?

I'll try explain it as best as I can but please let me know if I need to be more clear

I have 2 variables: I.D 100 and I.D 6.

I have an event that modifies the value of a variable. The variable thats value I want modify would be the variable with I.D 100 + whatever the current value of I.D 6 is.

For example: if the variable with the I.D of 6 currently has a value of 4, then I would want the game to modify the value of the variable with I.D 104, since 100 plus 4 is 104.

Whats the best way to go about this without using a bunch of "else if" statements?
use a scriptcall:

$gameVariables.setValue(100, $gameVariables.value(100) + $gameVariables.value(6))

this should do what you want.
So, something like this?
JavaScript:
const varId = 100 + $gameVariables.value(6);
const value = 12345;
$gameVariables.setValue(varId, value);
Edit : My bad didn't read it through. ^^

@caethyril 's option should do the trick, but you got to be careful though that the variable ID exists, or it might cause an error
@Artille - the default setValue method checks to see if the variable ID is in range before proceeding, so I think that should be OK (rmmz_objects.js):
JavaScript:
Game_Variables.prototype.setValue = function(variableId, value) {
    if (variableId > 0 && variableId < $dataSystem.variables.length) {

Original thread: https://forums.rpgmakerweb.com/threads/selecting-which-variable-is-modifed-based-on-the-value-of-another-variable.183009/