Thread Tools Display Modes
02/08/23, 02:39 PM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Question easy 1line port to your own primary house?

Hey im looking for a simple 1 liner if possible to port to my own primary house outside if possible..

something like:

local playerId = GetDisplayName()
JumpToHouse(playerId)

one that actually works... I cant for the life of me get any of these functions todo it.

everything i try reports back either "cannot port to yourself" or "character not found".

Last edited by sinnereso : 02/08/23 at 02:48 PM. Reason: spelling
  Reply With Quote
02/08/23, 02:59 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,963
RequestJumpToHouse(GetHousingPrimaryHouse(), false)

true if jump inside

Can be found by inspecting the button at your collections where you can show the menu to jump in/outisde your house e.g. move the mouse above and use /zgoo mouse or merTorchbug /tbm to show the name of the control.
ZO_HousingBook_KeyboardContentsHousingInteractButtonsTravelToHouse
Then search the end of the name "TravelToHouse" in the ESOUI sources and you'll find the ShowMenu (shows the context menu) call in function HousingBook_Keyboard:RequestJumpToCurrentHouse():


Lua Code:
  1. function HousingBook_Keyboard:RequestJumpToCurrentHouse()
  2.     local collectibleData = self.navigationTree:GetSelectedData()
  3.     if collectibleData then
  4.         local houseId = collectibleData:GetReferenceId()
  5.         if collectibleData:IsLocked() then
  6.             -- Preview, behavior will always be inside
  7.             RequestJumpToHouse(houseId)
  8.             SCENE_MANAGER:ShowBaseScene()
  9.         else
  10.             ClearMenu()
  11.  
  12.             AddMenuItem(GetString(SI_HOUSING_BOOK_ACTION_TRAVEL_TO_HOUSE_INSIDE), function()
  13.                 local TRAVEL_INSIDE = false
  14.                 RequestJumpToHouse(houseId, TRAVEL_INSIDE)
  15.                 SCENE_MANAGER:ShowBaseScene()
  16.             end)
  17.             AddMenuItem(GetString(SI_HOUSING_BOOK_ACTION_TRAVEL_TO_HOUSE_OUTSIDE), function()
  18.                 local TRAVEL_OUTSIDE = true
  19.                 RequestJumpToHouse(houseId, TRAVEL_OUTSIDE)
  20.                 SCENE_MANAGER:ShowBaseScene()
  21.             end)
  22.  
  23.             ShowMenu(self.travelToHouseButton)
  24.         end
  25.     end
  26. end
  Reply With Quote
02/08/23, 03:01 PM   #3
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
omg thank you soo much!
  Reply With Quote
02/09/23, 07:34 AM   #4
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by Baertram View Post
RequestJumpToHouse(GetHousingPrimaryHouse(), false)

true if jump inside

Can be found by inspecting the button at your collections where you can show the menu to jump in/outisde your house e.g. move the mouse above and use /zgoo mouse or merTorchbug /tbm to show the name of the control.
ZO_HousingBook_KeyboardContentsHousingInteractButtonsTravelToHouse
Then search the end of the name "TravelToHouse" in the ESOUI sources and you'll find the ShowMenu (shows the context menu) call in function HousingBook_Keyboard:RequestJumpToCurrentHouse():


Lua Code:
  1. function HousingBook_Keyboard:RequestJumpToCurrentHouse()
  2.     local collectibleData = self.navigationTree:GetSelectedData()
  3.     if collectibleData then
  4.         local houseId = collectibleData:GetReferenceId()
  5.         if collectibleData:IsLocked() then
  6.             -- Preview, behavior will always be inside
  7.             RequestJumpToHouse(houseId)
  8.             SCENE_MANAGER:ShowBaseScene()
  9.         else
  10.             ClearMenu()
  11.  
  12.             AddMenuItem(GetString(SI_HOUSING_BOOK_ACTION_TRAVEL_TO_HOUSE_INSIDE), function()
  13.                 local TRAVEL_INSIDE = false
  14.                 RequestJumpToHouse(houseId, TRAVEL_INSIDE)
  15.                 SCENE_MANAGER:ShowBaseScene()
  16.             end)
  17.             AddMenuItem(GetString(SI_HOUSING_BOOK_ACTION_TRAVEL_TO_HOUSE_OUTSIDE), function()
  18.                 local TRAVEL_OUTSIDE = true
  19.                 RequestJumpToHouse(houseId, TRAVEL_OUTSIDE)
  20.                 SCENE_MANAGER:ShowBaseScene()
  21.             end)
  22.  
  23.             ShowMenu(self.travelToHouseButton)
  24.         end
  25.     end
  26. end
