ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   needing to select a recipe in keyboard provisioning recipe list (https://www.esoui.com/forums/showthread.php?t=9253)

IsJustaGhost 07/04/20 10:57 PM

needing to select a recipe in keyboard provisioning recipe list
 
I'm needing to select a specific recipe in the keyboard's provisioning recipe list.
I've managed to do it for gamepad mode with,
Code:

GAMEPAD_PROVISIONER.recipeList:SetSelectedIndex(recipeData.listIndex)
The intent is to select the entry so correct recipe information is displayed, including ingredients, for the provisioning crafting of my writ helper.
Any help would be appreciated.

Baertram 07/05/20 06:59 AM

Normally the variables are equal and just have a KEYBOARD (or no prefix at all) or GAMEPAD as prefix. Try just PROVISIONER or check the esoui code at github (link is at the wiki e.g.) at esoui/ingame/provisioner or similar.
The variable is either defined in the xml file or at the bottom of some lua file in the keyboard files, like PROVISIONER = Zo_Provisioner:New(...)

https://github.com/esoui/esoui/blob/...rovisioner.lua
Line 629

IsJustaGhost 07/06/20 03:27 AM

I ended up going a different route for the reasons of,
- could not figure out how to make it change to the Drinks tab for gamepad mode.
- could not figure out how to manipulate the tree nodes to have it select the recipe in keyboard mode.

It now sets the results tooltip and ingredients directly.

Baertram 07/06/20 04:14 AM

Changing the tab buttons is done via applying the "descriptor" (structure containing all relevant data of the tab button) to the ZO_MenuBar tab.
There exists a function which does this and then changes the tab for you, let me search it.

https://github.com/esoui/esoui/blob/...zo_menubar.lua

Get descriptor for a tab button:
ZO_MenuBar_GetSelectedDescriptor(buttonControl)

Set descriptor to change to a tab button:
ZO_MenuBar_SelectDescriptor(self, descriptor, skipAnimation, reselectIfSelected)


Here it is used in the provisioner part:
https://github.com/esoui/esoui/blob/...ioner.lua#L160

So it should be something like this:
Lua Code:
  1. ZO_MenuBar_SelectDescriptor(PROVISIONER.tabs, PROVISIONER.tabs[1].descriptor)
Where tabs[1] will be the first button and tabs[2] the second.
If you know the exact descriptor name you can even use this instead.

They are defined here in the provsioner crafting:
https://github.com/esoui/esoui/blob/...ioner.lua#L123

So it's a filtertype for the buttons.
And these are defined at this line and below:
https://github.com/esoui/esoui/blob/...ioner.lua#L133

So it's one of these:
Code:

PROVISIONER_SPECIAL_INGREDIENT_TYPE_SPICES
PROVISIONER_SPECIAL_INGREDIENT_TYPE_FLAVORING
PROVISIONER_SPECIAL_INGREDIENT_TYPE_FURNISHING

So just use these as the "descriptor" directly e.g.
Lua Code:
  1. ZO_MenuBar_SelectDescriptor(PROVISIONER.tabs, PROVISIONER_SPECIAL_INGREDIENT_TYPE_FURNISHING)

IsJustaGhost 07/07/20 07:30 AM

Thank you for this info, I will look into it

IsJustaGhost 08/24/21 07:48 AM

I ended up figuring this out.

Lua Code:
  1. local function GetNodeByData(recipeData)
  2.     for _, listNode in pairs(PROVISIONER.recipeTree.rootNode.children) do
  3.         if listNode.data.recipeListIndex == recipeData.recipeListIndex then
  4.             for _, node in pairs(listNode.children) do
  5.                 if node.data.recipeIndex == recipeData.recipeIndex then
  6.                     return node
  7.                 end
  8.             end
  9.         end
  10.     end
  11. end
  12.  
  13. local node = GetNodeByData({recipeListIndex = 1, recipeIndex = 5})
  14. node:GetTree():SelectNode(node)


All times are GMT -6. The time now is 04:20 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI