Control BackImage using variable value

I want to change the back image of a custom scene depending on the value of the variable. I made the input part here..

Spoiler
JavaScript:
/*
* @param CardBattle BackImages
* @desc set backimage depending on variable
* @type struct<backImage>
* @default {"images":"[]","vnBackImages":"0"}
* @parent dataType
*/

//=============================================================================
/*~struct~backImage:
* @param images
* @desc set image per variable value
* @type file[]
* @default []
* @require 1
* @dir img/pictures
* @parent otherType
*
* @param vnBackImages
* @desc set variable ID control
* @type variable
* @default 0
* @parent database
*/

but when i apply it on the part where the createBackground is.. nothing happens.. here's the code.

Spoiler
JavaScript:
Spriteset_CardBattle.prototype.createBackground = function() {
        this._backgroundSprite = new Sprite();
        var abc  = TMPlugin.Card.SBI.cardbattle;
        var index = abc.vnBackImages ? $gameVariables.value(abc.vnBackImages) - 1 : 0;
        var bgiName = index >= 0 ? abc.images[index] : null;
        this._backgroundSprite.bitmap = bgiName ?
            ImageManager.loadPicture(bgiName) : ImageManager.loadPicture('cardbattle');
        this._baseSprite.addChild(this._backgroundSprite);

    };

I think it is because i don't know how to properly call the parameters? i used a hashkey (i think)

Spoiler
JavaScript:
    TMPlugin.Card.SBI = {
        cardbattle : {images:[],vnBackImages:0},
    };

Thank you.
About the parameters, take a look at this and see if it helps.
Hello. Thank you for the reply. I viewed your link..

i have the parse code too..
JavaScript:
(function() {
    // new line

    var parameters = PluginManager.parameters('TM_Card');

    var paramParse = function(obj) {
        return JSON.parse(JSON.stringify(obj, paramReplace));
    };

    var paramReplace = function(key, value) {
        try {
            return JSON.parse(value || null);
        } catch (e) {
            return value;
        }
    };

    var setBackImages = function(param) {
        param = paramParse(parameters[param]);
        return param instanceof Object ? param : {images:[],vnBackImages:0};
    };

    TMPlugin.Card.SBI = {
        cardbattle : setBackImages('CardBattle BackImages'),
    };
 // new line end

But then it's not being fetched properly.. i still get 'cardbattle' the default value in the bolean as image..
i got this to work. I think the error was the line

Code:
var parameters = PluginManager.parameters('TM_Card');

//switched to
//var parameters = PluginManager.parameters('TMCard');

I also replaced vnBackImages to variableId

so im trying to use the same logic with variable controlled BGM.. i cant find where the event > system settings > change Battle BGM is located.. so i made this code to change the battle bgm

Code:
        var abc  = TMPlugin.SBM.cardmusic;
        var index = abc.variableId ? $gameVariables.value(abc.variableId) - 1 : 0;
        var bgmName = index >= 0 ? abc.name[index] : null;
        var bgm = {"name":bgmName,"pan":abc.pan,"pitch":abc.pitch,"volume":abc.pitch};
        if (bgmName !== null){
        AudioManager.playBgm(bgm);
        } else {
        BattleManager.playBattleBgm();
        }

i get the error Audiomanager not defined.

Original thread: https://forums.rpgmakerweb.com/threads/control-backimage-using-variable-value.119759/