Posted 06 June 2014 - 10:40 AM
hey guys, i could use some help again, i got this program here, its ready and show the Amount of 10 Tanks (using CCsensors), all i want to do now is this:
- As you guys can see on the code below, it prints "Tank of:" then print the variable of the 'Name' atribute of each tank, so if i put Milk on a tank hes gonna print 'Tank of Milk', and them the amount. What i want is to make each word of a color when the variable changes, like when its milk, the word 'Milk' is printed white, if its water it prints blue, etc so this way if i replace the liquid of a tank it will change the word and also the color.
pastebin code:
http://pastebin.com/QVKrBXtD
also i notice something odd, when i take all the liquid from a tank, he does not detect its Amount anymore (it do not detect as '0') so it can send back the Amount data hehe is there a way to bypass this or only by fixing the CCsensor mod?
- As you guys can see on the code below, it prints "Tank of:" then print the variable of the 'Name' atribute of each tank, so if i put Milk on a tank hes gonna print 'Tank of Milk', and them the amount. What i want is to make each word of a color when the variable changes, like when its milk, the word 'Milk' is printed white, if its water it prints blue, etc so this way if i replace the liquid of a tank it will change the word and also the color.
os.loadAPI("ocs/apis/sensor")
os.loadAPI("ocs/apis/graph")
monitor = peripheral.wrap("top")
prox = sensor.wrap("left")
monitor.setBackgroundColor(colors.black)
monitor.clear()
monitor.setTextColor(colors.white)
term.clear()
term.setCursorPos(1,1)
monitor.setTextScale(1.5)
monitor.setCursorPos(6,1)
monitor.write("Liquid Storage Control")
monitor.setCursorPos(1,2)
monitor.write("-----------------------------------------------------------")
while true do
moreDetails = prox.getTargetDetails("-5,0,-3")
monitor.setCursorPos(1,3)
monitor.write("Tank of:")
monitor.setCursorPos(10,3)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,3)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("-5,0,-4")
monitor.setCursorPos(1,4)
monitor.write("Tank of:")
monitor.setCursorPos(10,4)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,4)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("-5,0,-5")
monitor.setCursorPos(1,5)
monitor.write("Tank of:")
monitor.setCursorPos(10,5)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,5)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("-5,0,-6")
monitor.setCursorPos(1,6)
monitor.write("Tank of:")
monitor.setCursorPos(10,6)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,6)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("-5,0,-7")
monitor.setCursorPos(1,7)
monitor.write("Tank of:")
monitor.setCursorPos(10,7)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,7)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("5,0,-3")
monitor.setCursorPos(1,8)
monitor.write("Tank of:")
monitor.setCursorPos(10,8)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,8)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("5,0,-4")
monitor.setCursorPos(1,9)
monitor.write("Tank of:")
monitor.setCursorPos(10,9)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,9)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("5,0,-5")
monitor.setCursorPos(1,10)
monitor.write("Tank of:")
monitor.setCursorPos(10,10)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,10)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("5,0,-6")
monitor.setCursorPos(1,11)
monitor.write("Tank of:")
monitor.setCursorPos(10,11)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,11)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
moreDetails = prox.getTargetDetails("5,0,-7")
monitor.setCursorPos(1,12)
monitor.write("Tank of:")
monitor.setCursorPos(10,12)
monitor.write(moreDetails.Tanks[1].Name)
monitor.setCursorPos(22,12)
monitor.write(moreDetails.Tanks[1].Amount.."mB")
end
pastebin code:
http://pastebin.com/QVKrBXtD
also i notice something odd, when i take all the liquid from a tank, he does not detect its Amount anymore (it do not detect as '0') so it can send back the Amount data hehe is there a way to bypass this or only by fixing the CCsensor mod?