Jump to content




Text Doesn't Want To Be Colored.


  • You cannot reply to this topic
7 replies to this topic

#1 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 18 August 2013 - 05: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]

#2 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 18 August 2013 - 05: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.

#3 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 18 August 2013 - 05:49 AM

View Postreububble, on 18 August 2013 - 05:39 AM, said:

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!

#4 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 18 August 2013 - 06: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

#5 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 18 August 2013 - 07:26 AM

View Postreububble, on 18 August 2013 - 06:11 AM, said:

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...

#6 Tha70neguy

  • Members
  • 3 posts

Posted 18 August 2013 - 04: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


#7 GamerNebulae

  • Members
  • 216 posts
  • LocationNetherlands

Posted 19 August 2013 - 04:58 AM

View PostTha70neguy, on 18 August 2013 - 04:35 PM, said:

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...

#8 reububble

  • Members
  • 72 posts
  • LocationBehind you

Posted 19 August 2013 - 05:15 AM

He was showing you how to edit the TEXT colour.

mon.setTextColor()





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users