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.

Newcomers DBPro Corner / Ink Command and Constants

Author
Message
Talairina
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 19th Aug 2010 19:27 Edited at: 19th Aug 2010 19:28
I was trying to allow a player to modify the colouring of the text displayed by my program by letting them edit an .ini file. Now the .ini file works flawlessly. It stores and reads the data correctly.

My problem is that when I use the following code (Shortened to show the problem)



I get the following error "Parameter for 'INK' do not match 'Foreground Colour,Background Colour'." I know it's because of the fact INK doesn't seem to like using a variable (string) value that is a constant. At least that's what it seems. I've tried using a integer value without the RGB section within the Constant and that simply dint work at all. So I'm at a loss. Where am I going wrong? Is what I'm trying even possible with the method I've chosen?
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 19th Aug 2010 20:14 Edited at: 19th Aug 2010 20:15
Because the Ink command needs DWORDs instead of strings.

If the file contains the DWORD values, then this would work...



If the file contains strings like "rgb(255,255,255)" or number values like 255,255,255 then you will have to calculate the DWORD value for the constants. Post an example of what's inside the ini file, so we can see what is needed.

Talairina
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 19th Aug 2010 20:51
This is the ini contents. I had a feeling I was going the wrong way about it.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 20th Aug 2010 01:37
Quote: "This is the ini contents. I had a feeling I was going the wrong way about it.
"


Not so! You just have to write the code to interpret the ini values into the correct color values for your program.

You could use if/then statements to find the color, or select case, or put the values in an array, lots of options. Shouldn't be too hard to code at all!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Aug 2010 05:03
It would be easier to let the user totally decide which red, green, blue content for each color rather than set constants that have to be in your code.



LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Aug 2010 17:24 Edited at: 20th Aug 2010 17:25
A suggestion: Why not just declare the colors as global variables?



So many games to code.......so little time.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 25th Aug 2010 17:21
You cant translate strings into variable names in DBP (it'd be really cool if you could though!)

Anyway this:


will not work. You have to do something like this:



or maybe even this:




Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2024-11-24 11:36:50
Your offset time is: 2024-11-24 11:36:50