Thread Tools Display Modes
06/10/24, 02:26 AM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
Question looking to getCraftedAbilityScriptId"

I'm working on my junk manager and would like to crate an option to junk known scripts. So far its all written and ready to go except I cant for the life of me determine if a looted script is known.

This function would be ideal :
IsCraftedAbilityScriptUnlocked(*integer* _craftedAbilityScriptId_)

except I can't find a function to "getCraftedAbilityScriptId()" in the API notes.

Any suggestions?
  Reply With Quote
06/10/24, 04:28 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,060
Moved the thread to the correct forum.

Did you check the tutorials forum, current API version thread? I think ZOsDanBatson posted some Infos there.

And Gelmir recently showed a way to get scribing scripts information into a table, so maybe you will find some info in this code block.

Lua Code:
  1. function MapScribables()
  2.     local scribables = {}
  3.     local numCraftedAbilities = GetNumCraftedAbilities();
  4.     for i = 1, numCraftedAbilities do
  5.         scribables[i] = {}
  6.         local craftedAbilityId = GetCraftedAbilityIdAtIndex(i)
  7.         for j = SCRIBING_SLOT_ITERATION_BEGIN, SCRIBING_SLOT_ITERATION_END do
  8.             scribables[i][j] = {}
  9.             local numScripts = GetNumScriptsInSlotForCraftedAbility(craftedAbilityId, j)
  10.             for k = 1, numScripts do
  11.                 local scriptDefId = GetScriptIdAtSlotIndexForCraftedAbility(craftedAbilityId, j, k)
  12.                 table.insert(scribables[i][j], {
  13.                     CraftedAbilityId = craftedAbilityId,
  14.                     CraftedAbilityName = GetCraftedAbilityDisplayName(craftedAbilityId),
  15.                     ScribingSlot = j,
  16.                     ScriptId = scriptDefId,
  17.                     ScriptIndex = k,
  18.                     ScriptName = GetCraftedAbilityScriptDisplayName(scriptDefId),
  19.                     ScriptGeneralDescription = GetCraftedAbilityScriptGeneralDescription(scriptDefId),
  20.                     ScriptDescription = GetCraftedAbilityScriptDescription(craftedAbilityId, scriptDefId),
  21.                     ScriptIcon = GetCraftedAbilityScriptIcon(scriptDefId),
  22.                     ScriptAcquireHint = GetCraftedAbilityScriptAcquireHint(scriptDefId),
  23.                 })
  24.             end
  25.         end
  26.     end
  27.  
  28.     return scribables
  29. end
  Reply With Quote
06/10/24, 06:59 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,060
Also check how other addns do the tarcking of known/unknown scripts, like this one:
https://www.esoui.com/downloads/info...hScribing.html

Please provide proper credit (in your code/addon description) if you spy/use their code
  Reply With Quote
06/10/24, 09:28 AM   #4
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
I went through the current api documentation only.. ill check the other stuff now ty
  Reply With Quote
06/10/24, 09:44 AM   #5
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 184
If GetItemLinkItemUseType returns ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT, then GetItemLinkItemUseReferenceId will return the script id. For example, the tooltip layout code in gamepad:

Code:
function ZO_Tooltip:LayoutCraftedAbilityScriptItem(itemLink, itemName, tradeBoPData)
    local isItemUseTypeCraftedAbilityScript = GetItemLinkItemUseType(itemLink) == ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT
    local craftedAbilityScriptId = isItemUseTypeCraftedAbilityScript and GetItemLinkItemUseReferenceId(itemLink) or 0
    local craftedAbilityScriptData = SCRIBING_DATA_MANAGER:GetCraftedAbilityScriptData(craftedAbilityScriptId)
    local isUnlocked = craftedAbilityScriptData:IsUnlocked()
    ...

Last edited by ZOS_DanBatson : 06/10/24 at 09:48 AM.
  Reply With Quote
06/10/24, 09:59 AM   #6
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
Originally Posted by Baertram View Post
Also check how other addns do the tarcking of known/unknown scripts, like this one:
https://www.esoui.com/downloads/info...hScribing.html

