MV - How to get what Scene or Window is currently shown

● ARCHIVED · READ-ONLY
Started by DawnStar 4 posts View original ↗
  1. Topic, I need a way to check which windows are being shown on screen, using javascript, ideally with a function that returns a boolean value, or maybe an array with the scene stack, so I can use this on some conditions for a custom HUD. Something like:
    JavaScript:
    // NOT actual code
    isSceneShowing("Scene_Battle")
    isWindowShowing("Window_BattleEnemy")
    I may be wording this incorrectly, but I've been looking in rpg_windows.js and rpg_scenes.js and I can't seem to find any function that does this like in the times of RGSS3.
    Can anyone help?
  2. Code:
    SceneManager._scene
    gives you the current scene, then you can do an instanceof to check if eg. Scene_Battle is running.

    Code:
    const b = SceneManager._scene instanceof Scene_Battle

    When it comes to windows, I know no generic way to get all windows. You can still check if a specific window is there
    Code:
    const b = !!SceneManager._scene._commandWindow
  3. Thank you for the quick and very illustrative answer, this is what I needed!!
  4. you could filter the children of scene to check for instances of window or windowLayer if you *really* need all windows :)