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 Discussion / INK settings and set text settings not working (Vista)

Author
Message
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 9th Nov 2008 18:55
Okay, I'm working on a program for a school project and I want to change the settings of the text. I try to change setting with such things as ink and set text, but nothing ever works.

P.S. If it matters, the screen does flash at the beginning of every running.

P.P.S I could post the entire code if I need to, butit's pretty big (500-600 lines)

Thanks in advance!

~QJ
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Nov 2008 20:39
hmmmm Are you running dbc as an administrator? Try it, just right click on it and select run as administrator. Sometimes that fixes the problem, though you will need to be an administrator on the computer to do it.

Could you post the code that has the text commands so that we can see whats wrong?

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 9th Nov 2008 22:39
What exactly do you want? The stuff where I set the font and such are just in my basic setup:



~QJ
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Nov 2008 23:40 Edited at: 9th Nov 2008 23:57
@Quirkyjim
That looks fine.
Sounds like you are having sync problems.
Have you set synchronisation to manual (SYNC ON) and have you placed a SYNC command somewhere in your main loop?

P.S. You set the ink colour as rgb(0,0,0) to make it black, but did you know that DB actually stores colours as single integers - black would be 0 - the rgb function calculates the right integer for the colour values you supply, this calculation takes computer time so it's better to use the integer if you know it.

Extra Info: Colour in DB is an integer made up of red, green and blue values, to store these three colours in a single integer each colour is given a different value.
Think of it in the same way our decimal number system works; hundreds are worth 10 tens, tens are worth 10 units. See how each column of the number goes up by 10, that's because the base is 10.
Colours have a base of 256 because a colour can be 0-255 so the hierarchy for colours looks like this: reds are worth 256 greens, greens are worth 256 blues.
So from that we can establish that the RGB function looks something like this...

Sometimes it pays to remember the numbers 65536 and 256, if for instance you wanted a colour that had no red in it you could save the computer from doing the red calculation.
Maybe you will never use these numbers but it's always good to know how things work.

A small program that works is better than a large one that doesn't.

DBC Challenge Rank: Rookie
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Nov 2008 01:03
Just a bit more info: in DBC 1.20, the text settings became more sensitive.

Whenever changing or setting a font, use a character set code after the command. ,1 is for english:

set text font "Times New Roman"
should be
set text font "Times New Roman",1

Whenever you change the text size, there needs to be a refresh or a sync or the size won't take correctly internally:

set text size 15
sync

These should be general rules of thumb even if you are not using DBC version 1.20 . That should maintain compatibility.

Enjoy your day.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 10th Nov 2008 22:25
Okay, i got it to change the font (great tips guys!), but know I'm getting a background color error:

My code looks like this now:


And I end up getting a blue-colored screen that when I input has white around the text. But, the text color IS black.

I think either I'm not understanding something about rgb(), or I've made some other error.

~QJ
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Nov 2008 00:12
You actually don't need a SYNC after every command (in DBC 1.20 a sync seems to be necessary immediately fter set text size though or internally the values don't update). Usually place SYNC at the end of a series of commands when you want everything to be refreshed or updated. Also, SET DISPLAY MODE should be the first command called as it will reset your pen colors and erase your textures. This may be the cause of your color problems but read on for other possibilites. Here's your code revamped a bit:



Quote: "And I end up getting a blue-colored screen that when I input has white around the text"


The blue colored screen is either the result of a CLS command followed by a color command representing blue (for example rgb(0,0,128) ) or you have created a 3D object and the screen color defaults to blue.

The black on white background is do to two things:

1. Somewhere you must've used the command SET TEXT OPAQUE
2. This commands from your code : ink 0, rgb(255,255,255)

If you set the text to to opaque that means the text displayed will be colored in the pen color on top of the background. The INK command takes the inputs INK <pen color>,<opaque text background>

Unless you specifically want your text to be displayed with it's own background color, don't use SET TEXT OPAQUE and use ink as
INK <pen color>,0

The <pen color> also applies to all drawing using DOT, LINE, BOX, ELLIPSE, or CIRCLE (I think that's all of the 2d drawing commands.)

Enjoy your day.
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 15th Nov 2008 15:05
So pretty much, having a cls right before setting the ink settings will mess it up?

And it works now, thanks.

~QJ
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 20:13
Quote: "having a cls right before setting the ink settings will mess it up?"


No, that's not what I meant. I meant the screen may have been blue by using the command

CLS RGB(0,0,255)

or it may have been blue because a 3D command such as MAKE OBJECT or MAKE MATRIX had been used.

The main point is use SET DISPLAY MODE before at the beginning before any other command as it will clear out your video settings including your textures and pen colors; and use SYNC strategically.

Enjoy your day.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 20:14
Quote: "having a cls right before setting the ink settings will mess it up?"


No, that's not what I meant. I meant the screen may have been blue by using the command

CLS RGB(0,0,255)

or it may have been blue because a 3D command such as MAKE OBJECT or MAKE MATRIX had been used.

The main point is use SET DISPLAY MODE before at the beginning before any other command as it will clear out your video settings including your textures and pen colors.

Enjoy your day.

Login to post a reply

Server time is: 2025-06-07 20:25:36
Your offset time is: 2025-06-07 20:25:36