This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
BlueWaste's profile picture

need advanced monitor code can someone help?

Started by BlueWaste, 26 March 2015 - 01:29 PM
BlueWaste #1
Posted 26 March 2015 - 02:29 PM
I wrote this program:

write("How many Nether Stars do you want?")
local Num = tonumber( read() )
for i=1,Num do
redstone.setOutput("top", false)
sleep(1)
redstone.setOutput("top", true)
sleep(2)
redstone..setOutput("top", false)
sleep(1)
Print("You got "..tostring(i).." Nether Stars."
end

and it's working fine but i want it on a advanced monitor with buttons but i don't know how, can someone help?

Thanks in advance
Bomb Bloke #2
Posted 26 March 2015 - 11:38 PM
Are you sure that's what you want? Advanced monitors typically mean you can't use your keyboard, and even if you stuck with the display of an advanced computer, typing numbers is a heck of a lot faster and easier than entering them via any mouse-driven method.

That said, here's an example of a simple mouse-driven menu system, here's a guide about peripherals, and here's some documentation regarding os.pullEvent() - in particular, you're interested in the monitor_touch event.
BlueWaste #3
Posted 27 March 2015 - 05:23 AM
it's not exactly what i want, i want there to be number buttons on the monitor and a + and - button, and maybe some code that detect when x number of items is in the chest and if nothing happens it shut down and on the monitor it prints that something i wrong or missing.
Lupus590 #4
Posted 27 March 2015 - 08:10 AM
If you are happy to use a CC addon/peripheral then use the keyboard in this

http://www.computercraft.info/forums2/index.php?/topic/19357-cc-latest-moarperipherals/

Otherwise you will have to build a touch UI like Bomb Bloke suggested