ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   guild member inzone, not offline and not ME search (https://www.esoui.com/forums/showthread.php?t=10473)

sinnereso 03/06/23 12:00 PM

guild member inzone, not offline and not ME search
 
Having some issues getting this to make it to the last line without ME being the "memberName". Any suggestions would be appreciated. Its a bit messy with different things ive tried commented out.

Code:

for iG = 1, GetNumGuilds() do
                        local guildId = GetGuildId(iG)
                        local numMembers, numOnline = GetGuildInfo(guildId)
                        --for memberId = 1, numMembers do
                        for memberIndex = 1, GetPlayerGuildMemberIndex(guildId) do
                                --local memberIndex = GetPlayerGuildMemberIndex(guildId)
                                local memberName, _, _, memberStatus = GetGuildMemberInfo(guildId, memberIndex)
                                local _, _, memberZone = GetGuildMemberCharacterInfo(guildId, memberIndex)
                                if memberName ~= GetUnitDisplayName("player") then
                                        if memberZone == GetUnitZone("player") and memberStatus ~= PLAYER_STATUS_OFFLINE then
                                                df("|c6666FF[RidinDirty]|r Traveling to " .. memberName .. " locally")----temp test chat


Baertram 03/06/23 12:09 PM

for memberIndex = 1, GetPlayerGuildMemberIndex(guildId) do
makes no sense as GetPlayerGuildMemberIndex(guildId) will always return your own player's memberIndex in that guild.
So this will always be YOU (ME).
-> "Player" = always YOUR currently logged in character (or account).

If you want to loop the guildIds members and check it's NOT you just use GetPlayerGuildMemberIndex(guildId) once to get your own index and exclude it from the loop then, and for all other entries found do check the zones.


Untested!
Lua Code:
  1. for guildIndex = 1, GetNumGuilds() do
  2.         local guildId = GetGuildId(guildIndex)
  3.         local numMembers, numOnline = GetGuildInfo(guildId)
  4.  
  5.         local myPlayerMemberIndex = GetPlayerGuildMemberIndex(guildId)
  6.  
  7.         for memberIndex = 1, numMembers, 1 do --instead of numMembers you coudl use GetNumGuildMembers(guildId) too, but numMembers is already there so reuse it
  8.             if memberIndex ~= myPlayerMemberIndex then
  9.                 --local memberIndex = GetPlayerGuildMemberIndex(guildId)
  10.                 local memberName, _, _, memberStatus = GetGuildMemberInfo(guildId, memberIndex)
  11.                 local _, _, memberZone = GetGuildMemberCharacterInfo(guildId, memberIndex)
  12.                 if memberName ~= GetUnitDisplayName("player") then
  13.                     if memberZone == GetUnitZone("player") and memberStatus ~= PLAYER_STATUS_OFFLINE then
  14.                         df("|c6666FF[RidinDirty]|r Traveling to " .. memberName .. " locally")----temp test chat
  15.  
  16.                     end
  17.  
  18.                 end
  19.             end
  20.         end
  21.     end

sinnereso 03/06/23 01:08 PM

OMG ty! That did the trick.. I have trouble with the "for this and that do" lines. And ty I didn't realize that line was getting MY index. My source didn't indicate that specifically


All times are GMT -6. The time now is 01:31 PM.

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