Posted 24 February 2016 - 10:51 PM
Hello
I need help writing a script…
These are the things i'm using. Lamp, Insulated Wire, Bundled Cable, Advanced Computer, Advanced Monitor.
Here is the example code I got from a post.
Here is my version.
I didn't want to post until I really needed to but this has got me stuck at the moment, if anyone could help that would be great!
I need help writing a script…
These are the things i'm using. Lamp, Insulated Wire, Bundled Cable, Advanced Computer, Advanced Monitor.
Here is the example code I got from a post.
--test
while true do
m = peripheral.wrap("top")
m.clear()
m.setCursorPos(1,1)
m.write("-----Welcome to the station-----")
m.setCursorPos(1,3)
m.write("Blue Line: ")
m.setCursorPos(1,4)
m.write("Yellow Line: ")
m.setCursorPos(1,5)
m.write("Red Line: ")
m.setCursorPos(15,3)
if redstone.getInput("left") then
m.write("Arrived")
else
m.write("Away")
end
m.setCursorPos(15,4)
if redstone.getInput("back") then
m.write("Arrived ")
else
m.write("Away")
end
m.setCursorPos(15,5)
if redstone.getInput("right") then
m.write("Arrived ")
else
m.write("Away")
os.pullEvent("redstone")
end
sleep(1)
end
Here is my version.
-- Test for lamp signal
m = peripheral.wrap("top")
-- Useful functions here
function printCentered(sText)
local w, h = term.getSize()
local x, y = term.getCursorPos()
x = math.max(math.floor((w / 2) - (#sText / 2)), 0)
term.setCursorPos(x, y)
print(sText)
end
function main()
while true do
m = peripheral.wrap("top")
m.clear()
m.setCursorPos(15,1)
m.write("-----Lamp Status-----")
m.setCursorPos(1,3)
m.write("White Lamp: ")
m.setCursorPos(1,4)
m.write("Orange Lamp: ")
m.setCursorPos(1,5)
m.write("Magenta Lamp: ")
m.setCursorPos(12,3)
if redstone.getBundledInput("right", colors.white) then
m.write("On")
else
m.write("Off")
end
m.setCursorPos(13,4)
if redstone.getBundledInput("right", colors.orange) then
m.write("On")
else
m.write("Off")
end
m.setCursorPos(14,5)
if redstone.getBundledInput("right", colors.magenta) then
m.write("On")
else
m.write("Off")
os.pullEvent("redstone")
sleep(5)
end
end
end
main()
I didn't want to post until I really needed to but this has got me stuck at the moment, if anyone could help that would be great!