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

Open Peripheral Color Bug

Started by HurricaneCoder, 03 November 2013 - 11:50 PM
HurricaneCoder #1
Posted 04 November 2013 - 12:50 AM
So I have this problem when I restart the program, there is a chance I have this weird color bug with the text.

Here is my code:

local m = peripheral.wrap("left")
local width = 180
local height = 80
m.clear()
local box = m.addBox(10,10,width,height,0xFFFF,0.5)
local text1 = m.addText((((170/4)-string.len(textutils.formatTime(os.time(),false)))/2),70/2,"",0xFFF)
while true do
text1.setScale(4)
text1.setText(textutils.formatTime(os.time(),false))
sleep(.1)
end

This is what happen when the code is restarting the code several time



to

Mackan90096 #2
Posted 04 November 2013 - 01:48 AM
Tell mikee on the IRC about it
HurricaneCoder #3
Posted 04 November 2013 - 01:52 AM
Tell mikee on the IRC about it

I am not sure if it is an actual bug or just my code.
jay5476 #4
Posted 04 November 2013 - 01:54 AM
No it's because you are not setting the z index so sometimes the text will be put behind the box and because the box is lighter the text will become lighter so do

text1.setZIndex(-1) -- negative 1 always in front
I'm not sure if thats the correct function name but I'll look up now
HurricaneCoder #5
Posted 04 November 2013 - 01:56 AM
No it's because you are not setting the z index so sometimes the text will be put behind the box and because the box is lighter the text will become lighter so do

text1.setZIndex(-1) -- negative 1 always in front
I'm not sure if thats the correct function name but I'll look up now

I try setting the zindex and it works perfectly. Thanks.