Wolfpack49 Posted October 12, 2020 Author Share Posted October 12, 2020 Welp, managed to solve it -- easiest thing is to just bust the hotkey eating out into its own function and jump out of the item removed loop: Function handle_removed_item(Form item, int count, \ ObjectReference ref, ObjectReference dst) if !is_enabled || is_looting || is_trading || UI.isMenuOpen("Console") \ || removing_item ;; OnItemRemoved will be strangely triggered twice return endif removing_item = True int type = item.getType() _debug("Item removed - " + item.getName() + " (" + type + ")") if is_crafting && mods.handle_removed_item(item) removing_item = False return endifif type == 46 ;; food int food_eaten_now = Game.queryStat("Food Eaten") Bool isInventoryMenuOpen = UI.IsMenuOpen("InventoryMenu") if food_eaten_now > food_eaten && isInventoryMenuOpen _debug("Food eaten from inventory") eating_time_to_pass += eating_minute / 60 food_eaten = food_eaten_now elseif food_eaten_now > food_eaten && !isInventoryMenuOpen food_eaten = food_eaten_now hotkey_eating() endif elseif type == 27 ;; book int spell_learned_now = Game.queryStat("Spells Learned") if spell_learned_now > spell_learned _debug("Spell learned") pass_time(spell_learning_hour) spell_learned = spell_learned_now endif endif removing_item = FalseEndFunction Function hotkey_eating()_debug("Food eaten via hotkey") eating_time_to_pass = eating_minute / 60pass_time(eating_time_to_pass)eating_time_to_pass = 0.0EndFunction This way, I can still do the generic absence of the inventory menu check but still get the action of the hotkey without actually listening for a specific hotkey. It works! Plus, I got to create a function called hotkey_eating. What more could you want? :smile: Link to comment Share on other sites More sharing options...
Wolfpack49 Posted October 13, 2020 Author Share Posted October 13, 2020 Thanks again to Ishara and cumbrianlad for your help -- you got me pointed in the right direction. :) Link to comment Share on other sites More sharing options...
Recommended Posts