View Single Post
06/20/23, 03:03 AM   #5
Anumaril
 
Anumaril's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 14
Originally Posted by Baertram View Post
If all wents bad the wayshrines action string will be just "Use" (in any language at least) and you are not able to properly detect it or differ from other "Use" actions.
You will need to use the API function GetInteractionInfo() or similar to return more info about the interaction below your crosshair (ESO names that "reticle") to check for a wayshrine type returned or similar)!!!


local interactionType = GetInteractionType()
if interactionType == INTERACTION_WHATEVER A WAYSHRINE RETURNS AND IF THIS IS ONLY RETURNED FOR A WAYSHRINE then

I think there was one interaction type INTERACTION_FAST_TRAVEL

So check if the library linked above supports that already somehow.
I ended up going with this as it seems simpler than what I was doing before, and should also be easy for me to include INTERACTION_FAST_TRAVEL_KEEP in the future (to disable fast travel in Cyrodiil too). But I've ran into an issue with the code:

Code:
-- Function to check if the interaction is with a wayshrine
local function IsWayshrineInteraction()
    local interactionType = GetInteractionType()
	d("[NoFastTravel] Interaction type: " .. tostring(interactionType))
    return interactionType == INTERACTION_FAST_TRAVEL
end

-- Check if the INTERACTIVE_WHEEL_MANAGER table exists, otherwise create it
INTERACTIVE_WHEEL_MANAGER = INTERACTIVE_WHEEL_MANAGER or {}

-- Store the original StartInteraction function
local OriginalInteract = INTERACTIVE_WHEEL_MANAGER.StartInteraction

-- Modify the StartInteraction function
INTERACTIVE_WHEEL_MANAGER.StartInteraction = function(...)
    if IsWayshrineInteraction() then
	d("[NoFastTravel] Wayshrine interaction intercepted!") -- Test code functionality by seeing if this is printed in chat
        return true -- Disable fast travel for wayshrines
    end

    return OriginalInteract(...)
end
The first function defines what's a Wayshrine interaction or not so that the last function can basically intercept the interaction and stop the player from interacting with Wayshrines. But it just doesn't recognise it. I'm using the correct interaction text too (INTERACTION_FAST_TRAVEL) since I can see it in the most recent API documentation.

I've added the line "d("[NoFastTravel] Interaction type: " .. tostring(interactionType))" to the function to see if the game is picking up on the interactions or not, and ALL the interaction types are "0", meaning it's not registering ANY interaction at all.

Yesterday I was messing around with the code and managed to get it to recognise a handful of other interactions (like Companion conversations, which I think are type "14"), but even then it didn't recognise Wayshrines, which were still type "0". But then I continued tweaking the code and now everything's back to 0 again, so I'm pretty lost on what to do


EDIT: Just found out now that with the current code if I double-press the E key to interact, the first interaction type will be "0", but the second time will be the actual interaction type (14 for companion conversations). As for wayshrines, it'll be 0 when I interact with the wayshrine, but once I'm looking at the wayshrine map it will correctly list the interaction type (11) and also print the other text string I have saying it was intercepted. Needless to say, it doesn't work, and I'm quite lost haha

Last edited by Anumaril : 06/20/23 at 04:11 AM.
  Reply With Quote