Call to check if player is in menu

masterlobo

Veteran
Veteran
Joined
Mar 14, 2012
Messages
187
Reaction score
131
Primarily Uses
Hello!

Is there a way to script check in a conditional branch whether the player is in menu?

I know that you can check if player is in battle with:

Code:
$gameParty.inBattle()
Is there something similar but to check if the player is using the menu?

Context: I have an item that calls a Common Event, and I need it to behave differently in map, in battle, and when used from the item menu outside of battle.
 

dsiver144

Peaceful Days Dev
Veteran
Joined
Sep 19, 2013
Messages
263
Reaction score
826
First Language
Vietnamese
Primarily Uses
RMVXA
HTML:
SceneManager._scene === Scene_Item
I don't know much about Js but I think this should work.

Edit: I think when player uses an Item in Item Menu, the scene will change to Scene_Map then execute the common event.
So to check previous scene is Scene_Item, you can use this script call:
HTML:
SceneManager.isPreviousScene(Scene_Item)
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,959
First Language
English
Primarily Uses
RMMV
That should work, yeah.
 

masterlobo

Veteran
Veteran
Joined
Mar 14, 2012
Messages
187
Reaction score
131
Primarily Uses
HTML:
SceneManager._scene === Scene_Item
I don't know much about Js but I think this should work.

Edit: I think when player uses an Item in Item Menu, the scene will change to Scene_Map then execute the common event.
So to check previous scene is Scene_Item, you can use this script call:
HTML:
SceneManager.isPreviousScene(Scene_Item)
This did the job.

Thanks a lot! :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top