Check if in battle

What script call can I put into a conditional branch to check if I'm currently in battle. Googling has given me the answer for other makers but not XP.
please describe a bit more what you want to do - you rarely need to determine that indirectly, because by default, map events are outside battle and troop events are inside battle.
I want an item to have two distinct uses. One when used in battle and another when used outside of battle.
Excuse the Necroposting, but I found this thread looking for a solution to the same problem, so I wanted to help others that get here. "$game_temp.in_battle" seems to do the trick.
(Disclaimer: I have no Idea how Ruby or the internals of XP work, but I've tested this and it seems to work just fine. (I found the variable in Scene_Battle 1 in the script editor. Line 13.))

Original thread: https://forums.rpgmakerweb.com/threads/check-if-in-battle.74860/