Thread Tools Display Modes
02/20/15, 05:26 PM   #1
Kelnoreem
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 11
GroupKickByName question

I added and tested my use of GroupInviteByName(name), had no issues.

When I added GroupKickByName(name), the function was called, but the name was not kicked.

This is what I am using, the Kicking debug was shown.
SLASH_COMMANDS["/tntinv"] = function(name)
GroupInviteByName(name)
end
SLASH_COMMANDS["/tntkick"] = function(name)
d("|cFF0000Kicking " .. name)
GroupKickByName(name)
end

The party window does not display the @name, which is what I think it wants. Am I doing the kick wrong?
  Reply With Quote
02/20/15, 05:52 PM   #2
Weolo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 79
If I was to guess GroupKickByName(name) uses a different format of name than GroupInviteByName(name) does. A "rawName".

It looks like IsPlayerInGroup(rawName) may also use the same format. Try experimenting with the rawName being the characters name and then the account name. I bet only one of those works for both IsPlayerInGroup and GroupKickByName.

Just found this which may help
Lua Code:
  1. GetRawUnitName(string UnitTag)
  2. Returns: string rawName
Under http://wiki.esoui.com/API#Unit

Last edited by Weolo : 02/20/15 at 05:58 PM. Reason: Found a useful API function
  Reply With Quote
02/20/15, 06:06 PM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
It seems kick by name expects raw character name, with gender markup. If that's true, you might have to look the "pretty" name up yourself:
Lua Code:
  1. SLASH_COMMANDS["/tntkick"] = function(name)
  2.     local lcname = zo_strlower(zo_strtrim(name))
  3.     for i = 1, GetGroupSize() do
  4.         local unitTag = GetGroupUnitTagByIndex(i)
  5.         if unitTag and not IsUnitGroupLeader(unitTag) then
  6.             --local rawCharacterName = GetRawUnitName(unitTag)
  7.             local characterName = GetUnitName(unitTag)
  8.             if lcname == zo_strlower(characterName) then
  9.                 GroupKick(unitTag)
  10.                 break
  11.             end
  12.         end
  13.     end
  14. end

Btw there's builtin /invite that does the same thing as yours. But no /kick counterpart.

Last edited by merlight : 02/20/15 at 06:08 PM.
  Reply With Quote
02/20/15, 06:09 PM   #4
Kelnoreem
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 11
Originally Posted by Weolo View Post
If I was to guess GroupKickByName(name) uses a different format of name than GroupInviteByName(name) does. A "rawName".

It looks like IsPlayerInGroup(rawName) may also use the same format. Try experimenting with the rawName being the characters name and then the account name. I bet only one of those works for both IsPlayerInGroup and GroupKickByName.

Just found this which may help
Lua Code:
  1. GetRawUnitName(string UnitTag)
  2. Returns: string rawName
Under http://wiki.esoui.com/API#Unit
Yes, this was my guess too, I tried the @Name, and the player name. This got interesting because the only player name I had as a test was two words with a space in the middle. I could not get it to work. Back tracking from this test, I noticed the player window does not use the @name, so I started wondering if it was the player name. Too much wondering, I decided to ask for help.

I'll try your ideas, thanks.
  Reply With Quote
02/20/15, 06:10 PM   #5
Kelnoreem
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 11
Originally Posted by merlight View Post
It seems kick by name expects raw character name, with gender markup. If that's true, you might have to look the "pretty" name up yourself:
Lua Code:
  1. SLASH_COMMANDS["/tntkick"] = function(name)
  2.     local lcname = zo_strlower(zo_strtrim(name))
  3.     for i = 1, GetGroupSize() do
  4.         local unitTag = GetGroupUnitTagByIndex(i)
  5.         if unitTag and not IsUnitGroupLeader(unitTag) then
  6.             --local rawCharacterName = GetRawUnitName(unitTag)
  7.             local characterName = GetUnitName(unitTag)
  8.             if lcname == zo_strlower(characterName) then
  9.                 GroupKick(unitTag)
  10.                 break
  11.             end
  12.         end
  13.     end
  14. end

Btw there's builtin /invite that does the same thing as yours. But no /kick counterpart.
This looks interesting, I will try it. There is so much to learn, so I appreciate the help.
  Reply With Quote
02/21/15, 02:33 AM   #6
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
When I looked into this for adding the kick feature for AutoInvite, I just gave up and wrote my own:
Lua Code:
  1. --Since KickByName doesn't seem to be working
  2. function AutoInvite.kickByName(name)
  3.     --...
  4.     for i=1,GetGroupSize() do
  5.         local tag = GetGroupUnitTagByIndex(i)
  6.         if GetUnitName(tag) == name then
  7.             GroupKick(tag)
  8.             return
  9.         end
  10.     end
  11.     --...
  12. end

So if you get stuck with merlight's suggestion feel free to use something like that.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » GroupKickByName question


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off