ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   World Map (https://www.esoui.com/forums/showthread.php?t=9136)

ZephyrDawn 05/09/20 06:34 AM

World Map
 
Hi all, apologies if this question is quite basic. The documentation is proving quite daunting haha.

I'm trying to find something, whether that be an event, scene, or callback that I can use to detect when the user has opened their world map. The events EVENT_ACTION_LAYER_PUSHED and EVENT_ACTION_LAYER_POPPED are the closest I've seen, but those fire every time the reticle is shown/hidden so I'm not sure how to specifically differentiate when it fires with relation to the map being opened. I also don't think those will work as they don't seem to fire when switching between menu tabs (i.e. from the inventory screen to the world map).

Can anyone point me in the direction of something I can use to detect this?

sirinsidiator 05/09/20 07:17 AM

The game has a concept of scenes for different UI states which are handled by a scene manager. You could hook into the scene for the world map and listen to the callback that is fired when it shows or hides. This code in worldmap.lua gives an example how it works.

ZephyrDawn 05/09/20 08:02 AM

That was exactly what I'm looking for! Thanks very much :)

Out of curiosity for the future. Is there a resource that lists the base game scenes? I'm seeing resources for events and public api functions on the wiki, but not anything for scenes

Baertram 05/09/20 11:48 AM

The data at the wiki basically is provided by ZOs in the ESOUIDocumentationPxx.txt files they provide us at updates/API version increase.
Some additional data like textrues or sounds are read from the global ingame variables then.
Scenes are not in there so you need to check the scenes ingame either by using a tool like merTorchbug or ZGOO and inspect SCNENE_MANAGER.currentScene e.g.
Or you can have a look at the ESOUi source code to get some of the scenes defined by searching the files for SCENE_MANAGER:OpenScene or just SCENE_MANAGER or similar.

Here is a file of the ESOUI sources containing some of the scenes which are defined:
https://github.com/esoui/esoui/blob/...gamescenes.lua

Others are defined in the ingame folder subfolders, like ingame/inventory will most like contain the inventory related (maybe also bank) scene etc.
https://github.com/esoui/esoui/tree/...0/esoui/ingame

Hint: There most of the time exist own scenes for keyboard or gamepad mode.

Aenathel 05/10/20 08:41 AM

If you haven't found it yet, the world map scene is simply called "worldMap".

ZephyrDawn 05/10/20 04:35 PM

This is all perfect thanks for the information!

votan 05/11/20 09:26 AM

And there is a global variable WORLD_MAP_SCENE.
Lua Code:
  1. WORLD_MAP_SCENE:RegisterCallback("StateChange", function(oldState, newState)
  2.   if newState == SCENE_SHOWING then
  3.   elseif newState == SCENE_HIDDEN then
  4.   end
  5. end)

ZephyrDawn 05/11/20 04:26 PM

My addon is nearly done, but I'm struggling with one last thing. I'm trying to register when a control or any of its children have been clicked on (like an on click callback or something). Specifically, I'm trying to monitor when the zoom level has changed. I can see some interaction methods for clicking and mouse wheeling on the zoom control's children, but is there any way to set up a watcher or something that will fire when these methods are called?

Thanks :)

Wheels 05/11/20 05:28 PM

ZO_PreHook("ZO_WorldMapZoomPlus_OnClicked", function() ... end)
ZO_PreHook("ZO_WorldMapZoomMinus_OnClicked", function() ... end)
ZO_PreHook("ZO_WorldMapZoom_OnMouseWheel", function() ... end) -- does not seem to actually be used

Take a look at the world map source here

Baertram 05/11/20 05:41 PM

Run your code before/After other code:
https://wiki.esoui.com/How_to_run_yo...eHook/PostHook)

Event handlers on controls (if you do not want to use a PreHook/PostHook you can register your own event handler like OnMouseUp or OnClicked etc. to a control -> Not to a function!):
https://wiki.esoui.com/SetHandler

There also exists ZO_PreHookHandler and ZO_PostHookHandler but the new eventHandlers 8see the link above) will take care of the run order, so these functions shouldn't be used anymore if not necessary.


All times are GMT -6. The time now is 04:09 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI