Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMO = 0 -- Counter Metal Input
- CES = 0 -- Counter Empty Smeltery
- mouseWidth = 0 -- Create MouseWidth Variable
- mouseHeight = 0 -- Create MouseHeight Variable
- monitor = peripheral.wrap("monitor_1") -- Wrap monitor_0 monitor to "monitor"
- monitor.setBackgroundColour((colors.black)) -- Return to standart color BEFORE clearing the screen
- monitor.clear() -- Clear Monitor
- monitor.setCursorPos(1,1) -- Set Cursor to Pos 1,1
- w,h=monitor.getSize() -- set W to Width of Monitor and H to Height
- print(w) -- Print Width
- print(h) -- Print Height
- monitor.setBackgroundColour((colours.lime)) -- Set monitor Background Color For button creation
- monitor.setCursorPos(2,2)
- monitor.write(" Iron ")
- monitor.setCursorPos(2,4)
- monitor.write(" Invar ")
- monitor.setCursorPos(2,6)
- monitor.write(" Obsidn")
- monitor.setCursorPos(2,8)
- monitor.write(" Gold ")
- monitor.setCursorPos(2,10)
- monitor.write(" Nickel")
- monitor.setCursorPos(2,12)
- monitor.write(" Alminm")
- monitor.setCursorPos(2,14)
- monitor.write(" Tin ")
- monitor.setCursorPos(2,16)
- monitor.write(" Shiny ")
- monitor.setCursorPos(11,2) -- Set Cursor postion to (2,2)
- monitor.write(" Empty ") -- (Write what ever needs to be 7 characters.)
- monitor.setCursorPos(11,4)
- monitor.write(" Copper")
- monitor.setCursorPos(11,6)
- monitor.write(" Lead ")
- monitor.setCursorPos(11,8)
- monitor.write(" Elctrm")
- monitor.setCursorPos(11,10)
- monitor.write(" Alumte")
- monitor.setCursorPos(11,12)
- monitor.write(" Silver")
- monitor.setCursorPos(11,14)
- monitor.write(" Red A ")
- monitor.setCursorPos(11,16)
- monitor.write(" ResEnd")
- monitor.setBackgroundColour((colours.black)) -- Set Background color to black
- function checkClickPosition()
- if mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 2 then
- -- button one clicked
- if CMO == 0 then
- shell.run("Iron") -- Run program IE
- monitor.setBackgroundColour((colours.red)) -- Set Background color red
- monitor.setCursorPos(2,2) -- set cursor pos to rewrite IE
- monitor.write(" Iron ") -- rewrite IE
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime)) -- Set Background color lime
- monitor.setCursorPos(2,2) -- set cursor pos to rewrite IE
- monitor.write(" Iron ") -- rewrite IE
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 4 then
- if CMO == 0 then
- shell.run("Invar")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,4)
- monitor.write(" Invar ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,4)
- monitor.write(" Invar ")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 6 then
- if CMO == 0 then
- shell.run("Obsidian")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,6)
- monitor.write(" Obsidn")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,6)
- monitor.write(" Obsidn")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 8 then
- if CMO == 0 then
- shell.run("Gold")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,8)
- monitor.write(" Gold ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,8)
- monitor.write(" Gold ")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 10 then
- if CMO == 0 then
- shell.run("Nickel")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,10)
- monitor.write(" Nickel")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,10)
- monitor.write(" Nickel")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 12 then
- if CMO == 0 then
- shell.run("Aluminum")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,12)
- monitor.write(" Alminm")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,12)
- monitor.write(" Alminm")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 14 then
- if CMO == 0 then
- shell.run("Tin")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,14)
- monitor.write(" Tin ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,14)
- monitor.write(" Tin ")
- CMO = 0
- end
- elseif mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 16 then
- if CMO == 0 then
- shell.run("Shiny")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(2,16)
- monitor.write(" Shiny ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,16)
- monitor.write(" Shiny ")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 4 then
- if CMO == 0 then
- shell.run("Copper")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,4)
- monitor.write(" Copper")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,4)
- monitor.write(" Copper")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 6 then
- if CMO == 0 then
- shell.run("Lead")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,6)
- monitor.write(" Lead ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,6)
- monitor.write(" Lead ")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 8 then
- if CMO == 0 then
- shell.run("Elctrm")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,8)
- monitor.write(" Elctrm")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,8)
- monitor.write(" Elctrm")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 10 then
- if CMO == 0 then
- shell.run("Alumite")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,10)
- monitor.write(" Alumte")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,10)
- monitor.write(" Alumte")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 12 then
- if CMO == 0 then
- shell.run("Silver")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,12)
- monitor.write(" Silver")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,12)
- monitor.write(" Silver")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 14 then
- if CMO == 0 then
- shell.run("Red")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,14)
- monitor.write(" Red A ")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,14)
- monitor.write(" Red A ")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 16 then
- if CMO == 0 then
- shell.run("ResEnd")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,16)
- monitor.write(" ResEnd")
- CMO = 1
- elseif CMO == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,16)
- monitor.write(" ResEnd")
- CMO = 0
- end
- elseif mouseWidth > 10 and mouseWidth < 18 and mouseHeight == 2 then
- if CES == 0 then
- shell.run("Empty")
- monitor.setBackgroundColour((colours.red))
- monitor.setCursorPos(11,2)
- monitor.write(" Empty ")
- CES = 1
- elseif CES == 1 then
- shell.run("Stop")
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(11,2)
- monitor.write(" Empty ")
- CES = 0
- end
- end -- ends the if loop
- end -- ends the function
- repeat
- event,p1,p2,p3 = os.pullEvent() -- Get Event data. event,p1,p2,p3 from os.pullEvent()
- if event=="monitor_touch" then -- Event Mouse_touch (right click monitor)
- mouseWidth = p2 -- sets mouseWidth -- Set Mouse Width to p2
- mouseHeight = p3 -- and mouseHeight -- Set Mouse Height to p3
- checkClickPosition() -- this runs our function -- Runs the pervious CheckClickPosition Function
- end -- End the IF statement
- until event=="char" and p1==("x") -- Until the event "char" position 1 is X (aka when X is pressed) the programm will loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement