Thread Tools Display Modes
12/20/15, 04:14 AM   #1
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
How to detect when I have used some bait

I am trying to add a tooltip to my fishing pins in Destinations and I have succeeded.
It reads the amount of bait suitable for that particular type of water, and adds it to the pin info.
My problem is, when I have used a bait, then it doesn't update to the new amount when I reopen my map.
Only if I change to another map does it update. That is because it is set to re-read bait info from my bag on map change.

Is there a way to detect I have used a bait, so I can get it to update the numbers left?

I have looked into both fishing events and map events, but can't seem to find any that can be used in this case... Or did I miss something?
  Reply With Quote
12/20/15, 10:25 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by SnowmanDK View Post
I am trying to add a tooltip to my fishing pins in Destinations and I have succeeded.
It reads the amount of bait suitable for that particular type of water, and adds it to the pin info.
My problem is, when I have used a bait, then it doesn't update to the new amount when I reopen my map.
Only if I change to another map does it update. That is because it is set to re-read bait info from my bag on map change.

Is there a way to detect I have used a bait, so I can get it to update the numbers left?

I have looked into both fishing events and map events, but can't seem to find any that can be used in this case... Or did I miss something?
Hi SnowmanDK,

how you doing?

Plan A and B:
1. Maybe EVENT_INVENTORY_ITEM_USED is triggered?
2. EVENT_INVENTORY_SINGLE_SLOT_UPDATE is triggered for sure. May set a dirty flag in that event to re-read baits in custom pins tooltip creator callback.

CU
  Reply With Quote
12/20/15, 10:41 AM   #3
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by votan View Post
Hi SnowmanDK,

how you doing?

Plan A and B:
1. Maybe EVENT_INVENTORY_ITEM_USED is triggered?
2. EVENT_INVENTORY_SINGLE_SLOT_UPDATE is triggered for sure. May set a dirty flag in that event to re-read baits in custom pins tooltip creator callback.

CU
Thanks, I'll look at those
Update:
EVENT_INVENTORY_SINGLE_SLOT_UPDATE worked for me
I set it to update all fishing pins IF the change in the bag was in a fishing bait stack (checked using GetItemLink()).

Last edited by SnowmanDK : 12/20/15 at 11:15 AM.
  Reply With Quote
12/20/15, 11:50 AM   #4
Wandamey
Guest
Posts: n/a
or you could recount your stack right before displaying the tooltip with a Prehook "OnShow" ? what are the chances for the tooltip to be already on screen while the baits are depleted?

ZO_PreHook(yourtooltip, "OnShow", yourupdatefunc)

If your tooltip is personalized it would restrain the number of calls for sure.


(whoops forgot to say hi!)

actually it would be even savier do it on map display as you tried, but for that you should look at the SCENES functions, I can't tell exactly for this.

Last edited by Wandamey : 12/20/15 at 12:23 PM.
  Reply With Quote
12/20/15, 01:12 PM   #5
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Wandamey View Post
or you could recount your stack right before displaying the tooltip with a Prehook "OnShow" ? what are the chances for the tooltip to be already on screen while the baits are depleted?

ZO_PreHook(yourtooltip, "OnShow", yourupdatefunc)

If your tooltip is personalized it would restrain the number of calls for sure.


(whoops forgot to say hi!)

actually it would be even savier do it on map display as you tried, but for that you should look at the SCENES functions, I can't tell exactly for this.
I think I'll check out your suggestions.
Even though EVENT_INVENTORY_SINGLE_SLOT_UPDATE works, and I did set it to only update when a bait stack changes, then it causes a small lag every time it updates, eg. you pick up bait or move/use bait. Not critical, but still...
  Reply With Quote
12/20/15, 01:51 PM   #6
Wandamey
Guest
Posts: n/a
yes you have to browse your bag each time, would be the same with the tooltips though I just got another idea:

you can do your own "popuptooltip" like this :
MyItemTooltip = WINDOW_MANAGER:CreateControlFromVirtual("MyItemTooltipName", parent , "ZO_ItemIconTooltip")

