This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
GamerNebulae's profile picture

Text Doesn't Want To Be Colored.

Started by GamerNebulae, 18 August 2013 - 04:27 AM
GamerNebulae #1
Posted 18 August 2013 - 06:27 AM
Hello everyone!

I am working on Nebulae API v2.0 and I was adding functionality to display exact numbers. For some reason it doesn't want to color the text. I'll describe what it does:

First it'll retrieve the numbers (this is done in the function called Math)
Then it sends it to the function which will split in different tables where it will put in dots. (Just like in economy where they do that to make it more readable)
It will concatinate it to a string and send it to function splitText where it will split it in different letters so the function can color it.

The code: http://pastebin.com/21LS9UgT

I have no idea where it goes wrong. I hope you guys can help me. Down here are pictures!

[attachment=1312:1.png]
reububble #2
Posted 18 August 2013 - 06:39 AM
Code snippets would be the best help you can give us.

At the moment I might think you are incorrectly editing the colour, or you are running another program which for some reason, changes the colour back to white.
GamerNebulae #3
Posted 18 August 2013 - 06:49 AM
Code snippets would be the best help you can give us.

At the moment I might think you are incorrectly editing the colour, or you are running another program which for some reason, changes the colour back to white.

OOPS! Forgot to put the pastebin link in here, sorry!
reububble #4
Posted 18 August 2013 - 07:11 AM
It looks like it is doing exactly as you've told it to. Do you want the text to be a different colour, or do you want the background a different colour?
You don't change the text colour at all, so I assume you want to change the background colour.
It does change, it prints out a blue bar, then you tell it to change back to black before you write the (text) on lines 56-59
GamerNebulae #5
Posted 18 August 2013 - 08:26 AM
It looks like it is doing exactly as you've told it to. Do you want the text to be a different colour, or do you want the background a different colour?
You don't change the text colour at all, so I assume you want to change the background colour.
It does change, it prints out a blue bar, then you tell it to change back to black before you write the (text) on lines 56-59

That is for if the length of the bar doesn't reach the text…
Tha70neguy #6
Posted 18 August 2013 - 05:35 PM
Background color is literally that, the color of the background behind the txt.
I see one mon.setTextColor() and it sets the color to white.

When printing the txt you need to change the color each time to what color you want
E.x.

local mon = peripheral.wrap(sSide)
local string = "Text to change color"

for i=1,#string do
     local text = string.sub(string, i, i)
     mon.setCursorPos(i, 1) 
     mon.setTextColor(math.random(2)^math.random(1,16)) --This will grab any color using the binary values
     mon.write(text)
end
GamerNebulae #7
Posted 19 August 2013 - 05:58 AM
Background color is literally that, the color of the background behind the txt.
I see one mon.setTextColor() and it sets the color to white.

When printing the txt you need to change the color each time to what color you want
E.x.

local mon = peripheral.wrap(sSide)
local string = "Text to change color"

for i=1,#string do
	 local text = string.sub(string, i, i)
	 mon.setCursorPos(i, 1)
	 mon.setTextColor(math.random(2)^math.random(1,16)) --This will grab any color using the binary values
	 mon.write(text)
end

How does this help me? I know how to change the background color…
reububble #8
Posted 19 August 2013 - 06:15 AM
He was showing you how to edit the TEXT colour.

mon.setTextColor()