Thread Tools Display Modes
07/06/17, 02:16 PM   #1
rewt3498
Join Date: Jun 2015
Posts: 7
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?
  Reply With Quote
07/06/17, 04:22 PM   #2
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
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?
  Reply With Quote
07/06/17, 04:36 PM   #3
rewt3498
Join Date: Jun 2015
Posts: 7
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?
  Reply With Quote
07/06/17, 04:55 PM   #4
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Originally Posted by rewt3498 View Post
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.
  Reply With Quote
07/06/17, 05:16 PM   #5
rewt3498
Join Date: Jun 2015
Posts: 7
Thank you very much for the help. This seems to do the trick.
  Reply With Quote
07/06/17, 10:06 PM   #6
rewt3498
Join Date: Jun 2015
Posts: 7
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?
  Reply With Quote
07/06/17, 10:08 PM   #7
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
The addon is calling it before it exists, perhaps?
  Reply With Quote
07/06/17, 10:28 PM   #8
rewt3498
Join Date: Jun 2015
Posts: 7
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.
  Reply With Quote
07/06/17, 10:56 PM   #9
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Originally Posted by rewt3498 View Post
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
  Reply With Quote
07/06/17, 10:59 PM   #10
rewt3498
Join Date: Jun 2015
Posts: 7
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.

Last edited by rewt3498 : 07/06/17 at 11:23 PM.
  Reply With Quote
07/07/17, 06:37 AM   #11
haggen
 
haggen's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2015
Posts: 137
Originally Posted by rewt3498 View Post
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)
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Setalpha and coloured text.

Thread Tools
Display Modes

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