DawnStar

Star of Hope
Veteran
Joined
Nov 25, 2020
Messages
44
Reaction score
56
First Language
Spanish
Primarily Uses
RMMV
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?
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
552
Reaction score
530
First Language
german
Primarily Uses
RMMZ
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
 

DawnStar

Star of Hope
Veteran
Joined
Nov 25, 2020
Messages
44
Reaction score
56
First Language
Spanish
Primarily Uses
RMMV
Thank you for the quick and very illustrative answer, this is what I needed!!
 

Latest Threads

Latest Profile Posts

Theydies and gentlethems, presenting Touch the Stars character #1: Anna Smith and her transformed form, Sagittaria!1624568259771.png
Anyone seen Dsiver around?
I wish character bust packs had options for both side-facing and front-facing for the same characters.
Looks like I'm going to have to cancel another game.
For now it is in testing phase: Changing the game icon from Rm2k/2k3 without needing to edit the executable.
Rm2k-DinChangeIcon.png

Forum statistics

Threads
112,530
Messages
1,068,988
Members
146,216
Latest member
WTCraft2003
Top