View Single Post
02/08/23, 12:03 AM   #1
WetYoda
Join Date: Feb 2021
Posts: 2
Function to determine if an item can be learned

I have a lot of the following types of items that can be learned / used.
  • Design
  • Diagram
  • Formula
  • Pattern
  • Praxis
  • Recipe

I've got a function that will parse through my backpack and destroy any of these items that are of blue (< 4) quality or less because they're generally worth less than 1000g and trivial to me.

What I need is a function to check if these types of items can be learned so that I have a chance to use them before they're destroyed.

ChatGPT suggested the following but it appears to need more training on ESO LUA API's.

Here is an example of a function in Lua that accepts bagId and slotIndex as parameters and returns true if the recipe in that slotIndex is known and false if the recipe is unknown in The Elder Scrolls Online:

Code:
function isRecipeKnown(bagId, slotIndex)
  local recipeKnown = false

  -- Get the itemLink for the recipe in the specified bag and slot
  local itemLink = GetItemLink(bagId, slotIndex)

  -- Check if the recipe is known by checking the item's traits
  local _, _, _, _, _, _, _, itemTraits = GetItemLinkInfo(itemLink)
  for i = 1, #itemTraits do
    if itemTraits[i] == ITEM_TRAIT_TYPE_RECIPE then
      recipeKnown = true
      break
    end
  end
  return recipeKnown
end
Can anyone suggest how to properly do this please so that I can get back to feeding our future AI master?
  Reply With Quote