http://pastebin.com/Qg9N4uJ1
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
[SOLVED] Monitors dosent show the color text
Started by Bamse5b, 27 January 2013 - 02:30 AMPosted 27 January 2013 - 03:30 AM
Hey i created a program that counts my stuff going inside my redpower tubes and used a monitor to display it, but the problem is that the code is stuck at 1 and wont raise to 100 so it can change color
http://pastebin.com/Qg9N4uJ1
http://pastebin.com/Qg9N4uJ1
Posted 27 January 2013 - 03:48 AM
I see your code got messed up @ indention(dratted forum engine, right), try uploading it to pastebin and give us a link :)/>
Edited by
Posted 27 January 2013 - 03:53 AM
Fixed :)/>
Posted 27 January 2013 - 04:01 AM
I meant copying the raw code that you pasted into the forum, rather than copying the messed up code that had already been processed by the forum
Posted 27 January 2013 - 04:08 AM
That is the raw code <_</>
I never claimed that im pro either
I never claimed that im pro either
Posted 27 January 2013 - 04:18 AM
So at the line
local event,param1,param2,param3
you have to define what all those variables. I think if you remove that first line your code will run.Posted 27 January 2013 - 04:22 AM
Ive tryed but the number is still blackSo at the lineyou have to define what all those variables. I think if you remove that first line your code will run.local event,param1,param2,param3
Posted 27 January 2013 - 04:22 AM
When you declared itemCount you did it like so:
itemCount = itemCount
Which is essentially the same as saying nil = nil. Start it at a default value like 1 and then check if the file has anything in it and assign that value to itemCount if it does.Posted 27 January 2013 - 04:25 AM
Well it isnt the itemcount thats the problem. Its the "if" that checks if the itemcount is greater than the number i gave it
Posted 27 January 2013 - 04:29 AM
I think you should have local itemCount = 0.
EDIT: I changed it to itemCount = 0 and your code works.
EDIT: Nvm didn't test the color changing thingy.
EDIT: Nvm didn't test the color changing thingy.
Posted 27 January 2013 - 04:31 AM
Tried that dosent work :(/>
Posted 27 January 2013 - 04:34 AM
Okay, I don't know how I missed this.
Your first if statement (if itemCount > 10 then) is always evaluating true because the itemCount is much larger than 10.
The solution to this would be something like the following:
Your first if statement (if itemCount > 10 then) is always evaluating true because the itemCount is much larger than 10.
The solution to this would be something like the following:
if itemCount > 10 and itemCount < 100 then
...
elseif itemCount >100 and itemCount < 1000 then
...
end
Posted 27 January 2013 - 04:43 AM
Switch all your comparison signs so they are facing the other way. So like switch > to <.
Posted 27 January 2013 - 04:44 AM
Thanks alot! It worked!
Okay, I don't know how I missed this.
Your first if statement (if itemCount > 10 then) is always evaluating true because the itemCount is much larger than 10.
The solution to this would be something like the following:if itemCount > 10 and itemCount < 100 then ... elseif itemCount >100 and itemCount < 1000 then ... end