Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Parameter for "rgba" do not match "RBGAColor" at line X

Author
Message
Sam
22
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 18th Jun 2011 06:02 Edited at: 18th Jun 2011 06:05
Hello everyone,

Just need a little help with the rgba command. I get a compiler error every time I try to use the command. I can use rgb fine but not rgba for some reason. I don't even get the DarkBasic Professional Help file when I press F1 while next to the command in the editor. Is this because I don't have an add-on module of some kind installed? If so, which one?

I get the following errors when I try to compile:

i.e.: Parameter for 'rgba' do not match 'RGBAColor' at line 6.
i.e.: Cannot use reserved word 'rgba' as declarations at line 3209.

Can anyone help?

Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 18th Jun 2011 06:55 Edited at: 18th Jun 2011 06:59
I'd reckon it's the space in between "rgba" and "("

so change it to:
myColor = rgba(255,255,255,255)

[edit]

OHHHHH. Sorry - the RGB function isn't like the rgba function. The rgba function isn't even a built-in DBPro command, it's part of a matrix1Utils plugin. "rgba()" returns the alpha component of an argb color.

from the help files:



Why does blue text appear every time you are near?
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 18th Jun 2011 07:10
You can get IanMs great Matrix 1 Utilities Plugin here.

https://forumfiles.thegamecreators.com/download/2192430

If your goal is to change the alpha level as you change the color IanM has his own version of RGB() where the syntax is RGB(Alpha,Red,Green,Blue).

Sam
22
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 18th Jun 2011 11:22 Edited at: 18th Jun 2011 11:39
Interesting thing happened. I installed the Matrix 1 Utilities plugin (copied all the dlls to plugins-user folder). Then tried to compile myColor=rgba(255,255,255,255), but it resulted in the same error (Parameter for 'rgba' do not match 'RGBAColor' at line 6). So I tried myColor=rgb(255,255,255,255) and got another error (Duplicate TRIM$ in StyxCore.dll and Matrix1Util_16.dll!Command in 'StyxCore.dll' command-table unrecognized(TRIM$[%SSS%TrimStr)).

Styx is a DarkBasic Pro plugin I had installed. So I removed all the Styx dlls from the plugins-licensed folder and tried again. The line of code used was myColor=rgb(255,255,255,255) and it worked.

Does this mean there is a bug? And is there a way I can get the myColor=rgba(255,255,255,255) instead of myColor=rgb(255,255,255,255) to work? I am trying to compile the "World of Tanks Demo3a" by Dr Tank. I found it here on the forum. Dr Tank used rgba in his code.

http://forum.thegamecreators.com/?m=forum_view&t=175932&b=8

My version of Dark Basic Professional is 1.0761. Not sure if it has anything to do with me updating to a recent version.

Thanks everyone...
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2011 13:11 Edited at: 18th Jun 2011 13:13
Quote: "tried to compile myColor=rgba(255,255,255,255), but it resulted in the same error "


Well it would wouldn't it? Read Neuro Fuzzy's post again (Edit: and Grog Grueslayer's ). The syntax is

Quote: "Alpha = RGBA ( Colour )"


You have given it four arguments not one. The single parameter "Colour" should be a dword as returned by the rgb() or point() functions for example.
Sam
22
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 18th Jun 2011 13:44 Edited at: 18th Jun 2011 13:51
Yes, alpha=rgba(colour) will compile as long as Styx dlls are not present inside the plugins-licensed folder.

The funny thing is that Dr Tank has used the rgba command in his code a few times with more then one argument. Look for this in his code:



And I am assuming he was able to compile it that way because he also provided an executable along with everything.

I have attached his code for you to see. You can find the entire project and assets here:

http://forum.thegamecreators.com/?m=forum_view&t=175932&b=8

Also, Dr Tank is not the only one using more then one argument. Getix Interactive has used this in his code:



You can take a look at his stuff here:

http://forum.thegamecreators.com/?m=forum_view&t=104849&b=1

Does this mean that the syntax has since changed and more then one argument is no longer supported?

Thanks...
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2011 16:07
Quote: "Does this mean that the syntax has since changed and more then one argument is no longer supported?"


I don't know but it is possible - or the other way round and I've got an old copy. Which version are you using?

However I think it's unlikely as my understanding is that IanM's rgba function was intended to work the same way as the DBPro built-in functions rgbr(), rgbg() and rgbb(), i.e. to extract a particular colour component.

I haven't seen Dr Tank's code but it's possible he defined his own rgba() function. Other people may have done so too.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2011 16:13
Just read your posts again.

I suspect the code you are using has a declaration for an rgba() function. This is what you said:

Quote: "I get the following errors when I try to compile:

i.e.: Parameter for 'rgba' do not match 'RGBAColor' at line 6.
i.e.: Cannot use reserved word 'rgba' as declarations at line 3209.
"


Perhaps you should post that declaration?

For example the following code (just test code obviously) gives that error for me:



That declaration presumably conflicts with the rgba() function in the Matrix1 plugin which I have.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 18th Jun 2011 22:01
yes, a lot of Dr. Tank's code snippets use a function "rgba" defined in his code.

The IanM matrixutils code does NOT work like the code Dr. Tank wrote. Dr Tanks function is something along the lines of:



so it returns a 32-bit color, with 1 byte per color. Ianm's function does the opposite. it takes in a 32 bit color and provides the alpha component of that color:



So, if you have to functions, IanM_rgba, and DrT_rgba, then if you wrote:

n=IanM_rgba(DrT_rgba(1,2,3,4))

the return value would be the alpha component of the color, so n=4. IanM's rgba function accepts one argument, while dr tank's rgba function accepts four arguments. You can't pass four arguments into a 1 argument command, and that's why you get an error. Write your own function!


Why does blue text appear every time you are near?
Sam
22
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 18th Jun 2011 22:11 Edited at: 18th Jun 2011 22:22
You are absolutely correct Green Gandalf. Dr Tank has a declaration in his code that conflicts with rgba().



I simply replaced all the rgba for rgbt (red, green, blue, transparent) and it worked like a charm (similar to Neuro Fuzzy's solution).

Thanks a lot for your insight. And thanks everyone else for their support as well.

Dr Tank's code now compiles fine and I have attached a copy for everyone who would like a working copy. You will need to download the rest of the project and its assets which can be found here:

http://forum.thegamecreators.com/?m=forum_view&t=175932&b=8

Cheers!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Jun 2011 23:53
There's also a function built into my colour plug-in that allows you to specify 4 parameters - it's also called RGB just like the built-in one. The alpha value should be specified as the first value.

Login to post a reply

Server time is: 2026-07-10 22:54:33
Your offset time is: 2026-07-10 22:54:33