Thread Tools Display Modes
04/05/15, 09:40 PM   #1
CrazyJay
Join Date: Apr 2015
Posts: 2
Move PC 'F' Hold to Interact [SOLVED]

So, I tried a few searches looking for an addon that moves the 'F' Hold to Interact pop-up when you approach a player character. Found nothing (weird). I did find this thread: http://www.esoui.com/forums/showthread.php?p=7956


Rather than bumping a near 1 year old thread, this sub-forum seemed more appropriate. If not, please help me redirect.

But, I really want this functionality for the same reason as the OP in that thread. I really Like FTCs Player and Target frames, And I really like having them right at the bottom and center next to each other just above the action bar.

Problem is, the damn vanilla 'F' Hold to Interact' prompt with a players name is in that exact spot. I would love if it was moved to where the NPC version is (I have no idea why it's not by default... but I digress)

Rather than request someone else make the addon I want, I though I would man up and try making it myself. Anyways, just tried doing a crash course in addon creation, and boy did I fail. I successfully made an addon that ESO recognizes and is up to date, but it doesn't do what I want. Here are my files. I am a noob when it comes to coding, so I am 100% sure I screwed it up somewhere (probably obvious to veterans). Browsing the API list in the Wiki got me nowhere, as I don't really even know what I'm looking for.

Addon Folder Name: MoveHoldToInteractPlayer

MoveHoldToInteractPlayer.txt
## Title: MoveHoldToInteractPlayer
## APIVersion: 100011

MoveHoldToInteractPlayer.lua
MoveHoldToInteractPlayer.lua

(Edit: and now it appears as though Forum posts don't recognize tabs from my code, trying to fix now. GOT IT! lua wrap function right in my face. Files are still attached anyways)

Attempt 1:
Lua Code:
  1. function MoveHoldToInteractPlayer:Initialize()
  2.     if name ~= "MoveHoldToInteractPlayer" then return end
  3.     ZO_PlayerToPlayerAreaPromptContainer:ClearAnchors()
  4.     ZO_PlayerToPlayerAreaPromptContainer:SetAnchor(BOTTOM, ZO_PlayerToPlayerArea, BOTTOM, 0, -600)
  5.     end
  6.  
  7. function MoveHoldToInteractPlayer.OnAddOnLoaded(event, addonName)
  8.   if addonName == MoveHoldToInteractPlayer.name then
  9.     MoveHoldToInteractPlayer:Initialize()
  10.   end
  11. end
  12.  
  13. EVENT_MANAGER:RegisterForEvent(MoveHoldToInteractPlayer.name, EVENT_ADD_ON_LOADED, MoveHoldToInteractPlayer.OnAddOnLoaded)

Attempt 2:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MoveInteract_OnLoad", EVENT_ADD_ON_LOADED,
  2.    function(code, name)
  3.       if name ~= "MoveHoldToInteractPlayer" then return end
  4.       ZO_PlayerToPlayerAreaPromptContainer:ClearAnchors()
  5.       ZO_PlayerToPlayerAreaPromptContainer:SetAnchor(BOTTOM, ZO_PlayerToPlayerArea, BOTTOM, 0, -350)
  6.       EVENT_MANAGER:UnregisterForEvent("MoveInteract_OnLoad", EVENT_ADD_ON_LOADED)
  7.    end)

Thanks in advance for your help. And if this is the wrong sub-forum. My apologies. Brand new to this game and loving it so far!

-CrazyJay
Attached Files
File Type: lua MoveHoldToInteractPlayer.lua (1.0 KB, 376 views)
File Type: txt MoveHoldToInteractPlayer.txt (89 Bytes, 391 views)

Last edited by CrazyJay : 04/05/15 at 10:29 PM.
  Reply With Quote
04/05/15, 10:28 PM   #2
CrazyJay
Join Date: Apr 2015
Posts: 2
I did it!

And the winner is: I'm an idiot. Just some error with cut/pasting from the code available in the thread I linked.

