Okay I have the following code:
Basic premise:
I boot up the computer, type in $$power and get a numeric value that increases in realtime. And then I can type in $$clear and clear the EU off the screen. Using a while loop in it to make sure the numeric value is increasing correctly. The text is in there in my failed attempt at debugging... The entering loop flashes on the screen, but the exiting the loop does not.
my hope is that I can have several of these all running within the over-arching while loop. Allowing me to pull up any info I desire (boiler temps, total EU in storage, total MJ in storage, etc) and at the same time clear any of the data I call up off of the screen.
Sooo... Did I miss something in the code? Not take something into account that I should have?
Is there a for sure way to end a while loop? Or is there a different loop that will work that can be ended easily?
Thanks for any help that can be provided...
~Zen
while true do
evt, msg = os.pullEvent()
function energy()
amount = test.callRemote("batbox_0","getStored")amount2 = test.callRemote("batbox_1","getStored")glass.addBox(5,5,70,0xCCCCCC,0.01)total = glass.addText(6,6,"",0xFF0000)total.setText(tostring(amount+amount2).. " EU")end
exitWhile = false
if evt =="chat_command" and msg == "power" then
glass.addText(60,60,"entering loop",0xFF0000)while (not exitWhile) doenergy()if evt == "chat_command" and msg == "clear" thenglass.addText(60,60,"exiting the loop",0xFF0000)exitWhile = trueglass.clear()endsleep(0.1)glass.clear()end
end
end
Basic premise:
I boot up the computer, type in $$power and get a numeric value that increases in realtime. And then I can type in $$clear and clear the EU off the screen. Using a while loop in it to make sure the numeric value is increasing correctly. The text is in there in my failed attempt at debugging... The entering loop flashes on the screen, but the exiting the loop does not.
my hope is that I can have several of these all running within the over-arching while loop. Allowing me to pull up any info I desire (boiler temps, total EU in storage, total MJ in storage, etc) and at the same time clear any of the data I call up off of the screen.
Sooo... Did I miss something in the code? Not take something into account that I should have?
Is there a for sure way to end a while loop? Or is there a different loop that will work that can be ended easily?
Thanks for any help that can be provided...
~Zen