Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- -- Setup rednet connection
- local protocolName = "megaleader_mobfarm"
- rednet.open("back")
- -- Draw buttons
- local t = touchpoint.new("top")
- t:add("Blaze", nil, 2, 2, 14, 4)
- t:add("Enderman", nil, 17, 2, 28, 4)
- t:add("Wither sk.", nil, 2, 6, 14, 8)
- t:add("Other 1", nil, 17, 6, 28, 8)
- t:add("Other 2", nil, 2, 10, 14, 12)
- t:add("Pink slime", nil, 17, 10, 28, 12)
- t:add("Global", nil, 2, 14, 28, 16)
- t:draw()
- -- Wait for events
- while true do
- local event, mobId = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t:toggleButton(mobId)
- local receiverMachine = rednet.lookup(protocolName, mobId)
- if receiverMachine == nil then
- print("Machine not found")
- t:toggleButton(mobId)
- else
- print("Toggling machine " ..mobId .."(" .. receiverMachine ..")")
- rednet.send(receiverMachine, t:getActive(mobId), protocolName)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement