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

Function problems

Started by jarifle, 29 November 2014 - 08:25 AM
jarifle #1
Posted 29 November 2014 - 09:25 AM
Oke so i want a computer control system where everything in my house is shown from it all went good untill i addad a energy cell to the program so now a have a MFSU and a energy cell trying to display on terminal glasses and a monitor.
But if i put a "–" infront of the MFSU function the cell works and if i put a "–" infront of the cell function the MSFU works but without "–" the 1 one displays and the second is ignored.
I really want this system to work and feel free to clean up my code a bit aswell.
Also on the glasses the numbers of RF are wierd.

Here is the code:http://pastebin.com/xARktX0y

PS.Running the fbt modpack monster V1.1.1
Dragon53535 #2
Posted 29 November 2014 - 11:31 AM
Your problem is that you're running each function as a while true do loop

local function Mfsu()
	   while true do --#RIGHT HERE
	    E = net.callRemote("mfsu_0","getEUStored")
	    E2 = E / 40000000*100
	    a = math.floor(E2)
	    text = p.addText(5,15,"Eu Storage.",0xFFFFFF)
	    text = p.addText(5,25,a.."%",0xFFFFFF)
	    m.setCursorPos(1,1)
	    m.setTextScale(2)
	    m.setTextColor(0x800)
	    a = math.floor(E2)
	    m.write("Mfsu:")
	    m.setCursorPos(1,2)
	    m.write(a.."% EU")
	    sleep(1)
end
end


local function Cell()
	   while true do --#Also right here
	   c = net.callRemote("cofh_thermalexpansion_energycell_0","getEnergyStored","north")
	   text2 = p.addText(5,35,"RF storage.",0x4000)
	   text2 = p.addText(5,45,c.."RF",0x4000)
	   m.setCursorPos(1,5)
	   m.setTextColor(0x4000)
	   m.setTextScale(2)
	   m.write("Cell:")
	   m.setCursorPos(1,6)
	   m.write(c.."RF")
end
end
Remove the while true do loops inside those functions, and the associated ends, and your program should work
jarifle #3
Posted 29 November 2014 - 01:58 PM
Ah yes nice thank you

another problem i have aswell is that the numbers on the terminal glasses is a bit buggy u know how to fix that?
jarifle #4
Posted 29 November 2014 - 05:12 PM
. . .
Edited on 29 November 2014 - 09:41 PM