I didnt even realize it untill late last night about 2hrs before servers went down for maint but "false" is putting me inside instead of outside. but at the same time if IsUnitOnline(savedPlayer) == "isOnline" suddenly started passing the check even when player was offline. seemed like game running backwards last night or is the "false" for RequestJumpToHouse(GetHousingPrimaryHouse(), false) incorrect for outside?
  Reply With Quote
02/09/23, 10:53 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,963
I've copied you the code of the base game above showing you the function call, and even named you the function:
HousingBook_Keyboard:RequestJumpToCurrentHouse(

In the example code you can see:

local TRAVEL_INSIDE = false
RequestJumpToHouse(houseId, TRAVEL_INSIDE)

local TRAVEL_OUTSIDE = true
RequestJumpToHouse(houseId, TRAVEL_OUTSIDE)


This should be very obvious wha the API function RequestJumpToHouse uses for inside and outside then :-)

What was wrong was my text "true if jump inside", but I always assume you guys tests stuff before actually releasing it.
  Reply With Quote
02/09/23, 02:54 PM   #6
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
haha ya i did test it but was testing other things at the same time and didnt. "clue in" that it was going inside till later.

I am however still having issues with some of the isunitonline and ingroup etc... its messy cuz ive been trying everything to get them passing and not passing when they should but heres a sample of what im trying todo. it shold not continue if im incombat or the target player isnt online or isnt in group and should execute the basic jumpto only giving the error in the top right corner which im happy with.

Code:
-- Travel to player
function RidinDirty.TravelToPlayer()
	local savedPlayer = RidinDirty.savedVariables.savedPlayer
	local effectId = RidinDirty.savedVariables.effectId
	local effectDelay = RidinDirty.savedVariables.effectDelay
	if savedPlayer  == nil or savedPlayer  == "" then return end
	if not IsUnitInCombat(player) then
		if IsUnitOnline(savedPlayer) then 
			if IsPlayerInGroup(savedPlayer) then
				if IsCollectibleUnlocked(effectId) and IsCollectibleUsable(effectId) and GetCollectibleCooldownAndDuration(effectId) == 0 then
					UseCollectible(effectId)
					zo_callLater(function() JumpToGroupMember(savedPlayer) end, effectDelay)
					if effectId == 347 then
						df("|c9900FF[RidinDirty]|r There's a blood mist forming near %s", savedPlayer)
					end
				else
					JumpToGroupMember(savedPlayer)
				end
			else
				JumpToGroupMember(savedPlayer)
			end
		else
			JumpToGroupMember(savedPlayer)
		end
	else
		JumpToGroupMember(savedPlayer)
	end
end
  Reply With Quote
02/09/23, 03:05 PM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,963
You always should read the API documentation txt file for the parameters and parameter TYPES used! unitTags are not the same as character names or displaynames!

Afaik IsUnitInCombat(unitTag) only accepts unittags like "player" (yourself), "group1" to "groupN", "boss1" to "bossN" or "reticleover" and not any charactername or displayname!
So you cannot test IsUnitInCombat for any name on the server, only for yourself or grouped players.
There exist API group functions to check what name the group1, group2 etc. tags have but I'm not sure anymore, you need to search the API documentation txt file for them

I think it was a loop over group members by
Code:
for i=1, GetGroupSize() do
  local unitTag = GetGroupUnitTag(i)
end
or something similar.
  Reply With Quote
02/09/23, 03:20 PM   #8
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
sweet ty... i was missing the quotes in the unitag ones.. theyre working now but your correct the isunitonline wont work for other players ill have to find a workaround cuz its semi important as well.. dont want the code firing off effects if they player isnt even online to port to.
  Reply With Quote
02/09/23, 03:26 PM   #9
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
and i have been reading all the documentation and wiki and api function pages but am very new at this and imo my logic is ok but im having the most difficulties with strings boolean etc like how and when to use them or say it is one or the other etc.. i cant find that info yet online so had to resort to creeping other addons to give insight on theyre usage.

Last edited by sinnereso : 02/09/23 at 06:58 PM.
  Reply With Quote
