Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --side of the computer the monitor is on
- monitorSide = "left"
- --side of the computer the modem is on
- modemSide = "right"
- monitor = peripheral.wrap(monitorSide)
- wireless = peripheral.wrap(modemSide)
- modem = peripheral.wrap(modemSide)
- local slot
- -- How long to keep the portal open
- local gateTime = 8
- -- what kind of book is in the Turtle for a specific
- -- slot number, keep it under 10 charcters
- local slot1Name = "Resonant"
- local slot2Name = "Redstone"
- local slot3Name = "Iron"
- local slot4Name = "N. Quartz"
- local slot5Name = "Gold"
- local slot6Name = "Diamond"
- local slot7Name = "Mob Ess."
- local slot8Name = "Huge Trees"
- local slot9Name = "Lava"
- local slot10Name = "Empty"
- local slot11Name = "Empty"
- local slot12Name = "Empty"
- local slot13Name = "Empty"
- local slot14Name = "Empty"
- local slot15Name = "Empty"
- local slot16Name = "Empty"
- local slot17Name = "Empty"
- local slot18Name = "Empty"
- local slot19Name = "Empty"
- local slot20Name = "Empty"
- local slot21Name = "Empty"
- local slot22Name = "Empty"
- local pagesNameUp = "+"
- local pagesNameDown = "-"
- local pages = 1
- channel = 1
- if fs.exists("knob") ~= true then
- shell.run "pastebin get GjVKY7nL knob"
- end
- os.loadAPI("knob") -- loads a custom API
- -- get the custom API ( pastebin get GjVKY7nL knobs)
- -- calls a book
- function sendSlot(slot)
- knob.display()
- modem.open(channel)
- modem.transmit(pages,pages,slot)
- modem.close(channel)
- sleep(gateTime)
- end
- -- tell the Turtle how long to keep the gate open
- function keepOpen(gateTime)
- modem.open(2)
- modem.transmit(2,2,gateTime)
- end
- function Page1Knobs()
- channel = 1
- -- Starts the monitor and sets up the basics
- knob.startUp(monitorSide,1,colors.black,colors.lime)
- knob.header("Select an Age")
- -- adds the knobs to the monitor
- -- function new(name,xMin,xMax,yMin,yMax,text,textColor,bgColor) adds a button
- knob.newKnob("Slot1",2,12,5,7,slot1Name,string.upper(slot1Name),colors.black,colors.blue,colors.blue,colors.black)
- knob.newKnob("Slot2",2,12,9,11,slot2Name,string.upper(slot2Name),colors.black,colors.red,colors.red,colors.black)
- knob.newKnob("Slot3",14,24,5,7,slot3Name,string.upper(slot3Name),colors.black,colors.brown,colors.brown,colors.black)
- knob.newKnob("Slot4",14,24,9,11,slot4Name,string.upper(slot4Name),colors.black,colors.magenta,colors.magenta,colors.black)
- knob.newKnob("Slot5",26,36,5,7,slot5Name,string.upper(slot5Name),colors.black,colors.yellow,colors.yellow,colors.black)
- knob.newKnob("Slot6",26,36,9,11,slot6Name,string.upper(slot6Name),colors.black,colors.cyan,colors.cyan,colors.black)
- knob.newKnob("Slot7",38,48,5,7,slot7Name,string.upper(slot7Name),colors.black,colors.green,colors.green,colors.black)
- knob.newKnob("Slot8",38,48,9,11,slot8Name,string.upper(slot8Name),colors.black,colors.lime,colors.lime,colors.black)
- knob.newKnob("PageUp",36,40,1,3,pagesNameUp,pagesNameUp,colors.black,colors.purple,colors.purple,colors.black)
- knob.setState("Slot1",false)
- knob.setState("Slot2",false)
- knob.setState("Slot3",false)
- knob.setState("Slot4",false)
- knob.setState("Slot5",false)
- knob.setState("Slot6",false)
- knob.setState("Slot7",false)
- knob.setState("Slot8",false)
- knob.setState("PageUp",false)
- -- set them to false
- if knob.getState("Slot1") == true then
- sendSlot(1)
- knob.setState("Slot1",false)
- knob.display()
- elseif knob.getState("Slot2") == true then
- sendSlot(2)
- knob.setState("Slot2",false)
- knob.display()
- elseif knob.getState("Slot3") == true then
- sendSlot(3)
- knob.setState("Slot3",false)
- knob.display()
- elseif knob.getState("Slot4") == true then
- sendSlot(4)
- knob.setState("Slot4",false)
- knob.display()
- elseif knob.getState("Slot5") == true then
- sendSlot(5)
- knob.setState("Slot5",false)
- knob.display()
- elseif knob.getState("Slot6") == true then
- sendSlot(6)
- knob.setState("Slot6",false)
- knob.display()
- elseif knob.getState("Slot7") == true then
- sendSlot(7)
- knob.setState("Slot7",false)
- knob.display()
- elseif knob.getState("Slot8") == true then
- sendSlot(8)
- knob.setState("Slot8",false)
- knob.display()
- elseif knob.getState("PageUp") == true then
- pages = pages + 1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- elseif knob.getState("Pagedown") == true then
- pages = pages -1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- end
- end
- function Page2Knobs()
- channel = 1
- -- Starts the monitor and sets up the basics
- knob.startUp(monitorSide,1,colors.black,colors.lime)
- knob.header("Select an Age")
- -- adds the knobs to the monitor
- -- function new(name,xMin,xMax,yMin,yMax,text,textColor,bgColor) adds a button
- knob.newKnob("Slot9",2,12,5,7,slot9Name,string.upper(slot9Name),colors.black,colors.blue,colors.blue,colors.black)
- knob.newKnob("Slot10",2,12,9,11,slot10Name,string.upper(slot10Name),colors.black,colors.red,colors.red,colors.black)
- knob.newKnob("Slot11",14,24,5,7,slot11Name,string.upper(slot11Name),colors.black,colors.brown,colors.brown,colors.black)
- knob.newKnob("Slot12",14,24,9,11,slot12Name,string.upper(slot12Name),colors.black,colors.magenta,colors.magenta,colors.black)
- knob.newKnob("Slot13",26,36,5,7,slot13Name,string.upper(slot13Name),colors.black,colors.yellow,colors.yellow,colors.black)
- knob.newKnob("Slot14",26,36,9,11,slot14Name,string.upper(slot14Name),colors.black,colors.cyan,colors.cyan,colors.black)
- knob.newKnob("Slot15",38,48,5,7,slot15Name,string.upper(slot15Name),colors.black,colors.green,colors.green,colors.black)
- knob.newKnob("Slot16",38,48,9,11,slot16Name,string.upper(slot16Name),colors.black,colors.lime,colors.lime,colors.black)
- knob.newKnob("Pageup",36,40,1,3,pagesNameUp,pagesNameUp,colors.black,colors.purple,colors.purple,colors.black)
- knob.newKnob("PageDown",44,48,1,3,pagesNameDown,pagesNameDown,colors.black,colors.purple,colors.purple,colors.black)
- knob.setState("Slot9",false)
- knob.setState("Slot10",false)
- knob.setState("Slot11",false)
- knob.setState("Slot12",false)
- knob.setState("Slot13",false)
- knob.setState("Slot14",false)
- knob.setState("Slot15",false)
- knob.setState("Slot16",false)
- knob.setState("Pages",false)
- -- set them to false
- if knob.getState("Slot9") == true then
- sendSlot(9)
- knob.setState("Slot9",false)
- knob.display()
- elseif knob.getState("Slot10") == true then
- sendSlot(10)
- knob.setState("Slot10",false)
- knob.display()
- elseif knob.getState("Slot11") == true then
- sendSlot(11)
- knob.setState("Slot11",false)
- knob.display()
- elseif knob.getState("Slot12") == true then
- sendSlot(12)
- knob.setState("Slot12",false)
- knob.display()
- elseif knob.getState("Slot13") == true then
- sendSlot(13)
- knob.setState("Slot13",false)
- knob.display()
- elseif knob.getState("Slot14") == true then
- sendSlot(14)
- knob.setState("Slot14",false)
- knob.display()
- elseif knob.getState("Slot15") == true then
- sendSlot(15)
- knob.setState("Slot15",false)
- knob.display()
- elseif knob.getState("Slot16") == true then
- sendSlot(16)
- knob.setState("Slot16",false)
- knob.display()
- elseif knob.getState("PageUp") == true then
- pages = pages + 1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- elseif knob.getState("Pagedown") == true then
- pages = pages -1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- end
- end
- function Page3Knobs()
- channel = 5
- -- Starts the monitor and sets up the basics
- knob.startUp(monitorSidmonitorSide,1,colors.black,colors.lime)
- knob.header("Select an Age")
- -- adds the knobs to the monitor
- -- function new(name,xMin,xMax,yMin,yMax,text,textColor,bgColor) adds a button
- knob.newKnob("Slot17",2,12,5,7,slot9Name,string.upper(slot9Name),colors.black,colors.blue,colors.blue,colors.black)
- knob.newKnob("Slot18",2,12,9,11,slot10Name,string.upper(slot10Name),colors.black,colors.red,colors.red,colors.black)
- knob.newKnob("Slot19",14,24,5,7,slot11Name,string.upper(slot11Name),colors.black,colors.brown,colors.brown,colors.black)
- knob.newKnob("Slot20",14,24,9,11,slot12Name,string.upper(slot12Name),colors.black,colors.magenta,colors.magenta,colors.black)
- knob.newKnob("Slot21",26,36,5,7,slot13Name,string.upper(slot13Name),colors.black,colors.yellow,colors.yellow,colors.black)
- knob.newKnob("Slot22",26,36,9,11,slot14Name,string.upper(slot14Name),colors.black,colors.cyan,colors.cyan,colors.black)
- knob.newKnob("PageDown",44,48,1,3,pagesNameDown,pagesNameDown,colors.black,colors.purple,colors.purple,colors.black)
- knob.setState("Slot17",false)
- knob.setState("Slot18",false)
- knob.setState("Slot19",false)
- knob.setState("Slot20",false)
- knob.setState("Slot21",false)
- knob.setState("Slot22",false)
- knob.setState("PageDown",false)
- -- set them to false
- if knob.getState("Slot17") == true then
- sendSlot(17)
- knob.setState("Slot17",false)
- knob.display()
- elseif knob.getState("Slot18") == true then
- sendSlot(18)
- knob.setState("Slot18",false)
- knob.display()
- elseif knob.getState("Slot19") == true then
- sendSlot(19)
- knob.setState("Slot19",false)
- knob.display()
- elseif knob.getState("Slot20") == true then
- sendSlot(20)
- knob.setState("Slot20",false)
- knob.display()
- elseif knob.getState("Slot21") == true then
- sendSlot(21)
- knob.setState("Slot21",false)
- knob.display()
- elseif knob.getState("Slot22") == true then
- sendSlot(22)
- knob.setState("Slot22",false)
- knob.display()
- elseif knob.getState("PageUp") == true then
- pages = pages + 1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- elseif knob.getState("Pagedown") == true then
- pages = pages -1
- if pages == 1 then
- Page1Knobs()
- elseif pages==2 then
- Page2Knobs()
- elseif pages == 3 then
- Page3Knobs()
- end
- end
- end
- knob.startUp(monitorSide,1,colors.black,colors.lime)
- while true do
- knob.header("Select an Age")
- Page1Knobs()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement