Posted 09 June 2014 - 11:49 AM
ok so when i run this code, the computer shuts down after 10 seconds which leads me to believe it is a gps error.
however i dont know what is wrong with it.
could someone please point out what is happening so i can fix it
also here are the door files.
xDoor
yDoor
zDoor
Thanks
however i dont know what is wrong with it.
could someone please point out what is happening so i can fix it
Spoiler
local modem = peripheral.wrap("back")
local x, y, z = gps.locate(10)
local doorOpen = false
local xFile = fs.open("doors/xDoor", "r")
local yFile = fs.open("doors/yDoor", "r")
local zFile = fs.open("doors/zDoor", "r")
local xDoor = textutils.unserialize(xFile.readAll())
local yDoor = textutils.unserialize(yFile.readAll())
local zDoor = textutils.unserialize(zFile.readAll())
xFile.close()
yFile.close()
zFile.close()
function table.contains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
while true do
if table.contains(xDoor, x) and table.contains(yDoor, y) and table.contains(zDoor, z) and doorOpen == false then
modem.transmit(1, 2, "open")
print("Opening")
doorOpen = true
elseif doorOpen == true then
modem.transmit(1, 2, "close")
print("Closing")
doorOpen = false
end
end
also here are the door files.
xDoor
Spoiler
{
44,
44.01,
44.02,
44.03,
44.04,
44.05,
44.06,
44.07,
44.08,
44.09,
44.1,
44.11,
44.12,
44.13,
44.14,
44.15,
44.16,
44.17,
44.18,
44.19,
44.2,
44.21,
44.22,
44.23,
44.24,
44.25,
44.26,
44.27,
44.28,
44.29,
44.3,
44.31,
44.32,
44.33,
44.34,
44.35,
44.36,
44.37,
44.38,
44.39,
44.4,
44.41,
44.42,
44.43,
44.44,
44.45,
44.46,
44.47,
44.48,
44.49,
44.5,
44.51,
44.52,
44.53,
44.54,
44.55,
44.56,
44.57,
44.58,
44.59,
44.6,
44.61,
44.62,
44.63,
44.64,
44.65,
44.66,
44.67,
44.68,
44.69,
44.7,
44.71,
44.72,
44.73,
44.74,
44.75,
44.76,
44.77,
44.78,
44.79,
44.8,
44.81,
44.82,
44.83,
44.84,
44.85,
44.86,
44.87,
44.88,
44.89,
44.9,
44.91,
44.92,
44.93,
44.94,
44.95,
44.96,
44.97,
44.98,
44.99,
45.0,
45.01,
45.02,
45.03,
45.04,
45.05,
45.06,
45.07,
45.08,
45.09,
45.1,
45.11,
45.12,
45.13,
45.14,
45.15,
45.16,
45.17,
45.18,
45.19,
45.2,
45.21,
45.22,
45.23,
45.24,
45.25,
45.26,
45.27,
45.28,
45.29,
45.3,
45.31,
45.32,
45.33,
45.34,
45.35,
45.36,
45.37,
45.38,
45.39,
45.4,
45.41,
45.42,
45.43,
45.44,
45.45,
45.46,
45.47,
45.48,
45.49,
45.5,
45.51,
45.52,
45.53,
45.54,
45.55,
45.56,
45.57,
45.58,
45.59,
45.6,
45.61,
45.62,
45.63,
45.64,
45.65,
45.66,
45.67,
45.68,
45.69,
45.7,
45.71,
45.72,
45.73,
45.74,
45.75,
45.76,
45.77,
45.78,
45.79,
45.8,
45.81,
45.82,
45.83,
45.84,
45.85,
45.86,
45.87,
45.88,
45.89,
45.9,
45.91,
45.92,
45.93,
45.94,
45.95,
45.96,
45.97,
45.98,
45.99,
46.0,
46.01,
46.02,
46.03,
46.04,
46.05,
46.06,
46.07,
46.08,
46.09,
46.1,
46.11,
46.12,
46.13,
46.14,
46.15,
46.16,
46.17,
46.18,
46.19,
46.2,
46.21,
46.22,
46.23,
46.24,
46.25,
46.26,
46.27,
46.28,
46.29,
46.3,
46.31,
46.32,
46.33,
46.34,
46.35,
46.36,
46.37,
46.38,
46.39,
46.4,
46.41,
46.42,
46.43,
46.44,
46.45,
46.46,
46.47,
46.48,
46.49,
46.5,
46.51,
46.52,
46.53,
46.54,
46.55,
46.56,
46.57,
46.58,
46.59,
46.6,
46.61,
46.62,
46.63,
46.64,
46.65,
46.66,
46.67,
46.68,
46.69,
46.7,
46.71,
46.72,
46.73,
46.74,
46.75,
46.76,
46.77,
46.78,
46.79,
46.8,
46.81,
46.82,
46.83,
46.84,
46.85,
46.86,
46.87,
46.88,
46.89,
46.9,
46.91,
46.92,
46.93,
46.94,
46.95,
46.96,
46.97,
46.98,
46.99,
47.0,
47.01,
47.02,
47.03,
47.04,
47.05,
47.06,
47.07,
47.08,
47.09,
47.1,
47.11,
47.12,
47.13,
47.14,
47.15,
47.16,
47.17,
47.18,
47.19,
47.2,
47.21,
47.22,
47.23,
47.24,
47.25,
47.26,
47.27,
47.28,
47.29,
47.3,
47.31,
47.32,
47.33,
47.34,
47.35,
47.36,
47.37,
47.38,
47.39,
47.4,
47.41,
47.42,
47.43,
47.44,
47.45,
47.46,
47.47,
47.48,
47.49,
47.5,
47.51,
47.52,
47.53,
47.54,
47.55,
47.56,
47.57,
47.58,
47.59,
47.6,
47.61,
47.62,
47.63,
47.64,
47.65,
47.66,
47.67,
47.68,
47.69,
47.7,
47.71,
47.72,
47.73,
47.74,
47.75,
47.76,
47.77,
47.78,
47.79,
47.8,
47.81,
47.82,
47.83,
47.84,
47.85,
47.86,
47.87,
47.88,
47.89,
47.9,
47.91,
47.92,
47.93,
47.94,
47.95,
47.96,
47.97,
47.98,
47.99,
48.0,
48.01,
48.02,
48.03,
48.04,
48.05,
48.06,
48.07,
48.08,
48.09,
48.1,
48.11,
48.12,
48.13,
48.14,
48.15,
48.16,
48.17,
48.18,
48.19,
48.2,
48.21,
48.22,
48.23,
48.24,
48.25,
48.26,
48.27,
48.28,
48.29,
48.3,
48.31,
48.32,
48.33,
48.34,
48.35,
48.36,
48.37,
48.38,
48.39,
48.4,
48.41,
48.42,
48.43,
48.44,
48.45,
48.46,
48.47,
48.48,
48.49,
48.5,
48.51,
48.52,
48.53,
48.54,
48.55,
48.56,
48.57,
48.58,
48.59,
48.6,
48.61,
48.62,
48.63,
48.64,
48.65,
48.66,
48.67,
48.68,
48.69,
48.7,
48.71,
48.72,
48.73,
48.74,
48.75,
48.76,
48.77,
48.78,
48.79,
48.8,
48.81,
48.82,
48.83,
48.84,
48.85,
48.86,
48.87,
48.88,
48.89,
48.9,
48.91,
48.92,
48.93,
48.94,
48.95,
48.96,
48.97,
48.98,
48.99,
49.0,
49.01,
49.02,
49.03,
49.04,
49.05,
49.06,
49.07,
49.08,
49.09,
49.1,
49.11,
49.12,
49.13,
49.14,
49.15,
49.16,
49.17,
49.18,
49.19,
49.2,
49.21,
49.22,
49.23,
49.24,
49.25,
49.26,
49.27,
49.28,
49.29,
49.3,
49.31,
49.32,
49.33,
49.34,
49.35,
49.36,
49.37,
49.38,
49.39,
49.4,
49.41,
49.42,
49.43,
49.44,
49.45,
49.46,
49.47,
49.48,
49.49,
49.5,
49.51,
49.52,
49.53,
49.54,
49.55,
49.56,
49.57,
49.58,
49.59,
49.6,
49.61,
49.62,
49.63,
49.64,
49.65,
49.66,
49.67,
49.68,
49.69,
49.7,
49.71,
49.72,
49.73,
49.74,
49.75,
49.76,
49.77,
49.78,
49.79,
49.8,
49.81,
49.82,
49.83,
49.84,
49.85,
49.86,
49.87,
49.88,
49.89,
49.9,
49.91,
49.92,
49.93,
49.94,
49.95,
49.96,
49.97,
49.98,
49.99,
50.0,
}
yDoor
Spoiler
{
62,
62.01,
62.02,
62.03,
62.04,
62.05,
62.06,
62.07,
62.08,
62.09,
62.1,
62.11,
62.12,
62.13,
62.14,
62.15,
62.16,
62.17,
62.18,
62.19,
62.2,
62.21,
62.22,
62.23,
62.24,
62.25,
62.26,
62.27,
62.28,
62.29,
62.3,
62.31,
62.32,
62.33,
62.34,
62.35,
62.36,
62.37,
62.38,
62.39,
62.4,
62.41,
62.42,
62.43,
62.44,
62.45,
62.46,
62.47,
62.48,
62.49,
62.5,
62.51,
62.52,
62.53,
62.54,
62.55,
62.56,
62.57,
62.58,
62.59,
62.6,
62.61,
62.62,
62.63,
62.64,
62.65,
62.66,
62.67,
62.68,
62.69,
62.7,
62.71,
62.72,
62.73,
62.74,
62.75,
62.76,
62.77,
62.78,
62.79,
62.8,
62.81,
62.82,
62.83,
62.84,
62.85,
62.86,
62.87,
62.88,
62.89,
62.9,
62.91,
62.92,
62.93,
62.94,
62.95,
62.96,
62.97,
62.98,
62.99,
63.0,
63.01,
63.02,
63.03,
63.04,
63.05,
63.06,
63.07,
63.08,
63.09,
63.1,
63.11,
63.12,
63.13,
63.14,
63.15,
63.16,
63.17,
63.18,
63.19,
63.2,
63.21,
63.22,
63.23,
63.24,
63.25,
63.26,
63.27,
63.28,
63.29,
63.3,
63.31,
63.32,
63.33,
63.34,
63.35,
63.36,
63.37,
63.38,
63.39,
63.4,
63.41,
63.42,
63.43,
63.44,
63.45,
63.46,
63.47,
63.48,
63.49,
63.5,
63.51,
63.52,
63.53,
63.54,
63.55,
63.56,
63.57,
63.58,
63.59,
63.6,
63.61,
63.62,
63.63,
63.64,
63.65,
63.66,
63.67,
63.68,
63.69,
63.7,
63.71,
63.72,
63.73,
63.74,
63.75,
63.76,
63.77,
63.78,
63.79,
63.8,
63.81,
63.82,
63.83,
63.84,
63.85,
63.86,
63.87,
63.88,
63.89,
63.9,
63.91,
63.92,
63.93,
63.94,
63.95,
63.96,
63.97,
63.98,
63.99,
64.0,
64.01,
64.02,
64.03,
64.04,
64.05,
64.06,
64.07,
64.08,
64.09,
64.1,
64.11,
64.12,
64.13,
64.14,
64.15,
64.16,
64.17,
64.18,
64.19,
64.2,
64.21,
64.22,
64.23,
64.24,
64.25,
64.26,
64.27,
64.28,
64.29,
64.3,
64.31,
64.32,
64.33,
64.34,
64.35,
64.36,
64.37,
64.38,
64.39,
64.4,
64.41,
64.42,
64.43,
64.44,
64.45,
64.46,
64.47,
64.48,
64.49,
64.5,
64.51,
64.52,
64.53,
64.54,
64.55,
64.56,
64.57,
64.58,
64.59,
64.6,
64.61,
64.62,
64.63,
64.64,
64.65,
64.66,
64.67,
64.68,
64.69,
64.7,
64.71,
64.72,
64.73,
64.74,
64.75,
64.76,
64.77,
64.78,
64.79,
64.8,
64.81,
64.82,
64.83,
64.84,
64.85,
64.86,
64.87,
64.88,
64.89,
64.9,
64.91,
64.92,
64.93,
64.94,
64.95,
64.96,
64.97,
64.98,
64.99,
65.0,
65.01,
65.02,
65.03,
65.04,
65.05,
65.06,
65.07,
65.08,
65.09,
65.1,
65.11,
65.12,
65.13,
65.14,
65.15,
65.16,
65.17,
65.18,
65.19,
65.2,
65.21,
65.22,
65.23,
65.24,
65.25,
65.26,
65.27,
65.28,
65.29,
65.3,
65.31,
65.32,
65.33,
65.34,
65.35,
65.36,
65.37,
65.38,
65.39,
65.4,
65.41,
65.42,
65.43,
65.44,
65.45,
65.46,
65.47,
65.48,
65.49,
65.5,
65.51,
65.52,
65.53,
65.54,
65.55,
65.56,
65.57,
65.58,
65.59,
65.6,
65.61,
65.62,
65.63,
65.64,
65.65,
65.66,
65.67,
65.68,
65.69,
65.7,
65.71,
65.72,
65.73,
65.74,
65.75,
65.76,
65.77,
65.78,
65.79,
65.8,
65.81,
65.82,
65.83,
65.84,
65.85,
65.86,
65.87,
65.88,
65.89,
65.9,
65.91,
65.92,
65.93,
65.94,
65.95,
65.96,
65.97,
65.98,
65.99,
66.0,
66.01,
66.02,
66.03,
66.04,
66.05,
66.06,
66.07,
66.08,
66.09,
66.1,
66.11,
66.12,
66.13,
66.14,
66.15,
66.16,
66.17,
66.18,
66.19,
66.2,
66.21,
66.22,
66.23,
66.24,
66.25,
66.26,
66.27,
66.28,
66.29,
66.3,
66.31,
66.32,
66.33,
66.34,
66.35,
66.36,
66.37,
66.38,
66.39,
66.4,
66.41,
66.42,
66.43,
66.44,
66.45,
66.46,
66.47,
66.48,
66.49,
66.5,
66.51,
66.52,
66.53,
66.54,
66.55,
66.56,
66.57,
66.58,
66.59,
66.6,
66.61,
66.62,
66.63,
66.64,
66.65,
66.66,
66.67,
66.68,
66.69,
66.7,
66.71,
66.72,
66.73,
66.74,
66.75,
66.76,
66.77,
66.78,
66.79,
66.8,
66.81,
66.82,
66.83,
66.84,
66.85,
66.86,
66.87,
66.88,
66.89,
66.9,
66.91,
66.92,
66.93,
66.94,
66.95,
66.96,
66.97,
66.98,
66.99,
}
zDoor
Spoiler
{
363,
363.01,
363.02,
363.03,
363.04,
363.05,
363.06,
363.07,
363.08,
363.09,
363.1,
363.11,
363.12,
363.13,
363.14,
363.15,
363.16,
363.17,
363.18,
363.19,
363.2,
363.21,
363.22,
363.23,
363.24,
363.25,
363.26,
363.27,
363.28,
363.29,
363.3,
363.31,
363.32,
363.33,
363.34,
363.35,
363.36,
363.37,
363.38,
363.39,
363.4,
363.41,
363.42,
363.43,
363.44,
363.45,
363.46,
363.47,
363.48,
363.49,
363.5,
363.51,
363.52,
363.53,
363.54,
363.55,
363.56,
363.57,
363.58,
363.59,
363.6,
363.61,
363.62,
363.63,
363.64,
363.65,
363.66,
363.67,
363.68,
363.69,
363.7,
363.71,
363.72,
363.73,
363.74,
363.75,
363.76,
363.77,
363.78,
363.79,
363.8,
363.81,
363.82,
363.83,
363.84,
363.85,
363.86,
363.87,
363.88,
363.89,
363.9,
363.91,
363.92,
363.93,
363.94,
363.95,
363.96,
363.97,
363.98,
363.99,
364.0,
364.01,
364.02,
364.03,
364.04,
364.05,
364.06,
364.07,
364.08,
364.09,
364.1,
364.11,
364.12,
364.13,
364.14,
364.15,
364.16,
364.17,
364.18,
364.19,
364.2,
364.21,
364.22,
364.23,
364.24,
364.25,
364.26,
364.27,
364.28,
364.29,
364.3,
364.31,
364.32,
364.33,
364.34,
364.35,
364.36,
364.37,
364.38,
364.39,
364.4,
364.41,
364.42,
364.43,
364.44,
364.45,
364.46,
364.47,
364.48,
364.49,
364.5,
364.51,
364.52,
364.53,
364.54,
364.55,
364.56,
364.57,
364.58,
364.59,
364.6,
364.61,
364.62,
364.63,
364.64,
364.65,
364.66,
364.67,
364.68,
364.69,
364.7,
364.71,
364.72,
364.73,
364.74,
364.75,
364.76,
364.77,
364.78,
364.79,
364.8,
364.81,
364.82,
364.83,
364.84,
364.85,
364.86,
364.87,
364.88,
364.89,
364.9,
364.91,
364.92,
364.93,
364.94,
364.95,
364.96,
364.97,
364.98,
364.99,
365.0,
365.01,
365.02,
365.03,
365.04,
365.05,
365.06,
365.07,
365.08,
365.09,
365.1,
365.11,
365.12,
365.13,
365.14,
365.15,
365.16,
365.17,
365.18,
365.19,
365.2,
365.21,
365.22,
365.23,
365.24,
365.25,
365.26,
365.27,
365.28,
365.29,
365.3,
365.31,
365.32,
365.33,
365.34,
365.35,
365.36,
365.37,
365.38,
365.39,
365.4,
365.41,
365.42,
365.43,
365.44,
365.45,
365.46,
365.47,
365.48,
365.49,
365.5,
365.51,
365.52,
365.53,
365.54,
365.55,
365.56,
365.57,
365.58,
365.59,
365.6,
365.61,
365.62,
365.63,
365.64,
365.65,
365.66,
365.67,
365.68,
365.69,
365.7,
365.71,
365.72,
365.73,
365.74,
365.75,
365.76,
365.77,
365.78,
365.79,
365.8,
365.81,
365.82,
365.83,
365.84,
365.85,
365.86,
365.87,
365.88,
365.88,
365.89,
365.9,
365.91,
365.92,
365.93,
365.94,
365.95,
365.96,
365.97,
365.98,
365.99,
366.0,
}
Thanks