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

[SOLVED] Monitors dosent show the color text

Started by Bamse5b, 27 January 2013 - 02:30 AM
Bamse5b #1
Posted 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
Doyle3694 #2
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
Bamse5b #3
Posted 27 January 2013 - 03:53 AM
Fixed :)/>
Doyle3694 #4
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
Bamse5b #5
Posted 27 January 2013 - 04:08 AM
That is the raw code <_</>
I never claimed that im pro either
lieudusty #6
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.
Bamse5b #7
Posted 27 January 2013 - 04:22 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.
Ive tryed but the number is still black
Bubba #8
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.
Bamse5b #9
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
lieudusty #10
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.
Bamse5b #11
Posted 27 January 2013 - 04:31 AM
Tried that dosent work :(/>
Bubba #12
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:


  if itemCount > 10 and itemCount < 100 then
   ...
  elseif itemCount >100 and itemCount < 1000 then
  ...
  end
lieudusty #13
Posted 27 January 2013 - 04:43 AM
Switch all your comparison signs so they are facing the other way. So like switch > to <.
Bamse5b #14
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