View Single Post
04/24/23, 07:49 AM   #10
Valve
 
Valve's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2017
Posts: 23
Originally Posted by sinnereso View Post
OK return false might not work. Ill need to halt the execution of the original "jumpto.." code by a delay required by the individual effect which i cant or dont know how todo without using:

Code:
zo_callLater(function() JumpToFriend(friendName) end, effectDelay)
*EDIT
Doesnt appear to delay the return. I guess Ill just bail on the idea.. It woulda been cool but without a Lib or something controlling the original function with some delay options fairly between addons I dont think its going to work.
You should still be able to do this if you're willing to halt the initial execution by returning true. You can then use a variable to keep track of whether you want to halt the subsequent "JumpToFriend" execution.

First time it executes, you can return true, trigger the memento and use your `zo_callLater` to execute it again after the memento has finished.

Code:
local shouldHaltExecution = true;

local function DoStuff(name)
	d("DoStuff")
	shouldHaltExecution = false
	JumpToFriend(name)
end

ZO_PreHook("JumpToFriend", function(name)
	d(name)
	if shouldHaltExecution then
		zo_callLater(function() DoStuff(name) end, 5000)
		return true
	else
		shouldHaltExecution = true
	end
end)
Calling "JumpToFriend" yourself will trigger the prehook again so be careful with recursion if you're doing this. You'd also be blocking the initial JumpToFriend which seems to be requried for your memento logic.

Last edited by Valve : 04/24/23 at 07:55 AM.
  Reply With Quote