Last active
October 25, 2017 12:52
-
-
Save artheus/a3e798fc3db5dd861fb9edd51b155c74 to your computer and use it in GitHub Desktop.
mobfarm control script for a ftb server w. opencomputers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API = require("buttonAPI") | |
local event = require("event") | |
local computer = require("computer") | |
local term = require("term") | |
local component = require("component") | |
local gpu = component.gpu | |
local rs = component.redstone | |
local colors = require("colors") | |
local sides = require("sides") | |
function API.fillTable() | |
API.setTable("Lights", toggleLights, 10,20,5,10) | |
API.setTable("Attract", toggleAttract, 25,35,5,10) | |
-- API.setTable("Toggle", test2, 22,32,3,5) | |
-- API.setTable("Free Ram", test3, 10,20,8,10) | |
-- API.setTable("Reboot", test4, 22,32,8,10) | |
API.screen() | |
end | |
function getClick() | |
local _, _, x, y = event.pull(1,touch) | |
if x == nil or y == nil then | |
local h, w = gpu.getResolution() | |
gpu.set(h, w, ".") | |
gpu.set(h, w, " ") | |
else | |
API.checkxy(x,y) | |
end | |
end | |
function toggleLights() | |
API.toggleButton("Lights") | |
if buttonStatus == true then | |
rs.setBundledOutput(sides.down,colors.red,15) | |
else | |
rs.setBundledOutput(sides.down,colors.red,0) | |
end | |
end | |
function toggleAttract() | |
API.toggleButton("Attract") | |
if buttonStatus == true then | |
rs.setBundledOutput(sides.down,colors.green,15) | |
else | |
rs.setBundledOutput(sides.down,colors.green,0) | |
end | |
end | |
term.setCursorBlink(false) | |
-- gpu.setResolution(50, 16) | |
API.clear() | |
API.fillTable() | |
API.heading("Mobfarm controls") | |
-- API.label(1,24,"A sample Label.") | |
while true do | |
getClick() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment