WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Quartz - setting castingcolor externally. How? (https://www.wowinterface.com/forums/showthread.php?t=28721)

Shanyn 11-25-09 04:43 PM

Quartz - setting castingcolor externally. How?
 
I was browsing UIs when I came across LUI, which does something interesting with Quartz--it uses a kgpanels script to set the Latency indicator color to your class color. "Cool," I thought. "I want to adapt that to set the whole bar the class color."

So here's what I have in my kgpanels script, adapted from the LUI compilation:

Code:

local class = UnitClass("player")
lagVertexColor = {RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, 1}

local db = Quartz:AcquireDBNamespace("Latency")
db.profile.lagcolor=lagVertexColor
db.profile.lagalpha=1
Quartz.ApplySettings()

This works just fine--it changes the LATENCY indicator color as intended.

Now, I'm not all that incredible with scripting just yet, but I poked around Quartz's code to see how I could change this to change castingcolor (the variable name for the regular casting bar color). I can't figure it out. It doesn't seem to be working with the AcquireDBNamespace, because this particular variable is NOT stored in any particular namespace at all in the SavedVariables. So, I'm stumped and would really appreciate if I could get a bit of help.

Teach a lady to fish and all that. :)

Thanks in advance.

Marroc 11-25-09 05:02 PM

Code:

local class = UnitClass("player")
playerVertexColor = {RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, 1}

local db = Quartz:AcquireDBNamespace("Player")
db.profile.playercolor=playerVertexColor
db.profile.playeralpha=1
Quartz.ApplySettings()

Should do it.

edit:
on second thought, maybe not... After looking around in Quartz's code, it appears that there are no color options for the player cast bar at all. (ie. the Quartz_Latency addon has a color variable, but Quartz_Player does not).

Shanyn 11-25-09 05:07 PM

Thanks! Sadly, no. There is no such variable as playercolor in Quartz.

Here is how the player cast bar is colored in Quartz's Player.lua:
Code:

castBar:SetStatusBarColor(unpack(Quartz.db.profile.castingcolor))
I'm absolutely certain that the variable I want is called castingcolor (i.e. not playercolor), but so far no variation of db.profile.castingcolor = lagVertexColor has worked at all. My only guess is because castingcolor is NOT defined under any namespace in the SavedVariables file, therefore none of the local db = Quartz:AcquireDBNamespace("StuffGoesHere") gives me the castingcolor variable to play with. This is what I'm looking for help on. ^^;

Edit: To show what I mean about castingcolor not being defined under a namespace, here's a very abbreviated sampling of the SavedVariables--
Code:

QuartzDB = {
  ["namespaces"] = {
      ["Latency"] = {
        ["profiles"] = {
            ["profilename"] = {
              lagcolor = some numbers
            }
        }
      }
  }
  ["profiles"] = {
      ["profilename"] = {
        ["castingcolor"] = some numbers
      }
  }
}


harrellj 11-25-09 06:16 PM

As a coder, but not LUA capable or having a copy of Quartz's code to look at, instead of using AcquireDBNamespace, what about AcquireDBProfile("Player")?

Shanyn 11-25-09 06:21 PM

Tried it and a bunch of variations. Nothing. I don't believe the function exists. Thanks for the shot in the dark, at any rate! :)

Edit: Problem solved. On a whim, I decided to try deleting the AcquireDBNamespace bit altogether and just tried Quartz.db.profiles.castingcolor = my variable. It worked. I'm not sure if there's any particular downside to doing it this way--by all means, yell as me if it's going to break wow--but it seems I fixed it. :) Thanks to Marroc and harrellj for offering opinions!


All times are GMT -6. The time now is 10:02 PM.

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