Anyways, if anyone wants the final product here it is:

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MoveInteract_OnLoad", EVENT_ADD_ON_LOADED,
  2.    function(code, name)
  3.       if name ~= "MoveHoldToInteractPlayer" then return end
  4.       ZO_PlayerToPlayerAreaPromptContainer:ClearAnchors()
  5.       ZO_PlayerToPlayerAreaPromptContainer:SetAnchor(BOTTOM, ZO_PlayerToPlayerArea, BOTTOM, 150, -500)
  6.       EVENT_MANAGER:UnregisterForEvent("MoveInteract_OnLoad", EVENT_ADD_ON_LOADED)
  7.    end)

See attached SS for results. It's pretty damn close to the NPC version in location now.

Now, if I can just figure out how to make it editable in game, I'll have a real winner and maybe I'll post the addon for others that may want it! (I'll take any pointers if you want to take a moment to share)
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20150406_002102.jpg
Views:	482
Size:	718.2 KB
ID:	578  
  Reply With Quote
04/05/15, 11:49 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Heres an editable version. I tried to do what you asked, but keep it as simple as possible (no saved variables). So when you relog it will go back to the default position, but you can move it around the screen with the slash command:
Lua Code:
  1. /moveprompt offsetX, offsetY

There is also a command to reset it back to the default position (default position we set, not the games default position).
Lua Code:
  1. /resetprompt

I also changed the anchor point to the center of the screen. I thought that would be easier to guess what offset values you want, positive values move it right for offsetX (or down for offsetY), negative values move it left for offsetX (or up for offsetY).

Feel free to do whatever you want with it.

Lua Code:
  1. -- Default offsets for positioning from
  2. -- center of screen
  3. -- Negative values move it left of center, pos values move it right of center
  4. local defaultX = 150
  5. -- negative values move it up from center, pos values move it down from center
  6. local defaultY = 0
  7.  
  8. local function ReAnchorPrompt(offsetX, offsetY)
  9.   ZO_PlayerToPlayerAreaPromptContainer:ClearAnchors()
  10.   ZO_PlayerToPlayerAreaPromptContainer:SetAnchor(CENTER, ZO_PlayerToPlayerArea, CENTER, offsetX, offsetY)
  11. end
  12.  
  13. -- called from slash command /moveprompt offsetx, offsety
  14. local function MovePromptAnchor(arguments)
  15.     -- capture the values passed in
  16.     local arg1, arg2 =  string.match(arguments, "(.+)%s*,%s*(.+)")
  17.    
  18.     -- the values come in as strings, convert them to numbers
  19.     local offsetX = tonumber(arg1)
  20.     local offsetY = tonumber(arg2)
  21.    
  22.     -- If either of these dont exist one of them was not a number so bail
  23.     if offsetX and offsetY then
  24.         ReAnchorPrompt(offsetX, offsetY)
  25.     end
  26. end
  27.  
  28. -- called from player activation event & /resetprompt slash command
  29. -- to reset the default positioning
  30. local function SetPromptDefaults()
  31.     ReAnchorPrompt(defaultX, defaultY)
  32. end
  33.  
  34. -- I used player activation event and then unregistered it, so
  35. -- theres no if addonName ~= "lksjdfl" check needed
  36. -- No need for an addonLoaded event, theres nothing to initialize
  37. EVENT_MANAGER:RegisterForEvent("MoveInteract_OnLoad", EVENT_PLAYER_ACTIVATED,
  38.     function()
  39.         SetPromptDefaults()
  40.         EVENT_MANAGER:UnregisterForEvent("MoveInteract_OnLoad", EVENT_PLAYER_ACTIVATED)
  41.     end)
  42.  
  43. -- Slash Commands for moving the prompt
  44. SLASH_COMMANDS["/moveprompt"]       = MovePromptAnchor
  45. SLASH_COMMANDS["/resetprompt"]      = SetPromptDefaults
  Reply With Quote
04/06/15, 12:08 AM   #4
TribeofOne
Join Date: Mar 2014
Posts: 41
Azurah does this.. iirc

http://www.esoui.com/downloads/info6...orUpdate6.html
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Move PC 'F' Hold to Interact


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