Posted 10 April 2016 - 11:24 AM
i have this code
i was wondering if it could refresh from the to every time the data from d1Stat or d2Stat changed
while true do
term.clear()
term.setCursorPos(1,1)
print("Dust Os")
print("SmartStore 1.0")
x = 1
y = 1
m = peripheral.find("monitor")
m.setTextColor(colors.yellow)
function slow(text, speed) -- slow("Test Text!", 0.2)
for x=1,string.len(text) do
char = string.sub(text,x,x)
m.write(char)
sleep(speed)
end
end
function down()
x = 1
y = y + 1
m.setCursorPos(x,y)
end
d1 = peripheral.wrap("drive_6")
d2 = peripheral.wrap("drive_5")
m.clear()
m.setCursorPos(1,1)
m.setTextScale(3)
m.setBackgroundColor(colors.black)
m.setTextScale(.5)
m.setCursorBlink(true)
slow("Loading")
slow("...", .2)
m.clear()
m.setCursorPos(1,1)
slow("Status:")
down()
sleep(1)
d1Stat = {d1.isDiskPresent(), d1.getDiskLabel(), d1.hasData()}
d2Stat = {d2.isDiskPresent(), d1.getDiskLabel(), d1.hasData()}
slow("Disk 1")
down()
if d1Stat[1] then
m.setTextColor(colors.green)
slow("Disk Present")
down()
m.setTextColor(colors.yellow)
if d1Stat[2] == nil then
m.setTextColor(colors.red)
slow("Label: Nil")
else
m.setTextColor(colors.yellow)
slow("Label: " .. d1Stat[2])
end
down()
if d1Stat[3] then
m.setTextColor(colors.green)
slow("Disk Has Data")
else
m.setTextColor(colors.red)
slow("Disk Is Empty")
end
down()
else
m.setTextColor(colors.red)
slow("Disk Missing", .2)
down()
slow("Nil")
down()
slow("Nil")
down()
end
down()
m.setTextColor(colors.yellow)
slow("Disk 2")
down()
if d2Stat[1] then
m.setTextColor(colors.green)
slow("Disk Present")
down()
m.setTextColor(colors.yellow)
if d2Stat[2] == nil then
m.setTextColor(colors.red)
slow("Label: Nil")
else
m.setTextColor(colors.yellow)
slow("Label: " .. d2Stat[2])
end
down()
if d2Stat[3] then
m.setTextColor(colors.green)
slow("Disk Has Data")
else
m.setTextColor(colors.red)
slow("Disk Is Empty")
end
down()
else
m.setTextColor(colors.red)
slow("Disk Missing")
down()
slow("Nil")
down()
slow("Nil")
end
sleep(100)
end
paste-bin: herei was wondering if it could refresh from the to every time the data from d1Stat or d2Stat changed