Posts: 811
Threads: 128
Joined: Apr 2022
Reputation:
135
I've noticed only _RGB32 colors can be assigned using CONST, not _RGB ones. Is this a bug?
'these aren't allowed...
Const bgcolor1~& = _RGB(50, 50, 50)
Const bgcolor2~& = _RGBA(50, 50, 50, 50)
'these are allowed...
Const bgcolor3~& = _RGB32(50, 50, 50)
Const bgcolor4~& = _RGBA32(50, 50, 50, 50)
- Dav
Posts: 4,695
Threads: 222
Joined: Apr 2022
Reputation:
322
12-11-2025, 07:48 PM
(This post was last modified: 12-11-2025, 07:51 PM by bplus.)
(12-11-2025, 07:43 PM)Dav Wrote: I've noticed only _RGB32 colors can be assigned using CONST, not _RGB ones. Is this a bug?
'these aren't allowed...
Const bgcolor1~& = _RGB(50, 50, 50)
Const bgcolor2~& = _RGBA(50, 50, 50, 50)
'these are allowed...
Const bgcolor3~& = _RGB32(50, 50, 50)
Const bgcolor4~& = _RGBA32(50, 50, 50, 50)
- Dav
Check the Type _RGB and _RGBA come in I am pretty sure it is NOT Unsigned Long like _RGB32 and _RGBA32 are, maybe just Long?
Update: Help says Long type but shows example with myColor~& = _RGB(blah, blah, blah) so why is that?
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 811
Threads: 128
Joined: Apr 2022
Reputation:
135
I'm not sure, I can't seem to assign a _RGB color with CONST using a variable name.
I gotta jet to a concert now, but I'm sure when I get back I will have see I've embarrassed myself again with an idiot mistake. lol. Thanks for the quick reply bplus...
- Dav
Posts: 4,695
Threads: 222
Joined: Apr 2022
Reputation:
322
12-11-2025, 08:02 PM
(This post was last modified: 12-11-2025, 08:04 PM by bplus.)
I just plugged in first line to test, only the _RGB and IDE says wrong number of arguments???
I add a 4th = 0 on the end and all is well.
This is OK:
Code: (Select All) Const bgcolor1~& = _RGB(50, 50, 50, 0)
Const bgcolor2& = _RGBA(50, 50, 50, 50, 0)
the missing number is image handle, 0 for current screen I think. Apparently the optional screen handle is NOT Optional in Const???
Doesn't seem like stupid mistake, Const use smells funky
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 902
Threads: 38
Joined: Apr 2022
Reputation:
72
12-11-2025, 08:04 PM
(This post was last modified: 12-11-2025, 08:05 PM by SpriggsySpriggs.)
Hey, Dav. I tried it on my PC and got the same issue. However, I noticed another bug as well. If you rename your top two consts to just bgcolor and give them the same values you had before, (obviously commenting out one or the other because you can't have two of the same name), the IDE will give an error about the wrong number of arguments for those functions! For some reason, when used in const, the IDE enforces the 4th optional argument!
Now, add the 4th argument...:
The noticing will continue
Posts: 4,695
Threads: 222
Joined: Apr 2022
Reputation:
322
12-11-2025, 08:10 PM
(This post was last modified: 12-11-2025, 08:11 PM by bplus.)
(12-11-2025, 08:04 PM)SpriggsySpriggs Wrote: Hey, Dav. I tried it on my PC and got the same issue. However, I noticed another bug as well. If you rename your top two consts to just bgcolor and give them the same values you had before, (obviously commenting out one or the other because you can't have two of the same name), the IDE will give an error about the wrong number of arguments for those functions! For some reason, when used in const, the IDE enforces the 4th optional argument!
Now, add the 4th argument...:
But try the last 2 lines without the first 2 and back to missing argument thing again??
I say its a bug but Steve will tell us it is a feature LOL!
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 26
Threads: 2
Joined: Apr 2022
Reputation:
2
12-11-2025, 09:24 PM
(This post was last modified: 12-11-2025, 09:25 PM by ChiaPet.
Edit Reason: typo
)
The missing 4rth argument is alpha (transparency), I think.
Posts: 3,446
Threads: 376
Joined: Apr 2022
Reputation:
345
12-11-2025, 10:28 PM
(This post was last modified: 12-11-2025, 10:40 PM by SMcNeill.)
Allow me to clarify this for everyone with a few simple questions and answers.
RED = _RGB(255, 0, 0)
Now, somebody tell me what number that RED is. Anyone. Please!
With the information provided above, you absolutely can't tell me what that value is.
In SCREEN 0, it would be color 4.
In SCREEN 13, it would be color 40.
In SCREEN _NEWIMAGE(x, y, 256), it would be 40.
In SCREEN _NEWIMAGE(x, y, 32), it would be &HFFFF0000~&.
By itself, it's... undefined. Impossible to calculate. It's NAN, if it's anything.
You have to know the SCREEN mode to be able to determine what that color number is.
_RGB is a transformative function which returns a value based upon the screen mode it's associated with.
So when we do this:
CONST RED = _RGB(255, 0, 0)
What screen is that associated with? Is your red on a SCREEN 0 text screen? OR are you looking for red on a 256 color screen? How about on SCREEN 7? How the BLEEP is CONST supposed to know that???
---------
So.... How would one fix this?
Wouldn't you simply SPECIFY THE SCREEN MODE??
CONST RED = _RGB(255, 0, 0, 0) 'This is color 4, because it's on SCREEN 0 as defined in that last parameter.
CONST RED = _RGB(255, 0, 0, 256) 'This is color 40, because it's on a 256 color screen.
You need an extra parameter with _RGB and CONST to specify the screen mode from which you want to get your color value.
@bplus was close when he said he thought it was an image handle, but it's not an image handle. It's the SCREEN MODE.
And _RGB32 doesn't have this same need to specify a screen mode as it *ONLY* returns values for a 32-bit color screen.
So this is *not* a bug. It's a design feature so you can specify which screen mode you want to use _RGB with and associate those values with for the proper color match on that screen mode.
Posts: 3,446
Threads: 376
Joined: Apr 2022
Reputation:
345
Example for folks to quickly run and test:
Code: (Select All)
Const Red0 = _RGB(255, 0, 0, 0) 'Screen 0
Print Red0
Const Red12 = _RGB(255, 0, 0, 12) 'Screen 12
Print Red12
Const Red13 = _RGB(255, 0, 0, 13) 'Screen 13
Print Red13
Const Red256 = _RGB(255, 0, 0, 256) 'Screen 256
Print Red256
Const Red32 = _RGB(255, 0, 0, 32) 'Screen 32
Print " "; Hex$(Red32)
Posts: 4,695
Threads: 222
Joined: Apr 2022
Reputation:
322
12-11-2025, 10:41 PM
(This post was last modified: 12-11-2025, 10:43 PM by bplus.)
LOL told you it's going to be a feature!
But if the 4th parameter is supposed to be Screen Mode then somebody better update the Wiki because there it says ImageHandle&.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
|