Check out function Dis(), it won't let me call my arguments.
Any general suggestions/tweaks are welcome.
Code
local glass = peripheral.wrap('bottom')
rednet.open('right')
local op = 0.4
bridgeS = "..."
lavaS = "..."
manaS = "..."
local P = {
time = {1,1,55,10, 'box',
box = {0xFFFFFF, op},
text = {textutils.formatTime(os.time(), false), 0x000000}
},
bridge = {60,12,55,10, 'box',
box = {0x397fdb, op},
text = {bridgeS, 0xffffff}
},
lava = {60,1,55,10, 'fluid',
fluid = "lava",
text = {lavaS .. "% Lava", 0xffffff}
},
mana = {1,12,55,10, 'box',
box = {0xff34b3, op},
text = {manaS .. "% Mana", 0xff34b3}
}
}
local function getUpdate()
while true do
local event, ID, mess = os.pullEvent('rednet_message')
if ID == 26 then
manaS = mess
elseif ID == 36 then
lavaS = mess
elseif ID == 16 then
if mess == true then
bridgeS = "Open"
else
bridgeS = "Closed"
end
end
end
end
local function commands()
while true do
local event, e1,e2,e3,e4 = os.pullEvent("glasses_chat_command")
if e4 == "bridge" then
rednet.send(16, "zapp")
end
end
end
local function Dis(tName)
glass.addBox(P.tName[1],P.tName[2],P.tName[3],P.tName[4],P.tName.box[1],P.tName.box[2])
glass.addText(P.tName[1]+5,P.tName[2]+2,P.tName.text[1],P.tName.text[2])
end
function backDis()
glass.addBox(0,0,120,25, 0x000000, op)
end
function updateDis()
while true do
glass.clear()
backDis()
Dis(time)
Dis(mana)
Dis(bridge)
glass.sync()
sleep(.1)
end
end
parallel.waitForAny(updateDis, getUpdate, commands)
Also in function updateDis() I had a for loop to fire off all of the Dis() functions.
for i=1,#P do
Dis(P [ i ] )
end
I realize this won't work because it is calling a table but I'm still looking for a work around.