Posted 19 June 2013 - 10:38 AM
ok i have tried several things in order to get this small program to work. basically this program is connected to other computers with gates on MFSUs and each line is a main and a back up battery, im trying to track the battery and display a certain status up on an advanced monitor. ive tried converting the booleans to strings, and doing a compare that way, ive also tried changing the color around. this is starting to give me a headache and i cannot see what i am doing wrong
the error it is throwing is on line 37 (alot of * to mark the line) and the computer is saying attempt to call string
this is the table the program receives to do the compares
ive hardcoded to convert to string and do compares, but i converted back to booleans to have the program do the compares that way, still having issues
this is the program
the error it is throwing is on line 37 (alot of * to mark the line) and the computer is saying attempt to call string
this is the table the program receives to do the compares
ive hardcoded to convert to string and do compares, but i converted back to booleans to have the program do the compares that way, still having issues
package = {mvOneMain = {isEmpty = true, isFull = true, spaceForEnergy = true},
mvOneBack = {isEmpty = true, isFull = true, spaceForEnergy = true}}
this is the program
MODEM = peripheral.wrap("back")
M = peripheral.wrap("top")
MODEM.open(2424)
x,y = M.getSize()
tri = x/3
package = {}
function draw()
M.clear()
for i=1,3 do
M.setCursorPos((tri*i)-9,1)
if i == 1 then
M.write("- MV 1 -")
elseif i == 2 then
M.write("- MV 2 -")
else
M.write("- LV 1 -")
end
M.setCursorPos((tri*i)-9,4)
M.write("Main")
M.setCursorPos((tri*i)-9,7)
M.write("Backup")
end
end
function e(X,Y,COLOR,TEXT)
M.setCursorPos(X,Y)
M.setBackgroundColor(COLOR)
M.write(" "..TEXT.." ")
M.setBackgroundColor(colors.black)
end
function checkStatus()
if package.mvOneMain.isEmpty == true then
e(4,5,colors.red,"Empty") **************************************************************************************
elseif package.mvOneMain.spaceForEnergy == true then
e(4,5,colors.orange,"Dischargin")
elseif package.mvOneMain.isFull == true then
e(4,5,colors.lime,"Full")
else
e(4,5,colors.grey,"NA")
end
end
while true do
e,side,iC,rC,msg,dist = os.pullEvent("modem_message")
package = textutils.unserialize(msg)
print(type(package.mvOneMain.isEmpty))
draw()
checkStatus()
end