I had a quick search for documentation about those events, it's hard to find. It seems like they fire "when something happened" the first fires whenever there's an update to the friend list, like when someone changes status, logs in or out, when you open the pannel, etc. The second fires when somebody comes online but doesn't tell you who came on. If I'm wrong about this, I'd like to know. With that in mind you could listen for the BN_FRIEND_TOON_ONLINE event and then iterate over the friends list to see if your friend is on. Just guessing, something like this might work:
Code:
function()
local friend_name = "FRIEND NAME HERE"
for i = 1, BNGetNumFriends() do
local presence_id, first_name, last_name, toon_name, toon_id, client, online, last_online, afk = BNGetFriendInfo(i)
local full_name = first_name .. " " .. last_name
if ((full_name == friend_name) and (online == true) and (FRIEND_WAS_ONLINE == false)) then
FRIEND_WAS_ONLINE = true
return true
end
if ((full_name == friend_name) and (online == false) and (FRIEND_WAS_ONLINE == true)) then
FRIEND_WAS_ONLINE = false
end
end
return false
end
EDIT: Just guessing at something that should work, I haven't tested it, i just looked at the signature for BNGetFriendInfo() and BNGetNumFriends() and bashed something together.