Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Mc_Jeronimo

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by Mc_Jeronimo

  1. Hey,

    i'm new here and a programming noob but I would like to process touch-events from the monitor and WirelessRedstone input signals in parallel for my program. My question is, how this can be implemented technically.

    The touch event is currently:

    while true do
    local component = require("component")
    local rs = component.redstone
    local gpu = component.gpu
    local colors = require("colors")
    local event = require("event")
    local id , _, x, y = event.pull("touch")
    if id == "touch" and x == 97 and y == 2 then --1
        term.setCursor(1,49)
        term.clearLine()
        print("Verbindungen: 1->23 | 1->105 | 1->12 | 1->20 | 1->21")
        local id , _, x, y = event.pull("touch")
        if id == "touch" and x > 70 and x < 73 and y == 20 then --23
            term.setCursor(1,49)
            term.clearLine()
            print("1->23")
            rs.setWirelessFrequency(101)
            rs.setWirelessOutput(true)
            os.sleep(1)
            rs.setWirelessOutput(false)
        elseif id == "touch" and x > 106 and x < 110  and y == 30 then --105
            term.setCursor(1,49)
            term.clearLine()
            print("1->105")
            rs.setWirelessFrequency(102)
            rs.setWirelessOutput(true)
            os.sleep(1)
            rs.setWirelessOutput(false)
    -- reduced
        else
            term.setCursor(1,49)
            term.clearLine()
        end
    elseif id == "touch" and x == 94 and y == 2 then --2
        term.setCursor(1,49)
        term.clearLine()
        print("Verbindungen: 2->23 | 2->105 | 2->12 | 2->20 | 2->21")
        local id , _, x, y = event.pull("touch")
        if id == "touch" and x > 70 and x < 73 and y == 20 then --23
            term.setCursor(1,49)
            term.clearLine()
            print("2->23")
            rs.setWirelessFrequency(106)
            rs.setWirelessOutput(true)
            os.sleep(1)
            rs.setWirelessOutput(false)
        elseif id == "touch" and x > 106 and x < 110  and y == 30 then --105
            term.setCursor(1,49)
            term.clearLine()
            print("2->105")
            rs.setWirelessFrequency(107)
            rs.setWirelessOutput(true)
            os.sleep(1)
            rs.setWirelessOutput(false)
    -- reduced
        else
            term.setCursor(1,49)
            term.clearLine()
        end
    -- reduced a lot
    elseif id == "touch" and x == 1 and y == 1 then
        term.clear()
        break
    else
        term.setCursor(1,49)
        term.clearLine()
    end
    end

    Now the WirelessRedstone Input Part should come. There I have no idea how to implement it. In general, this would also have to run via an if then query, since I would have to listen for around 187 frequencies. I need the input for printing stuff on the screen. Of course, there is also the question of how performant it will be in the end. If someone had an idea, it would be really nice.
     
    Thank you in advance!
     
    Mc_Jeronimo

     

    And sorry for my english :)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.