2 posts
Posted 18 February 2013 - 06:38 PM
Title: touchscreen mob spawner with bundled cable
i have been scouring the internet trying to find out how to make a mob spawner using the touch screen function sending out comands through bunbled cable.
If someone could please help me i would be very grateful. im wanting to do something like they did on forgecraft server. ex: click a button and it changes color indicating its active - sends signal through bundled cable and turns on spawner. push it again and everthing goes to inactive. i plan on having several
mobs. 2 would be sufficient an example. please help. im still leaning lua. thank you.
309 posts
Location
Sliding between sunbeams
Posted 19 February 2013 - 09:00 AM
Do you want the touch screen to be a monitor or a console? assuming you want it on the console something like this should do:
local zombie = false
local spider = false
function draw()
term.clear()
term.setCursorPos(1,1)
if zombie == false then
term.setTextColour(colours.red)
else
term.setTextColour(colours.green)
end
write("zombie")
if spider == false then
term.setTextColour(colours.red)
else
term.setTextColour(colours.green)
end
term.setCursorPos(1,2)
write("spider")
end
function update()
local ev,button,mx,my = os.pullEvent("mouse_click")
if my == 1 then
if zombie == false then
zombie = true
rs.setBundledOutput("back",rs.getBundledInput("back")+2ˆ1) --this adds the first colour to the output
else
zombie = false
rs.setBundledOutput("back",rs.getBundledInput("back")-2ˆ1)
end
elseif my == 2 then
if spider == false then
spider = true
rs.setBundledOutput("back",rs.getBundledInput("back")+2ˆ2)
else
spider = false
rs.setBundledOutput("back",rs.getBundledInput("back")-2ˆ2)
end
end
draw()
end
while true do update() end
this is untested, i havent done anything with redstone in the past few months so theres a good chance this wont work, but it should give you a good idea how to get started on this.
2 posts
Posted 19 February 2013 - 12:12 PM
thanks. this does help. i figured out a different way finally before i saw your post. I am sending everything to a monitor and have got the buttons set up and can turn them on and off. the issue im having now is that once i turn a button on and then turn it off the redstone signal stays on. im still wacking away at it. thanks so far. if you need i can post the code i have a bit later.
309 posts
Location
Sliding between sunbeams
Posted 19 February 2013 - 10:00 PM
If you can't get it to work, then yes, please post the code ;)/> Without it I can only guess what's wrong.