Thread Tools Display Modes
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
02/08/23, 08:34 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,966
Use a library like LibCharacterKnowledge to see if any of your characters needs to learn that item.
It provides API functions for that described at the library's description/docu/developer reference (http://eso.code65536.com/addons/libcharacterknowledge/ -> Determine whether a character knows an item.


https://www.esoui.com/downloads/info...Knowledge.html
  Reply With Quote
02/08/23, 09:43 AM   #3
WetYoda
Join Date: Feb 2021
Posts: 2
Cool

Originally Posted by Baertram View Post
Use a library like LibCharacterKnowledge to see if any of your characters needs to learn that item.
It provides API functions for that described at the library's description/docu/developer reference (http://eso.code65536.com/addons/libcharacterknowledge/ -> Determine whether a character knows an item.


https://www.esoui.com/downloads/info...Knowledge.html
Thanks!

  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Function to determine if an item can be learned


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off