ESOUI

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

sinnereso 10/23/23 11:05 AM

GetTargetMountedStateInfo() issues
 
Ive had this function as part of my addon for nearly 9mo now with no issues but recently I began reworking the function to not just mount my "saved player @NAME" but anyoone in group that is riding a dual mount and has free pasenger slot. This is when I noticed this function is now returning true & true for GetTargetMountedStateInfo() even when noone is on a mount at all:

Code:

for iD = 1, GetGroupSize() do
                local playerID = GetGroupUnitTagByIndex(iD)
                local playerCharName = GetUnitName(playerID)
                local playerDisplayName = GetUnitDisplayName(playerID)
                local _, isRidingGroupMount, hasFreePassengerSlot = GetTargetMountedStateInfo(playerDisplayName)

I tested this extensively 9mo ago when I 1st implemented it but now I cant seem to get it to return false ever which is needed. Any suggestions?

Masteroshi430 10/23/23 11:29 AM

Firstly be aware that function doesn't return the correct data when you are too far from the group member.
Secondly it still works properly in minimap by Fyrakin.

Try to verify what GetGroupUnitTagByIndex outputs because it does weird things sometimes. :)

EDIT:
Sorry I read too fast, I'm only using the 1st value returned and it works correctly, I don't know for value 2 and 3
GetTargetMountedStateInfo(*string* _characterOrDisplayName_)
** _Returns:_ *[MountedState|#MountedState]* _mountedState_, *bool* _isRidingGroupMount_, *bool* _hasFreePassengerSlot_

sinnereso 10/23/23 11:50 AM

Quote:

Originally Posted by Masteroshi430 (Post 48641)
Firstly be aware that function doesn't return the correct data when you are too far from the group member.
Secondly it still works properly in minimap by Fyrakin.

Try to verify what GetGroupUnitTagByIndex outputs because it does weird things sometimes. :)

EDIT:
Sorry I read too fast, I'm only using the 1st value returned and it works correctly, I don't know for value 2 and 3
GetTargetMountedStateInfo(*string* _characterOrDisplayName_)
** _Returns:_ *[MountedState|#MountedState]* _mountedState_, *bool* _isRidingGroupMount_, *bool* _hasFreePassengerSlot_

It used to work perfectly. Ive had my addon setup to handle "saved" player" not being mounted on dual mount and with a passenger already using this function even when out of range but now its returning true for every single group member in testing when noone is mounted at all, inrange and not inrange.

Baertram 10/23/23 11:52 AM

Moved the thread as this is a question about a lua API function (even if referenced to an already released addon the forum "Released addons" is for "Addon-specific support threads created by their authors").

Edit:
Did you check via d() messages if the playerID of the unit and the displayNames are the correct/expected ones?
Maybe it always passes in the same id/account, or some nil value and thus returns true

sinnereso 10/23/23 12:04 PM

Quote:

Originally Posted by Baertram (Post 48643)
Moved the thread as this is a question about a lua API function (even if referenced to an already released addon the forum "Released addons" is for "Addon-specific support threads created by their authors").

Edit:
Did you check via d() messages if the playerID of the unit and the displayNames are the correct/expected ones?
Maybe it always passes in the same id/account, or some nil value and thus returns true


just tested:

Code:

for iD = 1, GetGroupSize() do
                local playerID = GetGroupUnitTagByIndex(iD)
                local playerCharName = GetUnitName(playerID)
                local playerDisplayName = GetUnitDisplayName(playerID)
                local _, isRidingGroupMount, hasFreePassengerSlot = GetTargetMountedStateInfo(playerDisplayName)
                df(RidinDirty.logo .. " " .. tostring(playerDisplayName) .. " - " .. tostring(playerCharName) ..  " - " .. tostring(playerID) .. " - " .. tostring(isRidingGroupMount) .. " - " .. tostring(hasFreePassengerSlot))--TEST

and its outputting:
Code:

@NAME - charname - group1 - true - true
@NAME - charname - group2 - true - true
@NAME - charname - group3 - true - true

when were all standing near eachother unmounted. Everything is correct including @names and charnames except the true - true which should be false - false

sinnereso 10/23/23 12:12 PM

Quote:

Originally Posted by Baertram (Post 48643)
Moved the thread as this is a question about a lua API function (even if referenced to an already released addon the forum "Released addons" is for "Addon-specific support threads created by their authors").

Edit:
Did you check via d() messages if the playerID of the unit and the displayNames are the correct/expected ones?
Maybe it always passes in the same id/account, or some nil value and thus returns true

OK just found the issue with the function... its returning TRUE TRUE for anyone in the group that has enabled a dual mount in there collections ONLY.. even while not even mounted it returns true true if they have one enabled to be used.. if they change theyre mount to a standard mount it returns false false. this is all while noone has even got on any mounts, just changing the mount you wish to use in your collections triggers it true or false.

This likly showed up maybe when the new mount favourites feature was added as it did work properly this spring. I know this because it was my very 1st feature and the very original purpose of RidinDirty.

Baertram 10/23/23 01:17 PM

Maybe you need to combine the 1st return param with the others then.
If 1st MountedState is unmounted -> ignore 2nd and 3rd param!

And if 1st param says "mounted" then only consider the snd and 3rd param

sinnereso 10/24/23 01:53 AM

Quote:

Originally Posted by Baertram (Post 48646)
Maybe you need to combine the 1st return param with the others then.
If 1st MountedState is unmounted -> ignore 2nd and 3rd param!

And if 1st param says "mounted" then only consider the snd and 3rd param

well that may help but if your standing around near a wayshrine are you isRidingGroupMount and do you hasFreePassengerSlot? theyre clearly not currently working as intended anymore imo. They used to because I had chat output handlers for these scenarios that no longer function as intended.

Baertram 10/24/23 08:05 AM

Okay, if it's a bug you could describe it here with simple example and expected result, and question ZOs if this is known and needs a fix:
https://www.esoui.com/forums/forumdisplay.php?f=187


All times are GMT -6. The time now is 03:32 PM.

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