Hello, Mr. and Mrs. Pro players! I ask for some help from you guys. I cant seem to find how to get a touchscreen monitor to have a button to change a redstone strength/ output a signal. I am currently on Tech World 2 1.6.4 FTB, just incase that is important. I just cant find a article or a code that i can get to work. My project is to get a trainstation that has a button that can activate a rail that can send it out. Thanks for reading!
4 replies to this topic
#1
Posted 04 January 2016 - 01:07 AM
#3
Posted 04 January 2016 - 02:54 PM
Hey!
You'll want to use the "touchpoint API"! --- http://www.computerc...touchpoint-api/ This one.
Get into your computer and type: pastebin get pFHeia96 touchpoint --- This will download the touchpoint API
now go into your program ( edit PROGRAMNAME // mostlikely "edit startup" )
Now heres some code that should do the trick:
To change redstone states:
.. Oh if you would want to use bundled cable those work like this:
Just tell me what you want exactly and I will write it for you as good as I can.
And yes my english is terrible but I hope I could help you somehow:p
have a nice day
You'll want to use the "touchpoint API"! --- http://www.computerc...touchpoint-api/ This one.
Get into your computer and type: pastebin get pFHeia96 touchpoint --- This will download the touchpoint API
now go into your program ( edit PROGRAMNAME // mostlikely "edit startup" )
Now heres some code that should do the trick:
os.loadAPI("touchpoint")
local t = touchpoint.new("top") -- Change it to your monitor side!
-- Your buttons!!
t:add("button1", nil, 2, 2, 10, 4, colors.red, colors.lime)
t:add("button2", nil, 2, 6, 10, 8, colors.red, colors.lime)
-- "button1/2" are the button names. Nil are the functions and the numbers are
-- the coordinates for your buttons. First color is the "Offline color" and the second one the
-- "Online color"
t:draw() -- This will draw the buttons on to your monitor
while true do -- Heres where the magic happens.
local event, button = t:handleEvents(os.pullEvent())
if event == "button_click" then
if button == "button1" then -- Tells what to do if you press the "button1" on your monitor
print("button1 was pressed")
t;toggleButton("button1")
elseif button == "button2" then -- Tells what to do if you press the "button2" on your monitor
print("button2 was pressed")
t:toggleButton("button2")
end
end
end
To change redstone states:
rs.setOutput("SIDE", true/false)
for example: If you want to set the Redstone output on the right to 1 / On / true write:rs.setOutput("right", true)
.. Oh if you would want to use bundled cable those work like this:
rs.setBundledOutput("SIDE", colors.COLOR)
- for example we want white to be on on the right side:
rs.setBundledOutput("right", colors.white)
Just tell me what you want exactly and I will write it for you as good as I can.
And yes my english is terrible but I hope I could help you somehow:p
have a nice day
Edited by Obsidia, 04 January 2016 - 03:04 PM.
#4
Posted 04 January 2016 - 05:04 PM
To change the redstone strength, from 0 to 15 blocks of power,
As for the other bits of code, I'd follow the tutorial linked by KingofGamesYami.
If you're feeling more lazy, I'd do this with the touchpoint api listed in the previous post.
redstone.setAnalogOutput("right",15)
rs.setAnalogOutput("right",15)
As for the other bits of code, I'd follow the tutorial linked by KingofGamesYami.
If you're feeling more lazy, I'd do this with the touchpoint api listed in the previous post.
Spoiler
Edited by Dragon53535, 04 January 2016 - 05:04 PM.
#5
Posted 04 January 2016 - 08:51 PM
Thanks!
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











