Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This script expects the basalt lib directory to be one directory above it (it should live in the startup directory in the root of the computer)
- local basalt = require("/basalt") --UI Library for cc tweaked
- -- Get a reference to the monitor
- local monitor = peripheral.find("monitor")
- -- Or specific side: peripheral.wrap("right")
- local bridge = peripheral.wrap("meBridge_1")
- local dropper = peripheral.wrap("justdirethings:droppert1_1")
- -- Create frame for monitor
- local monitorFrame = basalt.createFrame():setTerm(monitor) -- :setTerm is the important method here
- local button_bg_color = colors.green
- local button_bg_color_on_click = colors.red
- local toggle_status = true
- local function vend(item_name)
- status_label:setText("Vending "..item_name)
- if item_name == "Bread" then
- bridge.exportItemToPeripheral({name = "minecraft:bread", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Helmet" then
- bridge.exportItemToPeripheral({name = "minecraft:iron_helmet", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Sword" then
- bridge.exportItemToPeripheral({name = "minecraft:iron_sword", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Boots" then
- bridge.exportItemToPeripheral({name = "minecraft:iron_boots", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Chest" then
- bridge.exportItemToPeripheral({name = "minecraft:iron_chestplate", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Legs" then
- bridge.exportItemToPeripheral({name = "minecraft:iron_leggings", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Patch" then
- bridge.exportItemToPeripheral({name = "bhc:red_heart_patch", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Neck" then
- bridge.exportItemToPeripheral({name = "bhc:heart_amulet", count=1}, peripheral.getName(dropper))
- end
- if item_name == "Canister" then
- bridge.exportItemToPeripheral({name = "bhc:red_heart_canister", count=1}, peripheral.getName(dropper))
- end
- status_label:setText("Left Click On Button To Vend Item")
- end
- -- Add elements like normal
- top_banner = monitorFrame:addLabel()
- :setText(utf8.char(127).." Mercs Free Vending "..utf8.char(127))
- :setPosition(4, 1)
- status_label = monitorFrame:addLabel()
- :setText("Left Click On Button To Vend Item")
- :setPosition(1, 17)
- first_button = monitorFrame:addButton()
- :setText("Bread")
- :setWidth(9)
- :setPosition(1, 3)
- :setBackground(button_bg_color)
- :onClick(function()
- vend("Bread")
- end)
- second_button = monitorFrame:addButton()
- :setText(" Helmet")
- :setWidth(9)
- :setPosition(11, 3)
- :setBackground(button_bg_color)
- :onClick(function()
- vend("Helmet")
- end)
- third_button = monitorFrame:addButton()
- :setText("Sword")
- :setWidth(9)
- :setPosition(21, 3)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Sword")
- vend("Sword")
- end)
- fourth_button = monitorFrame:addButton()
- :setText("Legs")
- :setWidth(9)
- :setPosition(1, 7)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Legs")
- vend("Legs")
- end)
- fifth_button = monitorFrame:addButton()
- :setText("Chest")
- :setWidth(9)
- :setPosition(11, 7)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Chest")
- vend("Chest")
- end)
- sixth_button = monitorFrame:addButton()
- :setText("Boots")
- :setWidth(9)
- :setPosition(21, 7)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Boots")
- vend("Boots")
- end)
- seventh_button = monitorFrame:addButton()
- :setText(utf8.char(3).."Patch"..utf8.char(3))
- :setWidth(9)
- :setPosition(1, 11)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Heal Patch")
- vend("Patch")
- end)
- eighth_button = monitorFrame:addButton()
- :setText(utf8.char(3).."Neck"..utf8.char(3))
- :setWidth(9)
- :setPosition(11, 11)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Neck")
- vend("Neck")
- end)
- ninth_button = monitorFrame:addButton()
- :setText(utf8.char(3).."Canister".. utf8.char(3))
- :setWidth(9)
- :setPosition(21, 11)
- :setBackground(button_bg_color)
- :onClick(function()
- status_label:setText("Vending Canister")
- vend("Canister")
- end)
- -- Start Basalt
- basalt.run()
Advertisement
Add Comment
Please, Sign In to add comment