(if SetLink doesn't work with this try "ZO_PopupTooltip" in 3rd arg)

then you can anchor it exactly as you want with no risk to make a mistake with the original one and use a SetLink to generate the raw itemtooltip of your baits. it'll have the image and the description but no hooks from other addons. advantage of this : the number of possed items is already on it in the corner : bag and bank with no extra processing

the display would a bit overkill for just a number, but at least not the background processing. Maybe just stuck the popup in a corner and use the control to display whatever extra fancy info you need.

good luck!
  Reply With Quote
12/20/15, 02:11 PM   #7
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by SnowmanDK View Post
I think I'll check out your suggestions.
Even though EVENT_INVENTORY_SINGLE_SLOT_UPDATE works, and I did set it to only update when a bait stack changes, then it causes a small lag every time it updates, eg. you pick up bait or move/use bait. Not critical, but still...
Jo, that's why I suggested to use a dirty flag, only.
Count the baits, once needed and cache until dirty flag is true again.
But there are many ways
  Reply With Quote
12/20/15, 08:45 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
It sounds like you are all talking about scanning the bag for lures. Why not use the lure indices to store the information then all you need is this?
Lua Code:
  1. local name, icon, stack, sellPrice, quality  = GetFishingLureInfo(lureIndex)

This is probably not what you need, but you asked for a way to detect when the bait count changes.
I see no way to know when you loose bait, catch something, or stop fishing (when you don't react to a fish on the line). This is the closest I could think of that would work for all situations. There is a delay though, it updates 30 seconds after you cast which was my estimate of the longest time you could have a line in the water before the line is retracted.
Warning: Spoiler


If you only need to know the lure counts when a map pin tooltip is displayed use the lureIndices. I don't know how your storing the lure information, but since your adding information about the lure to the pin tooltip, you must know which lure it is. If you use the lureIndices to identify/store that information about the lures then when you add the info to the pin you already know the lureindex so just update the stack count first with this:
Lua Code:
  1. -- example
  2. local lureCounts = {
  3.     [lureIndex] = {},
  4. }
  5.  
  6. local name, icon, stack, sellPrice, quality  = GetFishingLureInfo(lureIndex)
  7. lureCounts[lureIndex].stack = stack
  8. -- do whatever to add info to pin
  Reply With Quote
12/22/15, 01:59 PM   #9
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
I thank you for all your suggestions, and will see what I can make out of it

I guess I was a bit inaccurate in my initial question.
I needed to know WHAT kind of bait that have changed in amount.
This means I have to check all 9 types of bait.
I also need to make sure it can register if I have more than one stack of a certain bait and add it all up.

IF I understand this all right, then I can't just cache the amount in a variable for later use, as the amount can change when you move bait to/from your bank, when you pick up bait, when you get it from a mail and so on UNLESS I set it to update in all those cases... The only exception is if I can set it to ONLY update when the map is opened, but I guess it would have to be some sort of a prehook function to make sure the pin data is updated before you point to the pins (correct me if I am wrong).

The most important thing is to make it update the amount of correct bait on the correct pins when the map is opened.

My current solution does check all 9 and it does take multiple stacks into account.
As it is it updates every time there is a change in the bag content by doing a EVENT_INVENTORY_SINGLE_SLOT_UPDATE.
It is not optimal, I know, but it works for now

UPDATE:
I realized one thing...
So far I have using GetItemLink(BAG_BACKPACK, i) to go through the entire bag.
I can use GetFishingLureInfo(lureIndex) instead, just as long as I use the icon name for comparisons (to make sure it works across languages) then I guess that would be a LOT better

Last edited by SnowmanDK : 12/22/15 at 02:43 PM.
  Reply With Quote
12/22/15, 02:45 PM   #10
Wandamey
Guest
Posts: n/a
I couldn't test circonian's function ( local name, icon, stack, sellPrice, quality = GetFishingLureInfo(lureIndex) ) because i can't log in on PTS and i don't have live installed anymore, but if the indexes are related to the wheel menu (the one to choose the bait when you fish) then it's jackpot : the indexes will be fixed values, the stacks would be already all taken into account i think. (i don't remember the original display, but i'm sure votan knows about that and could confirm)

and the biggest loop you would have to do would be of 9 elements (currently you are browsing your whole bag, aka up to 200 elements each time you pick a bait)
In this case you can use the stack return of circonian's function to update your values, lets say on map opening (it would be the cheapest number of calls and the values would be updated before displaying any tooltip - if the guy who can go through his whole screen in less than 10ms doesn't come back )

afaik there is no way to loot things or fish or look in the bag with the map on the screen so it seems to be a very viable option.
Now if this function doesn't rely on incertain indexes, it wouldn't hurt either to use it on a tooltip prehook as it is way lighter than a whole bag check.

to know what bait has what index, run the function for all baits and display the name, the stack and the index to see for yourself, you'll see if it add stacks too and references all baits or not. (if it references only the baits you possess, that may be a bit trickier to use it - but you could make a table of baits ids and retrieve the localized name from a fake itemLink it to compare to the name returned by the function for example - these would be little, manageable tables.)

i'd like to be more precise with examples of functions but as I can't test by myself right now, i rather count on someone else to tell you how to run the update on map opening for example...

edit : eerf i'm a slow typer, you edited and already saw the point of circonian's findings...
beware the chub and the simple bait, not sure they don't share the same pic.

Last edited by Wandamey : 12/22/15 at 02:54 PM.
  Reply With Quote
12/22/15, 02:58 PM   #11
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by SnowmanDK View Post
IF I understand this all right, then I can't just cache the amount in a variable for later use, as the amount can change when you move bait to/from your bank, when you pick up bait, when you get it from a mail and so on UNLESS I set it to update in all those cases... The only exception is if I can set it to ONLY update when the map is opened, but I guess it would have to be some sort of a prehook function to make sure the pin data is updated before you point to the pins (correct me if I am wrong).

The most important thing is to make it update the amount of correct bait on the correct pins when the map is opened.

My current solution does check all 9 and it does take multiple stacks into account.
As it is it updates every time there is a change in the bag content by doing a EVENT_INVENTORY_SINGLE_SLOT_UPDATE.
It is not optimal, I know, but it works for now
Hi,

well am not as deep in your problem, as you But the tooltip creator of the map pins is/can be a callback-function, which can do anything you want before adding text to the tooltip.

you can count the baits the first time a pin is hovered (creator callback is called the first time) and cache the values until map gets closed again.

uncomplete example:
Code:
...
local dirty = true
...
	local creator = {
		creator = function(pin)
			local _, tag = pin:GetPinTypeAndTag()
if dirty then
--count baits, if first time and cache
dirty = false
end
--fill text variable
			if IsInGamepadPreferredMode() then
				ZO_MapLocationTooltip_Gamepad:AddLine(text)
			else
				local r, g, b = ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB()
				InformationTooltip:AddLine(text, "", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_CENTER)
			end
		end,
		tooltip = 1,
	}

	self.layout = {
		level = data.settings.pinLevel or 30,
		size = data.settings.pinSize or 32,
		insetX = 4,
		insetY = 4,
		texture = "esoui/art/icons/achievements_indexicon_fishing_down.dds",
		tint = function(pin)
			local _, tag = pin:GetPinTypeAndTag()
			return tag:GetColor()
		end,
	}

	ZO_WorldMap_AddCustomPin(data.pinType, LayoutPins, nil, self.layout, creator)
...

do
	local function WorldMapStateChanged(oldState, newState)
		if (newState == SCENE_FRAGMENT_HIDING) then
			dirty=true
-- next time count baits again
		end
	end
	WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
	GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
end
...
For counting the baits, you could try circonian's idea.

/edit: Ok, I'm even more slow
  Reply With Quote
12/22/15, 03:20 PM   #12
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
For now I have ended up with this (a kind of a mix):
Lua Code:
  1. local FoulBaitLeft, FoulSBaitLeft, RiverBaitLeft, RiverSBaitLeft = 0, 0, 0, 0
  2.     local OceanBaitLeft, OceanSBaitLeft, LakeBaitLeft, LakeSBaitLeft = 0, 0, 0, 0
  3.     local GeneralBait = 0
  4.     if DestinationsSV.filters[PINS_FISHING_SHOW_BAIT_LEFT] then
  5.         local lureIndex = GetFishingLure()
  6.         local numLures = GetNumFishingLures()
  7.         for lureIndex=1, numLures do
  8.             local name, icon, stack, _, _  = GetFishingLureInfo(lureIndex)
  9.             if     string.find(icon, "centipede") then  --Crawlers
  10.                 FoulBaitLeft = stack
  11.             elseif string.find(icon, "fish_roe") then   --Fish Roe
  12.                 FoulSBaitLeft = stack
  13.             elseif string.find(icon, "torchbug") then   --Insect Parts
  14.                 RiverBaitLeft = stack
  15.             elseif string.find(icon, "shad") then   --Shad
  16.                 RiverSBaitLeft = stack
  17.             elseif string.find(icon, "worms") then  --Worms
  18.                 OceanBaitLeft = stack
  19.             elseif string.find(icon, "fish_tail") and not (string.find(name, "simple") or string.find(name, "einfacher") or string.find(name, "appāt")) then    --Chub
  20.                 OceanSBaitLeft = stack
  21.             elseif string.find(icon, "guts") then   --Guts
  22.                 LakeBaitLeft = stack
  23.             elseif string.find(icon, "river_betty") then    --Minnow
  24.                 LakeSBaitLeft = stack
  25.             elseif string.find(icon, "fish_tail") and (string.find(name, "simple") or string.find(name, "einfacher") or string.find(name, "appāt")) then    --Simle Bait
  26.                 GeneralBait = stack
  27.             end
  28.         end
  29.     end
The reason for name comparison is that I found out that Chub and Simple Bat use the same icon.
Testing it right now
Edit: I am slow too lol

Last edited by SnowmanDK : 12/22/15 at 04:19 PM.
  Reply With Quote
12/22/15, 03:22 PM   #13
Wandamey
Guest
Posts: n/a
Originally Posted by votan View Post

Code:
...
For counting the baits, you could try circonian's idea.

/edit: Ok, I'm even more slow
that's nice, I managed to place my post right when I could pretend it was useful

edit cross post with SMDK if you wait 5 mn, i'm sure votan will help with a tested version of bait listing by id and something like this :

local fakeitemLink = zo_strformat(|H0blablabla<<1>>blablabla|h|h, baitId) <---build an ItemLink with no name
zo_strformat(<<1>>,GetItemLinkName(fakeitemLink)) <-- get localized name - format or not depending on the value returned by GetFishingLureInfo or format both the same to compare
(all you need to do this is in fisherman, file Baits.lua btw : all ids, the localized name function too)


but i think you are able to simply make a table lure[itemId] = lureindex, i'm pretty sure these indexes are stable because of the selection wheel.

re edit : you are using local lureIndex = GetFishingLure() at first? It probably just return the index of the current lure on the rod? not sure. but anyway you are using it as the indice 2 lines later. Doesn't seem needed at all.

Last edited by Wandamey : 12/22/15 at 03:53 PM.
  Reply With Quote
12/22/15, 04:13 PM   #14
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Wandamey View Post
that's nice, I managed to place my post right when I could pretend it was useful

edit cross post with SMDK if you wait 5 mn, i'm sure votan will help with a tested version of bait listing by id and something like this :

local fakeitemLink = zo_strformat(|H0blablabla<<1>>blablabla|h|h, baitId) <---build an ItemLink with no name
zo_strformat(<<1>>,GetItemLinkName(fakeitemLink)) <-- get localized name - format or not depending on the value returned by GetFishingLureInfo or format both the same to compare
(all you need to do this is in fisherman, file Baits.lua btw : all ids, the localized name function too)


but i think you are able to simply make a table lure[itemId] = lureindex, i'm pretty sure these indexes are stable because of the selection wheel.

re edit : you are using local lureIndex = GetFishingLure() at first? It probably just return the index of the current lure on the rod? not sure. but anyway you are using it as the indice 2 lines later. Doesn't seem needed at all.
I changed my local variables after last post to
Lua Code:
  1. local defaults = {
  2.     data = {
  3.         FoulBaitLeft = 0,
  4.         FoulSBaitLeft = 0,
  5.         RiverBaitLeft = 0,
  6.         RiverSBaitLeft = 0,
  7.         OceanBaitLeft = 0,
  8.         OceanSBaitLeft = 0,
  9.         LakeBaitLeft = 0,
  10.         LakeSBaitLeft = 0,
  11.         GeneralBait = 0,
  12.     },
  13. },
so they became "local" for my entire addon instead of the one function
Edit: You are right about the local lureIndex = GetFishingLure() I just copied from circonian's example lol.

Last edited by SnowmanDK : 12/22/15 at 04:17 PM.
  Reply With Quote
12/22/15, 04:38 PM   #15
Wandamey
Guest
Posts: n/a
I was thinking you could avoid the loop by using the indexes directly, though it may look cleaner, it would bring nothing since you update all the values at the same time.

your way is more resistant against indexes variations too. Don't mind what i said.
  Reply With Quote
12/22/15, 04:48 PM   #16
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Wandamey View Post
I was thinking you could avoid the loop by using the indexes directly, though it may look cleaner, it would bring nothing since you update all the values at the same time.

your way is more resistant against indexes variations too. Don't mind what i said.
Your input is still valued

Now I just need an event that is fired when I OPEN my map (by pressing 'M').
As it is now, it counts every time there is ANY change in my bag, which causes lag.

I did look into votan's example using
Lua Code:
  1. WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
  2. GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
but it only fires on map change, not when I open it.

Last edited by SnowmanDK : 12/22/15 at 04:50 PM.
  Reply With Quote
12/22/15, 04:56 PM   #17
Wandamey
Guest
Posts: n/a
there is an example in votan's answer,I colored it, you'll have to temper with it a bit, he uses the var dirty to even tell if it was necessary to update or not. Now that your counting function is shortened to a minimum, you can run it each time you open the map.

Originally Posted by votan View Post
Hi,

well am not as deep in your problem, as you But the tooltip creator of the map pins is/can be a callback-function, which can do anything you want before adding text to the tooltip.

you can count the baits the first time a pin is hovered (creator callback is called the first time) and cache the values until map gets closed again.

uncomplete example:
Code:
...
local dirty = true
...
	local creator = {
		creator = function(pin)
			local _, tag = pin:GetPinTypeAndTag()
if dirty then
--count baits, if first time and cache
dirty = false
end
--fill text variable
			if IsInGamepadPreferredMode() then
				ZO_MapLocationTooltip_Gamepad:AddLine(text)
			else
				local r, g, b = ZO_TOOLTIP_DEFAULT_COLOR:UnpackRGB()
				InformationTooltip:AddLine(text, "", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, TEXT_ALIGN_CENTER)
			end
		end,
		tooltip = 1,
	}

	self.layout = {
		level = data.settings.pinLevel or 30,
		size = data.settings.pinSize or 32,
		insetX = 4,
		insetY = 4,
		texture = "esoui/art/icons/achievements_indexicon_fishing_down.dds",
		tint = function(pin)
			local _, tag = pin:GetPinTypeAndTag()
			return tag:GetColor()
		end,
	}

	ZO_WorldMap_AddCustomPin(data.pinType, LayoutPins, nil, self.layout, creator)
...

do
	local function WorldMapStateChanged(oldState, newState)
		if (newState == SCENE_FRAGMENT_HIDING) then
			dirty=true
-- next time count baits again
		end
	end
	WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
	GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged) 
end
...
For counting the baits, you could try circonian's idea.

/edit: Ok, I'm even more slow


maybe try this instead
but as I said, i can't test it and i'm the queen of typos. good luck

Code:
local function WorldMapStateChanged(oldState, newState)
    if (newState == SCENE_FRAGMENT_SHOWING) then
	UpdateBaitsCountFunction()
   end
end



WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)

Edit : and still a super slow typer.

It's not map change, it's Scene State change . just try it. or i'll check another example with the standard scene manager.

But anyway it's time for me to call it a day, and soon circonian will be there and make us all look like unwiped kids with a one line function that does everything you always dreamt of and even more.

Last edited by Wandamey : 12/22/15 at 05:06 PM.
  Reply With Quote
12/22/15, 05:10 PM   #18
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Wandamey View Post
there is an example in votan's answer,I colored it, you'll have to temper with it a bit, he uses the var dirty to even tell if it was necessary to update or not. Now that your counting function is shortened to a minimum, you can run it each time you open the map.





maybe try this instead
but as I said, i can't test it and i'm the queen of typos. good luck

Code:
local function WorldMapStateChanged(oldState, newState)
    if (newState == SCENE_FRAGMENT_SHOWING) then
	UpdateBaitsCountFunction()
   end
end



WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)

Edit : and still a super slow typer.

