ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   SubMenu Question (https://www.esoui.com/forums/showthread.php?t=10854)

Shuba00 02/27/24 07:29 AM

SubMenu Question
 
Hello guys, do you know a method to create an item like LAM's submenu, or if is it possible to use directly LAM items in another tab. The problem is, i create a tab in guild section, and in this tab i want to put some info with the submenu items.

Edit: if u know there is a method that can tell me if a player is a GuildMaster?

Baertram 02/27/24 08:06 AM

You can always call the "widget" functions of LAM controls directly in your lua code to e.g. create a LAM dropdown or checkbox somewhere else, not in a LAM panel, afaik, using the function that the widget uses itsself:
Code:

LAMCreateControl
But I'm not sure if this will work for all controls of LAM. You'd have to test this.
I guess it would work though.

At the bottom of each widget lua file you will find the name of the control that is created, e.g. for a slider
Code:

LAMCreateControl.slider(container, data, name)
Similar for a submenu then:
Code:

function LAMCreateControl.submenu(parent, submenuData, controlName)
The function returns the created container of the control then.


Edit:
You need to get the rank of a guildMemberIndex
and then check if the rank got a guildmaster.
IsGuildRankGuildMaster(guildId, guildRank)

Here is an example code, !!!untested!!!
Lua Code:
  1. --returns nilable:String nameofGuildMaster, nilable:number memberIndexOfGuildMaster
  2. local function getGuildMasterData(guildId)
  3.     local isPlayerGuildMaster = IsPlayerGuildMaster(guildId)
  4.     ---Player is not guild master, so search the guild master
  5.     if not isPlayerGuildMaster then
  6.         local numGuildMembers = GetNumGuildMembers(guildId)
  7.         for memberIndex=1, numGuildMembers, 1 do
  8.             --- @return name string, note string, rankIndex luaindex, playerStatus [PlayerStatus|#PlayerStatus], secsSinceLogoff integer
  9. --->Hint: Not sure if name is the character name or the @displayName (account) here, so test this and use accoridngly to your needs
  10.             local name, _, rankIndex = GetGuildMemberInfo(guildId, memberIndex)
  11.             if rankIndex ~= nil then
  12.                 local isGuildMemberRankGuildMaster = IsGuildRankGuildMaster(guildId, rankIndex)
  13.                 if isGuildMemberRankGuildMaster == true then return name, memberIndex end
  14.             end
  15.         end
  16.     else
  17.         --Player is guild master
  18.         local accountName = GetDisplayName()
  19.         local memberIndex = GetGuildMemberIndexFromDisplayName(guildId, accountName)
  20.         if memberIndex ~= nil then
  21.             return accountName, memberIndex
  22.         end
  23.     end
  24.     return nil, nil
  25. end


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

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