Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

API GetNumGuildMembers

Last wiki revision 2022-08-03

Returns the number of total and online guild members. numTotalGuildMembers, numOnlineGuildMembers, numOnlineAndMobileMembers = GetNumGuildMembers

  • numTotalGuildMembers: - Total number of players in the Guild, or 0 if not in a guild.
  • numOnlineGuildMembers: - Number of players currently online in Guild, or 0 if not in a guild.
  • numOnlineAndMobileMembers: - Number of players currently online in Guild (includes players online through the mobile application), or 0 if not in a guild.

local numTotal, numOnline, numOnlineAndMobile = GetNumGuildMembers; DEFAULT_CHAT_FRAME:AddMessage(numTotal .. " guild members: " .. numOnline .. " online, " .. (numTotal - numOnline) .. " offline, " .. (numOnlineAndMobile - numOnline) .. " on mobile.");

Displays the number of people online, offline, on mobile, and the total headcount of your guild in the default chat frame.

You may need to call GuildRoster first in order to obtain correct data. May return wrong values immediately after quitting a guild. Maximum returned value is 500.

There is another problem with the return values as they depend on SetGuildRosterShowOffline setting. A simple program like

DEFAULT_CHAT_FRAME:AddMessage("Firing SetGuildRosterShowOffline(false)"); SetGuildRosterShowOffline(false) DEFAULT_CHAT_FRAME:AddMessage("GetNumGuildMembers: "..tostring(GetNumGuildMembers)); DEFAULT_CHAT_FRAME:AddMessage("Firing SetGuildRosterShowOffline(true)"); SetGuildRosterShowOffline(true) DEFAULT_CHAT_FRAME:AddMessage("GetNumGuildMembers: "..tostring(GetNumGuildMembers));

will show the difference.

Take care, if your function called by event handling wants to set the show offline status via SetGuildRosterShowOffline. This may cause, due to guild roster updates, a loop, where a user that has opened the guild panel can't switch the status anymore, even if you reset the original status in your function.

This is because SetGuildRosterShowOffline fires an event if changed.

Source

https://warcraft.wiki.gg/wiki/API_GetNumGuildMembers · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.