It's not map change, it's Scene State change . just try it. or i'll check another example with the standard scene manager.

But anyway it's time for me to call it a day, and soon circonian will be there and make us all look like unwiped kids with a one line function that does everything you always dreamt of and even more.
I tried using the
Code:
local function WorldMapStateChanged(oldState, newState)
    if (newState == SCENE_FRAGMENT_SHOWING) then
	UpdateBaitsCountFunction()
   end
end



WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
GAMEPAD_WORLD_MAP_SCENE:RegisterCallback("StateChange", WorldMapStateChanged)
I fired up the game, checked the amount of bait by opening the map and pointed to a fishing pin.
I then closed the map and started fishing.
After catching one fish, I opened the map again and pointed to the fishing pin.
It still showed the same number as before.
BUT... After I zoomed to a city map and back out THEN it showed to correct amount.
So... Seems like it doesn't update when I need it to
  Reply With Quote
12/22/15, 05:17 PM   #19
Wandamey
Guest
Posts: n/a
there must be some prehook with onshow or something...

for starters type this in your chat with the map opened to know the scene name :
/script d(SCENE_MANAGER:GetCurrentScene():GetName())

at worse i made something like this but for all the UI mode... i got to retrieve it, i'll edit a bit later

---
i used this with the stats panel once, that will require to /zgoo SCENE maybe instead of the script line. I don't remember :s
ZO_PreHookHandler(ZO_StatsPanel, "OnShow", myfunctiononshow)
ZO_PreHookHandler(ZO_StatsPanel, "OnHide", myfunctiononhide)

you got to find the map name to replace ZO_StatsPanel
no idea how it would react for gamepad though

Last edited by Wandamey : 12/22/15 at 05:22 PM.
  Reply With Quote
12/22/15, 05:21 PM   #20
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Wandamey View Post
there must be some prehook with onshow or something...

for starters type this in your chat with the map opened to know the scene name :
/script d(SCENE_MANAGER:GetCurrentScene():GetName())

at worse i made something like this but for all the UI mode... i got to retrieve it, i'll edit a bit later
I can say that what you wrote above returns
worldMap
no matter what map I have showing. I tried while showing Tamriel, Coldharbour, Craglorn and Davon's Watch.

Edit: Now I am slow again

From your edit, then I assume I should make something like this on addon load?:
ZO_PreHookHandler("worldMap", "OnShow", myfunctiononshow)
or did I miss something?

Last edited by SnowmanDK : 12/22/15 at 05:23 PM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » How to detect when I have used some bait


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