Main Menu

Help Simple menu

Started by Marcel61082, Jun 22, 2024, 10:20 AM

Previous topic - Next topic
Hello, I have put together a small menu and would like when I click on the 1 to open a new page.

At the moment only the text "Test" is written on the page.

Here is the code:

Monitor = peripheral.wrap("monitor_0")

Monitor.setTextScale(1)
Monitor.setCursorPos(10,1)
Monitor.setTextColour(colors.lime)
Monitor.write("Menü von ")

Monitor.setTextScale(1)
Monitor.setCursorPos(1,2)
Monitor.setTextColour(colors.white)
Monitor.write("----------------------------------------")

Monitor.setTextScale(1)
Monitor.setCursorPos(1,4)
Monitor.setTextColour(colors.red)
Monitor.write("1.")

Monitor.setTextScale(1)
Monitor.setCursorPos(3,4)
Monitor.setTextColour(colors.orange)
Monitor.write(" Einwohner der Stadt")

while true do
event,side,x,y = os.pullEvent()
 if event == "monitor_touch" then
  if x == 1 and y == 4 then   
Monitor.setCursorPos(1,10) 
Monitor.write("Test") 
  end
 end
end

#1
fs.combine

geht auch nicht

QuickMuffin8782

Quote from: Marcel61082 on Jun 22, 2024, 10:20 AM-snip-

Hallo. Mir gefällt das Design Ihres Menüs, aber warum versuchen Sie nicht, mein Menü zu verwenden? Es unterstützt Lua-Tabellen für Menüoptionen und ist sehr anpassbar. Führen Sie diesen Befehl aus, wenn Sie es in Ihrem ersten Programmierprogramm ausprobieren wollen! Viel Glück!

wget get https://gitlab.com/qchost/cc-host/-/raw/main/api/zipmenu.lua /zipmenu.lua
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
Gitlab - Join my official discord! - SS Discord