Posted 30 August 2017 - 01:05 AM
Hi, I'm noob in at LUA coding. I'm working in a spawner controlled by redstone. I've modified a little bit a code that I found in youtube, because I need to use it whit bundled cable. Unfortunately I get error at 26 line: Expected string, number. So, how can I fix it? I'm using the touchpoint api's Lyqyd. The code is unfinished, i'm testing it before ending it. Thanks
os.loadAPI("touchpoint")
mon = peripheral.wrap("right")
local t1 = touchpoint.new("right")
local t = t1
function writeButtons()
t1:add("Mobs", nil, 2, 2, 18, 6, colors.red, colors.lime)
t1:add("Blazes", nil, 22, 2, 38, 6, colors.red, colors.lime)
t1:add("Skeletons", nil, 2, 8, 18, 12, colors.red, colors.lime)
t1:add("Wither", nil, 22, 8, 38, 12, colors.red, colors.lime)
t1:add("Villagers", nil, 2, 14, 18, 18, colors.red, colors.lime)
t1:add("Pechs", nil, 22, 14, 38, 18, colors.red, colors.lime)
t = t1
t:draw()
end
function checkRs()
if rs.getBundledInput("back", colors.white) == true then t:toggleButton("Mobs") end
if rs.getBundledInput("back", colors.orange) == true then t:toggleButton("Blazes") end
if rs.getBundledInput("back", colors.magenta) == false then t:toggleButton("Skeletons") end
end
function toggleRs(rsOut)
rs.setBundledOutput(rsOut, not rs.getBundledOutput(rsOut))
end
function checkClick(p1)
if p1 == "Mobs" then
toggleRs("back", 1)
--rs.setBundledOutput("back", 1)
end
end
writeButtons()
checkRs()
while true do
local event, p1 = t:handleEvents(os.pullEvent())
if event == "button_click" then
t:toggleButton(p1)
print(p1)
checkClick(p1)
end
end