You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Friday, June 22nd 2012, 8:24pm

Question about the 9 digit color codes in Healbot

I am reading through the code for Healbot to add the new classes and fix an error. I have found the color codes are listed in 9 digit hex codes as far as I can tell. I have always known about 6 digit hex codes but how do I read and convert the 9 digit codes? The bits I am currently stuck on are below.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function Healbot_HPColor(arg1)
    local per = UnitHealth(arg1) / UnitMaxHealth(arg1);
    if per >= 0.76 then
        return "|cffffffff"
    elseif per <= 0.75 and per >= 0.51 then
        return "|cffffff00"
    elseif per <= 0.50 and per >= 0.26 then
        return "|cffff8800"
    elseif per <= 0.25 and per >= 0.01 then
        return "|cffff0000"
    elseif per < 0.01 then
        Healbot_ShowRes();
        return "|cff000000"
    else
        return "|cffffffff"
    end

I know those are the colors that change the health bars as they decrease so I know what colors they most likely are. I just don't know how to read them. From what I have seen on the net the only thing I can figure out is that the c at the beginning lets Lua know it's a color and the rest is an 8 digit ARGB code with the first 2 digits being the alpha values and the rest being standard RGB hex code. Am I far out in left field with this?

The section that I actually need to apply this info to is below.

Source code

1
2
3
4
5
6
7
8
9
10
local skcol = {
    [1] = "|cff77ccff";    --Priest    lt blue
    [2] = "|cff77cc44";    --Scout     green
    [3] = "|cffbbbbbb";    --Rogue     grey
    [4] = "|cffff6666";    --Warrior     red
    [5] = "|cffdddd33";    --Knight     yellow
    [6] = "|cff5588ff";    --Mage         dk blue
    [7] = "|cff77cc44";    --Warden     green
    [8] = "|cff77cc99";    --Druid     darker green
    [9] = ""; --empty

I need to be able to pick colors for the new classes.

As a bonus question; is there a set class number for the classes? In the code below I have addded the new classes and enumerated them as [9] and [10]. Will this work or is there something I need to find to get the correct number?

Source code

1
2
3
4
5
6
7
8
9
10
11
12
classeZ = {
    [1] = "Priest";
    [2] = "Scout";
    [3] = "Rogue";
    [4] = "Warrior";
    [5] = "Knight";
    [6] = "Mage";
    [7] = "Warden";
    [8] = "Druid";
    [9] = "Champion";
    [10] = "Warlock";
}

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

2

Saturday, June 23rd 2012, 6:09am

Quoted from "Alterios;540225"

I am reading through the code for Healbot to add the new classes and fix an error. I have found the color codes are listed in 9 digit hex codes as far as I can tell. I have always known about 6 digit hex codes but how do I read and convert the 9 digit codes? The bits I am currently stuck on are below.


They aren't 9 digit codes, they are 8 digit codes with a "|c" in front (for color I presume, there is also a "|r" to reset to previous color).

As for the 8 digits themselves, the first 2 are the alpha value (aka, transparency). 00 being fully transparent and ff being fully opaque. The others are the RGB colors as expected. Therefore, the color code becomes:

Source code

1
    |cAARRGGBB

where AA is the two hex digit alpha value, RR is the two hex digit red component, GG is the two hex digit green component and BB is the two hex digit blue component.

As an example, try running this little macro:

Source code

1
/run DEFAULT_CHAT_FRAME:AddMessage("This is |cff0000ffblue|r while this is |cff00ff00green|r. The rest is white",1,1,1)

This will output most of the message in white except for the words blue and green which will appear in the appropriate color. Note the use of the "|r" in here as well.
2013... The year from hell....

3

Saturday, June 23rd 2012, 8:15am

Thanks for the reply. I thought that's what was going on. I was able to fix healbot so that it shows the proper info for the new classes with this info.

Another question I have is; what are the rules on posting changes to an addon if it has an old maintain date? I assume that an attempt to contact the author comes first, but what if there is no response? this is only an issue since so many do not work with the new classes.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

4

Saturday, June 23rd 2012, 1:35pm

Well there aren't any definite rules, but of course contacting the current author or maintainer of the add-on should come first. If the changes are small enough, you can simply post what those changes are (kind of what I did for GridCliqueIt).

In the case of healbot, the project hasn't been updated since Oct. 2010 so it doesn't look as if it is being actively maintained. However, as it has been released to the public domain you can pretty much do whatever you like.

If you are interested in taking over the maintenance of the add-on, again contact the original author and curse.
2013... The year from hell....

5

Saturday, June 23rd 2012, 6:17pm

I'm nowhere good enough for that yet. I wouldn't mind fixing up a lot of the good addons and making one or 2 of my own but I can't get my brain around the main code yet. I can change variables and can understand most of the stuff when it is written already but writing it is still something I don't get. Healbot is a bug piece of coding from my learning level. I might anyway, what's the worse thing that can happen? ;) I had to change too many lines to just post a simple fix for it.

6

Saturday, June 23rd 2012, 9:45pm

Well, I guess I'm a maintainer for Healbot..... you ever get the feeling you jumped in the wrong side of the pool?:eek:

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

7

Sunday, June 24th 2012, 6:34am

Quoted from "Alterios;540456"

Well, I guess I'm a maintainer for Healbot..... you ever get the feeling you jumped in the wrong side of the pool?:eek:

He he... one of the best ways to learn is to dive in and do something. I'd suggest slowly figuring out what each part of the code is doing and see if you can improve and/or clean up the code a bit. Don't bother with adding functionality for now.

[Shameless Plug]
Also, you may want to take a look at my add-on/frame tutorials on the RoM Wiki (start here and then when comfortable, move on to this one). And of course, browse through some of my tutorials and code posted in these forums.
[/Shameless Plug]

Have fun...
2013... The year from hell....