Problem Else Situation

Hello,
I am coding, but I want a code that if in the config spooky-avatar-chooser is off that the music will change to

I highlight the codes I mean
Code:
class AvatarChooser(DirectObject, StateData):

def __init__(self, parentFSM, doneEvent):
    StateData.__init__(self, doneEvent)
    self.choice = 0
    self.gameOptions = None
    self.av = None
    self.deleteConfirmDialog = None
    self.notifications = { }
    self.frame = None
    self.avFrame = None
    self.avButtons = []
    self.handleDialogOnScreen = 0
    self.lastMousePos = (0, 0)
    self.finalizeConfirmDialog = None
    self.deniedConfirmDialog = None
    base.loadingScreen.tick(tickNumber = 150)

def enter(self):
    taskMgr.setupTaskChain('phasePost', threadPriority = TPHigh)
    if self.isLoaded == 0:
        self.load()

    base.disableMouse()
    self.quitButton.show()
    self.scene.reparentTo(render)
    camera.reparentTo(render)
    camera.setPosHpr(-29.0187, 37.0125, 24.75, 4.09, 1.0, 0.0)
    if self.ship:
        taskMgr.add(self.__shipRockTask, 'avatarChooserShipRockTask')

    base.transitions.fadeScreen(1)
    base.transitions.fadeIn(3)
    base.graphicsEngine.renderFrame()
    base.graphicsEngine.renderFrame()
    base.cr.loadingScreen.hide()
    globalClock.tick()
    base.graphicsEngine.renderFrame()
    base.playSfx(self.oceanSfx, looping = 1, volume = 0.60)
    base.musicMgr.request(SoundGlobals.MUSIC_AVATAR_CHOOSER, volume = 0.4, priority = -2)
    self.accept('mouse1', self._startMouseReadTask)
    self.accept('mouse1-up', self._stopMouseReadTask)
    self.accept('mouse3', self._startMouseReadTask)
    self.accept('mouse3-up', self._stopMouseReadTask)
    self.accept('updatedDeletedAvList', self.__updatedDeletedAvs)
    if not self.disableOptions:
        self.accept('f7', self.__handleOptions)

    self.__allPhasesComplete()

def exit(self):
    if self.isLoaded == 0:
        return

    base.musicMgr.requestFadeOut(SoundGlobals.MUSIC_AVATAR_CHOOSER)
    self.oceanSfx.stop()
    if self.deleteConfirmDialog:
        self.deleteConfirmDialog.destroy()
        self.deleteConfirmDialog = None

    self.avatarListFrame.hide()
    self.highlightFrame.hide()
    self.quitFrame.hide()
    self.renameButton.hide()
    self.scene.detachNode()
    if self.ship:
        taskMgr.remove('avatarChooserShipRockTask')

    self.ignore('mouse1')
    self.ignore('mouse1-up')
    self.ignore('mouse3')
    self.ignore('mouse3-up')
    self.ignore('f7')
    self.ignore('updatedDeletedAvList')
    self._stopMouseReadTask()
    self.ignoreAll()
    if hasattr(self, 'fadeInterval'):
        self.fadeInterval.pause()
        del self.fadeInterval

    if hasattr(self, 'fadeFrame'):
        self.fadeFrame.destroy()

    taskMgr.setupTaskChain('phasePost', threadPriority = TPLow)

def load(self):
    if self.isLoaded == 1:
        return

    self.disableOptions = config.GetBool('disable-pirates-options', False)
    base.musicMgr.load(SoundGlobals.MUSIC_AVATAR_CHOOSER)
    self.model = loader.loadModel('models/gui/avatar_chooser_rope')
    charGui = loader.loadModel('models/gui/char_gui')
    self.oceanSfx = SoundGlobals.loadSfx(SoundGlobals.SFX_FX_OCEAN_LOOP)
    self.exclam = charGui.find('**/chargui_exclamation_mark')
    self.scene = NodePath('AvatarChooserScene')
    self.todManager = TimeOfDayManager.TimeOfDayManager()
    self.todManager.request('EnvironmentTOD')
    
    if config.GetBool('want-spooky-avatarchooser', False):
        self.todManager.switchJollyMoon(True)
        self.todManager.setEnvironment(TODGlobals.ENV_CURSED_NIGHT, { })
    else:
        self.todManager.setEnvironment(TODGlobals.ENV_DEFAULT, {})

    self.todManager.doEndTimeOfDay()
    self.todManager.skyGroup.setSunTrueAngle(Vec3(260, 0, 15))
    self.todManager.skyGroup.setSunLock(1)
    self.todManager.skyGroup.dirLightSun.node().setColor(Vec4(0.9, 0.7, 0.8, 1))

    pier = loader.loadModel('models/islands/pier_port_royal_2deck')
    pier.setPosHpr(-222.23, 360.08, 15.06, 251.57, 0.0, 0.0)
    pier.flattenStrong()
    pier.reparentTo(self.scene)
    pier2 = loader.loadModel('models/islands/pier_port_royal_1deck')
    pier2.setPosHpr(-35.0, 83.27, 19.26, 274.09, 0.0, 0.0)
    pier2.setScale(0.4, 0.3, 0.4)
    pier2.flattenStrong()
    pier2.reparentTo(self.scene)
    self.water = SeaPatch(render, Reflection.getGlobalReflection(), todMgr = None)
    self.water.updateWater(2)
    self.water.enable()
    self.ship = None
    from pirates.ship import ShipGlobals
    
    if config.GetInt('custom-avatarchooser-ship', 0) > 0:
        self.ship = base.shipFactory.getShip(config.GetInt('custom-avatarchooser-ship', 0))
    elif config.GetBool('want-spooky-avatarchooser', False):
        self.ship = base.shipFactory.getShip(ShipGlobals.P_SKEL_PHANTOM)
        self.ship.playStormEffect()
    else:
        self.ship = base.shipFactory.getShip(ShipGlobals.INTERCEPTORL1)

    self.ship.modelRoot.setPosHpr(140.86, 538.97, -3.62, -133.04, 0.0, 0.0)
    self.ship.modelRoot.reparentTo(self.scene)
    self.shipRoot = self.ship.modelRoot
    self.ship.playIdle()
    lodNode = self.ship.lod.node()
    self.ship.lod.node().forceSwitch(0)

So can someone give me the right way of coding, so the music: MUSIC_AVATAR_CHOOSER will be in the else section: MUSIC_AVATAR_CHOOSER_ALT.

I hope anyone know how…

PS: Ye cannot test the script, so give yer ideas

First of all, when posting code, please use code-tags–it preserves the indentation, making the code that much easier to read, and also puts the code into a scrollable box, allowing people to scroll to the next post more easily. The tags can be added via the button labelled “Code” above the main text-box when writing or editing a post, or by manually typing the tags, like so:

[code]
 //Some code here 
[/code]

As to your problem, perhaps store the ID of the currently-selected music in a variable, set when you check the config-variable, and replacing the specific references currently being passed to the music manager.