Posted 07 September 2013 - 08:19 PM
Hey guys. So i was just playing around with the terminal glasses from the OpenPeripherals addon. This program should list all connected users (which it does fine as far as I can tell), and then wrap to the firebox to the left of it. Everything seems to be working, except my IF statement. The "boilerInfo" box color does not update and the "boilerFuel" text does not update. I can't figure out what I'm doing wrong…
Please help. Keep in mind this was just a test program. I'm trying to really grasp what this mod can do and eventually plan on using in to display and control multiple things, but this should just do the two listed above.
here's the pastebin file: http://pastebin.com/BHrM4HfY
and the code:
Please help. Keep in mind this was just a test program. I'm trying to really grasp what this mod can do and eventually plan on using in to display and control multiple things, but this should just do the two listed above.
here's the pastebin file: http://pastebin.com/BHrM4HfY
and the code:
Spoiler
--Glasses testing program
--Peripheral wrapping:
glass = peripheral.wrap("right")
boiler = peripheral.wrap("left")
--Variable definition
name1 = boiler.getInvName()
while true do
glass.clear()
users = glass.getUsers()
local y = 25
for k, v in pairs(users) do
glass.addText( y, 50, tostring(v), 0xffffff )
y = y + 10
end
usertitle = glass.addText( 15, 42, "Connected Users:", 0xffffff )
boilerInfo = glass.addBox( 12, 295, glass.getStringWidth(name1)+7 , 34, 0xffffff, .15)
boilerTitle = glass.addText( 15, 300 , name1..":", 0 )
boilerTemp = glass.addText( 20, 310, "Temp: "..boiler.getTemperature(), 0 )
sleep(.1)
local refuel = boiler.needsFuel()
sleep(.1)
if refuel == TRUE
then
boilerFuel = glass.addText( 20, 320, "Needs Fuel!!", 0 )
boilerInfo.delete()
boilerInfo = glass.addBox( 12, 295, glass.getStringWidth(name1)+7, 34, 0xfb0000, .15)
sleep(5)
else
boilerFuel.setText("Fueled")
boilerInfo.setColor( 0xffffff )
end
sleep(.5)
end