WoW:API GetGuildRosterLastOnline: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API GetGuildRosterLastOnline to WoW:API GetGuildRosterLastOnline without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Usage: yearsOffline, monthsOffline, daysOffline, hoursOffline = GetGuildRosterLastOnline(index);
{{wowapi}} __NOTOC__
Returns a specific guild member's last seen time.
yearsOffline, monthsOffline, daysOffline, hoursOffline = GetGuildRosterLastOnline(index);


[[Category:API Functions|GetGuildRosterLastOnline]]
==Parameters==
[[Category:API Guild Functions|GetGuildRosterLastOnline]]
===Arguments===
:; index : Integer - index of the guild roster entry you wish to query.
===Returns===
:; yearsOffline : Integer - number of years since the member was last online. May return nil.
:; monthsOffline : Integer - number of months since the member was last online. May return nil.
:; daysOffline : Integer - number of days since the member was last online. May return nil.
:; hoursOffline : Integer - number of hours since the member was last online. May return nil.
 
==Example==
local i, tmax, tname, years, months, days, hours, toff = 1, 0, "placeholder";
while (GetGuildRosterInfo(i) ~= nil) do
  years, months, days, hours = GetGuildRosterLastOnline(i);
  years, months, days, hours = years and years or 0, months and months or 0, days and days or 0, hours and hours or 0;
  toff = (((years*12)+months)*30.5+days)*24+hours;
  if (toff > tmax) then
  tname = GetGuildRosterInfo(i);
  tmax = toff;
  end
  i = i + 1;
end
message("Been offline the longest: " .. tname .. " (~" .. tmax .. " hours)");
===Result===
Displays a message with the name of the person in your guild who has been offline the longest. Note that this requires an updated guild list showing offline members (open Social tab, click "Show offline members").

Latest revision as of 04:45, 15 August 2023

WoW API < GetGuildRosterLastOnline

Returns a specific guild member's last seen time.

yearsOffline, monthsOffline, daysOffline, hoursOffline = GetGuildRosterLastOnline(index);

Parameters

Arguments

index
Integer - index of the guild roster entry you wish to query.

Returns

yearsOffline
Integer - number of years since the member was last online. May return nil.
monthsOffline
Integer - number of months since the member was last online. May return nil.
daysOffline
Integer - number of days since the member was last online. May return nil.
hoursOffline
Integer - number of hours since the member was last online. May return nil.

Example

local i, tmax, tname, years, months, days, hours, toff = 1, 0, "placeholder";
while (GetGuildRosterInfo(i) ~= nil) do
 years, months, days, hours = GetGuildRosterLastOnline(i);
 years, months, days, hours = years and years or 0, months and months or 0, days and days or 0, hours and hours or 0;
 toff = (((years*12)+months)*30.5+days)*24+hours;
 if (toff > tmax) then
  tname = GetGuildRosterInfo(i);
  tmax = toff;
 end
 i = i + 1;
end
message("Been offline the longest: " .. tname .. " (~" .. tmax .. " hours)");

Result

Displays a message with the name of the person in your guild who has been offline the longest. Note that this requires an updated guild list showing offline members (open Social tab, click "Show offline members").