Vice City: Multiplayer

VC:MP Discussion => Support => Bugs and Crashes => Topic started by: [R3V]Kelvin on May 9th, 2021, 11:03 PM

Title: [BUG] Colour() alpha is not set to GUILabel element when used in constructor
Post by: [R3V]Kelvin on May 9th, 2021, 11:03 PM
Description
Using Colour() within a GUILabel element constructor will fail to set label's alpha. Its alpha will always be initialized at 255. However, if you decide to use label.Colour = Colour( r, g, b, a ); or label.Alpha = alpha; it will just work fine.

Reproducible
Always.

What you were doing when the bug happened
Attempting to initialize a GUILabel element with alpha set to 0 using Colour() in its constructor:

Code: [Select]
label <- null;

function Script::ScriptLoad()
{
 ::label = ::GUILabel( ::VectorScreen( ::GUI.GetScreenSize().X * 0.48, ::GUI.GetScreenSize().Y * 0.51 ), ::Colour( 255, 255, 255, 0 ), "Hello there." );
}

(https://i.imgur.com/iKCYyLQ.png)

What you think caused the bug
No idea. This bug seems to be affecting GUILabel elements only.
Title: Re: [BUG] Colour() alpha is not set to GUILabel element when used in constructor
Post by: Razor. on May 18th, 2021, 04:04 PM
Have you tried using label.TextColour?
Title: Re: [BUG] Colour() alpha is not set to GUILabel element when used in constructor
Post by: AdTec_224 on May 19th, 2021, 07:56 AM
I think you're misunderstanding what the colour parameter is for. In this case, colour refers to the colour of the text (and by extension text alpha) and not the alpha value of the overall label.

So simply put:

Code: [Select]
label.Alpha

and:

Code: [Select]
label.Colour

set the alpha (and colour) value of the label itself, whereas the colour parameter in this code:

Code: [Select]
GUILabel(VectorScreen(0, 0), Colour(255, 255, 255, 0), "Colour!");

sets the colour and alpha of the text only, so it's effectively doing the same as:

Code: [Select]
label.TextColour
 

Hope this helps.