Please provide proper credit (in your code/addon description) if you spy/use their code
I would of course but I'm hoping to find the api function and do my own thing.
  Reply With Quote
06/10/24, 10:03 AM   #7
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
Originally Posted by ZOS_DanBatson View Post
If GetItemLinkItemUseType returns ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT, then GetItemLinkItemUseReferenceId will return the script id. For example, the tooltip layout code in gamepad:

Code:
function ZO_Tooltip:LayoutCraftedAbilityScriptItem(itemLink, itemName, tradeBoPData)
    local isItemUseTypeCraftedAbilityScript = GetItemLinkItemUseType(itemLink) == ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT
    local craftedAbilityScriptId = isItemUseTypeCraftedAbilityScript and GetItemLinkItemUseReferenceId(itemLink) or 0
    local craftedAbilityScriptData = SCRIBING_DATA_MANAGER:GetCraftedAbilityScriptData(craftedAbilityScriptId)
    local isUnlocked = craftedAbilityScriptData:IsUnlocked()
    ...
TY i might be able to work with this..

EDIT... a modified version of this worked perfectly for my needs ty

Last edited by sinnereso : 06/10/24 at 11:02 AM.
  Reply With Quote
06/10/24, 10:17 AM   #8
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
Originally Posted by ZOS_DanBatson View Post
If GetItemLinkItemUseType returns ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT, then GetItemLinkItemUseReferenceId will return the script id. For example, the tooltip layout code in gamepad:

Code:
function ZO_Tooltip:LayoutCraftedAbilityScriptItem(itemLink, itemName, tradeBoPData)
    local isItemUseTypeCraftedAbilityScript = GetItemLinkItemUseType(itemLink) == ITEM_USE_TYPE_CRAFTED_ABILITY_SCRIPT
    local craftedAbilityScriptId = isItemUseTypeCraftedAbilityScript and GetItemLinkItemUseReferenceId(itemLink) or 0
    local craftedAbilityScriptData = SCRIBING_DATA_MANAGER:GetCraftedAbilityScriptData(craftedAbilityScriptId)
    local isUnlocked = craftedAbilityScriptData:IsUnlocked()
    ...
An api function like "GetCraftedAbilityScriptId(itemLink)" or something would make it super easy
  Reply With Quote
06/12/24, 04:44 PM   #9
ZOS_DanBatson
ZOS Staff!
 
ZOS_DanBatson's Avatar
Yes this person is from ZeniMax!
Join Date: Jul 2015
Posts: 184
As a general rule we don't make APIs that do what other APIs can already do. For example, we don't have GetCollectibleNameFromLink and GetCollectibleDescriptionFromLink and IsCollectibleLockedByLink etc, because you can get the collectible id, and from the id you can access dozens of collectible APIs. The alternative would be a maintenance nightmare. In this case there could be dozens of different kinds of ids that could have reference from on use types, and I wouldn't want to have to keep adding more and more APIs every time we add a new onUse type when it does exactly the same thing.
  Reply With Quote
06/13/24, 01:07 PM   #10
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 253
Originally Posted by ZOS_DanBatson View Post
As a general rule we don't make APIs that do what other APIs can already do. For example, we don't have GetCollectibleNameFromLink and GetCollectibleDescriptionFromLink and IsCollectibleLockedByLink etc, because you can get the collectible id, and from the id you can access dozens of collectible APIs. The alternative would be a maintenance nightmare. In this case there could be dozens of different kinds of ids that could have reference from on use types, and I wouldn't want to have to keep adding more and more APIs every time we add a new onUse type when it does exactly the same thing.
Ya that makes sense.. just thought I'd suggest it as there appeared to be no way to aquire the "craftedAbilityScriptId" via functions listed in the API notes at all. Several requires it but none provide it so I thought it may have been missing. I'm not a professional so I'm just fumbling my way through trying to ask these guys for assistance as little as possible =p
  Reply With Quote
06/13/24, 01:21 PM   #11
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,060
A good way (best practice) is, if you found out how to do it, share your code at the Wiki's "Howto" section:


Maybe create a new headline "Scribing" and then a new page for "Get CraftedAbilityScriptId from itemlink"

That helps us all, thank you
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » looking to getCraftedAbilityScriptId"


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