ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Setalpha and coloured text. (https://www.esoui.com/forums/showthread.php?t=7196)

rewt3498 07/06/17 02:16 PM

Setalpha and coloured text.
 
I am trying to make the quest tracker panel transparent.

I've tried:
Code:

ZO_FocusedQuestTrackerPanel:SetAlpha(0.5)
This sets the white text of the quest tracker transparent but leaves the yellow quest title as opaque.

Does anyone know how to make all the text transparent? Failing that, is anyone able to tell me why SetAlpha() won't act upon the colored text?

haggen 07/06/17 04:22 PM

Running

Lua Code:
  1. /script ZO_FocusedQuestTrackerPanel:SetAlpha(0.5)

In the game worked just fine for me, the whole Tracked Quest component became transparent. You sure you tested it right?

rewt3498 07/06/17 04:36 PM

I just realized I didn't mention I'm using the gamepad UI. You are right: When I tested the code in non-gamepad mode, it makes the whole quest tracker transparent. In gamepad mode, it only makes the goal transparent while leaving the yellow quest title untouched.

Any ideas as to the cause of that?

haggen 07/06/17 04:55 PM

Quote:

Originally Posted by rewt3498 (Post 31738)
I just realized I didn't mention I'm using the gamepad UI. You are right: When I tested the code in non-gamepad mode, it makes the whole quest tracker transparent. In gamepad mode, it only makes the goal transparent while leaving the yellow quest title untouched.

Any ideas as to the cause of that?

Oh OK, that changes everything. :P I'm not used to the gamepad interface, but I took a look and I think found it.

You have to change the alpha for 3 separated controls, not sure why since they all has the same parent, anyway, here it is:

Lua Code:
  1. local alpha = 0.5
  2. ZO_FocusedQuestTrackerPanel:SetAlpha(alpha)
  3. ZO_FocusedQuestTrackerPanelContainerQuestContainerAssisted:SetAlpha(alpha)
  4. ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader1:SetAlpha(alpha)

There's also "ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader2" though I don't know in which situation this one appear, since normally it seems unused.

rewt3498 07/06/17 05:16 PM

Thank you very much for the help. This seems to do the trick.

rewt3498 07/06/17 10:06 PM

Does anyone know why having the line

Code:

ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader1:SetAlpha(0.5)
in an addon script produces and "attempt to index nil value" error, whereas doing

Code:

/script ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader1:SetAlpha(0.5)
in game works with no error?

Rhyono 07/06/17 10:08 PM

The addon is calling it before it exists, perhaps?

rewt3498 07/06/17 10:28 PM

I have attempted to use

Code:

zo_callLater(function () ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader1:SetAlpha(0.5) end, 10000)
which still results in an error.

Performing the same command with "/script" slash command in game results in success.

If the addon is calling it before it exists, is there some usual way to overcome this? Please forgive me if the question is a silly one, as I'm a bit new to this.

haggen 07/06/17 10:56 PM

Quote:

Originally Posted by rewt3498 (Post 31744)
Please forgive me if the question is a silly one, as I'm a bit new to this.

Not silly at all, but you'll begin to understand why things that look so simple end up being so ****ing difficult. :P

It's kinda late here and I'm sleepy as hell, is it okay if I get this tomorrow? :P

rewt3498 07/06/17 10:59 PM

Of course it is. I'm grateful for any help you are able to give whenever!

Edit: I have arrived at a solution thanks to what Rhyono said earlier. I found some information about registering for add on loaded event and combined it with zo_callLater, and I now have a working script. Thanks everyone.

haggen 07/07/17 06:37 AM

Quote:

Originally Posted by rewt3498 (Post 31746)
Of course it is. I'm grateful for any help you are able to give whenever!

Edit: I have arrived at a solution thanks to what Rhyono said earlier. I found some information about registering for add on loaded event and combined it with zo_callLater, and I now have a working script. Thanks everyone.

zo_callLater is sloppy, should be avoided for this kind of situation if possible.

Now about the AddOnLoaded event, you should ALWAYS wait it to be fired to begin your actual modifications. You can prepare stuff outside, set tables, define functions, but only actually do something after it's triggered. i.e.

Lua Code:
  1. local function DoSomethingCrazy()
  2.     -- Here I'm goin nuts!
  3. end
  4. EVENT_MANAGER:RegisterForEvent("BonkersAddOn", EVENT_ADD_ON_LOADED, function(eventCode, addOnName)
  5.     if (addOnName == "BonkersAddOn") then
  6.         DoSomethingCrazy()
  7.     end
  8. end)


All times are GMT -6. The time now is 05:45 AM.

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