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

Rayos268

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by Rayos268

  1. Hello all,

    i changed from computercraft to opencomputers and now i need the parallel api but in oc is none,

    so i need a little bit help to rewrite the programm i have read something about a background process, like windows but i dont understand this so i hope you can tell me what i have to do with my code to abort or cancel the io.read() if my magenta input is on

    local component = require("component")
    local sides = require("sides")
    local colors = require("colors")
    local redstone = component.redstone
    local computer = require("computer")
    oeffner = redstone.getBundledInput(sides.back, colors.magenta)
    yellow = redstone.getBundledInput(sides.back, colors.yellow)
    lime = redstone.getBundledInput(sides.back, colors.lime)
    
    
    print("Willkommen im Türkontrollmodus")
    if(yellow == 241 and lime == 243) then
    print("Tür ist Zurzeit geschlossen")
    elseif (yellow < 241 and lime < 243) then
    print("Tür ist zurzeit geöffnet")
    else
    print("Tür steht in einem unbekannten Zustand")
    end
    print("Bitte warten, die Türsteuerung wird geladen.")
    print("")
    print("")
    os.sleep(2)
    
    print("Willkommen bei der Türsteuerung")
    print("Bitte eingabe erfassen zum Tor öffnen(1) oder schließen(2)")
    eingabe = io.read()
    while not tonumber(eingabe) do
    print("keine Nummer")
    print("Bitte eine Ziffer von 0-9 Eingeben")
    eingabe = io.read()
    end
    
    if (eingabe == "1" or oeffner == 230 and yellow == 241 and lime == 243) then
    print("Tür wird geöffnet")
    redstone.setBundledOutput(sides.back, colors.lightblue, 255)
    for i=1,5 do
    redstone.setBundledOutput(sides.back, colors.orange, 255)
    os.sleep(0.1)
    redstone.setBundledOutput(sides.back, colors.orange, 0)
    if (i == 5) then
    redstone.setBundledOutput(sides.back, colors.lightblue, 0)
    end
    os.sleep(1)
    end
    
    elseif (eingabe == "2" or oeffner == 230 and yellow < 241 and lime < 243) then
    print("Tür wird geschlossen")
    redstone.setBundledOutput(sides.back, colors.lightblue, 255)
    for i=1,5 do
    redstone.setBundledOutput(sides.back, colors.white, 255)
    os.sleep(0.1)
    redstone.setBundledOutput(sides.back, colors.white, 0)
    if (i == 5) then
    redstone.setBundledOutput(sides.back, colors.lightblue, 0)
    end
    os.sleep(1)
    end
    
    else
    print("Eingabe nicht möglich, Nummer nicht verwendet, oder Tor bereits geöffnet/geschlossen")
    print("Bitte erneut versuchen")
    os.sleep(2)
    computer.shutdown(true)
    end

     

×
×
  • Create New...

Important Information

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