ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   GroupKickByName question (https://www.esoui.com/forums/showthread.php?t=4319)

Kelnoreem 02/20/15 05:26 PM

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?

Weolo 02/20/15 05:52 PM

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

merlight 02/20/15 06:06 PM

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.

Kelnoreem 02/20/15 06:09 PM

Quote:

Originally Posted by Weolo (Post 18937)
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.

Kelnoreem 02/20/15 06:10 PM

Quote:

Originally Posted by merlight (Post 18938)
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.

Sasky 02/21/15 02:33 AM

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.


All times are GMT -6. The time now is 10:21 PM.

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