02/10/23, 05:37 AM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,963
Yeah I get that. The WIKI is outdated at many api pages so you better check the API version list ->
https://wiki.esoui.com/APIVersion
there you'll find the txt documentation attached at each version (e.g. current live server or PTS).
API TXT Documentation: https://www.esoui.com/forums/attachm...6&d=1663783675

In the txt files you'll find the API functions which are valid, there parameters and there types. Search within these files then, not at the Wiki!
e.g. for GetGroup or GetUnit or IsPlayer or IsDisplayName or IsCharacter etc. to find API functions for that purpose.

If you search the Wiki you might get extr info (about events etc.) but it ight be outdated, so always take the txt API files as the "what is currently the state of the art".
  Reply With Quote
02/10/23, 09:39 AM   #11
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by Baertram View Post
I think it was a loop over group members by
Code:
for i=1, GetGroupSize() do
  local unitTag = GetGroupUnitTag(i)
end
or something similar.

its all working flawlessly now except i had to remove the isunitonline(savedPlayer). this player would have to be in group and me not to be incombat for it to fire off. I was hoping to cover them not being online as well but havent been able to test if the isplayeringroup(savedPlayer) might kick back an error if theyre offline and work just as well. I just dont want the effects firing off for porting and then getting an error theyre offline is all. rest is flawless now.
  Reply With Quote
02/11/23, 02:35 PM   #12
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by Baertram View Post
You always should read the API documentation txt file for the parameters and parameter TYPES used! unitTags are not the same as character names or displaynames!

Afaik IsUnitInCombat(unitTag) only accepts unittags like "player" (yourself), "group1" to "groupN", "boss1" to "bossN" or "reticleover" and not any charactername or displayname!
So you cannot test IsUnitInCombat for any name on the server, only for yourself or grouped players.
There exist API group functions to check what name the group1, group2 etc. tags have but I'm not sure anymore, you need to search the API documentation txt file for them

I think it was a loop over group members by
Code:
for i=1, GetGroupSize() do
  local unitTag = GetGroupUnitTag(i)
end
or something similar.
Ive been working with this gem but cant get it working.. i know im close but cant seem to put my finger on why. any suggestions?

Code:
function RidinDirty.TravelToPlayer()
	local savedPlayer = RidinDirty.savedVariables.savedPlayer -- target saved player
	local effectId = RidinDirty.savedVariables.effectId
	local effectDelay = RidinDirty.savedVariables.effectDelay
	local savedPlayerId = nil -- savedID reset
	for i = 1, GetGroupSize() do
		local savedPlayerId = GetGroupUnitTagByIndex(i)
		if not GetUnitDisplayName("savedPlayerId") == savedPlayer then
			df("|c9900FF[RidinDirty]|r unit online is %s", savedPlayer) -- trying to execute this ONLY if previous line matches original savedPlayer
		end
	end
  Reply With Quote
02/11/23, 02:57 PM   #13
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 88
Originally Posted by sinnereso View Post
Ive been working with this gem but cant get it working.. i know im close but cant seem to put my finger on why. any suggestions?

Code:
function RidinDirty.TravelToPlayer()
	local savedPlayer = RidinDirty.savedVariables.savedPlayer -- target saved player
	local effectId = RidinDirty.savedVariables.effectId
	local effectDelay = RidinDirty.savedVariables.effectDelay
	local savedPlayerId = nil -- savedID reset
	for i = 1, GetGroupSize() do
		local savedPlayerId = GetGroupUnitTagByIndex(i)
		if not GetUnitDisplayName("savedPlayerId") == savedPlayer then
			df("|c9900FF[RidinDirty]|r unit online is %s", savedPlayer) -- trying to execute this ONLY if previous line matches original savedPlayer
		end
	end

The quotation marks in GetUnitDisplayName shouldnt be there. It should be:
Code:
 GetUnitDisplayName(savedPlayerId)
also i had a look at your addon.
Instead of creating and overwriting your save variables 6 times during initialization, i recommend doing it once and provide your default values within one table.
  Reply With Quote
02/11/23, 04:58 PM   #14
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by ExoY View Post
The quotation marks in GetUnitDisplayName shouldnt be there. It should be:
Code:
 GetUnitDisplayName(savedPlayerId)
also i had a look at your addon.
Instead of creating and overwriting your save variables 6 times during initialization, i recommend doing it once and provide your default values within one table.
Thank you that fixed it up Ill look at the saved variables thing next.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » easy port to your own primary house?

Thread Tools
Display Modes

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