How to get item id for lantern item?

So I've implemented several different items to serve as light sources: candle, torch, and lantern. Each has a different light radius. Pressing the lantern on/off key specified in the script, I can cycle between all 3 if I have one of each in my inventory.

I'm trying to implement a common event that decrements a counter so the active light source item will burn out after a period of time. So if the torch is active for example, and it burns out, I want to remove it from the player's inventory. Is there some way to get the item or item id for the active light source?
Hmm... at the first glance I can't see a way to get the id without adding to the script, because "carrying_light" only gives you a false or positive. There are several ways, you can add another query like "carrying_light_id" and return the value of @light or you overwrite "give_light" and "drop_light" to store "i" respectively "nil" in a game_variables. Or you could overwrite "carrying_light" to store the value of @light in a game_variables whenever you make the call.

However adding fuel to the light source is a very nice add-on idea, maybe Khas can add it to his TODO when he is finally back.

a quick and dirty store light id in game variables on every update:

Spoiler
class Game_CharacterBase
  def give_light(i)
    drop_light
    create_light(i)
    $game_variables[1] = i
  end
 
  def drop_light
    if @light
      $game_map.lights.delete(self)
      @light.dispose
      @light = nil
      $game_variables[1] = nil
    end
  end
end
You will find the light id  (string) in variable 0001

this is just a quick fix until something better comes up
Thanks! I will give that a try.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-item-id-for-lantern-item.53762/