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 ==241and lime ==243)thenprint("Tür ist Zurzeit geschlossen")
elseif (yellow <241and lime <243)thenprint("Tür ist zurzeit geöffnet")elseprint("Tür steht in einem unbekannten Zustand")endprint("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()whilenot tonumber(eingabe)doprint("keine Nummer")print("Bitte eine Ziffer von 0-9 Eingeben")
eingabe = io.read()endif(eingabe =="1"or oeffner ==230and yellow ==241and lime ==243)thenprint("Tür wird geöffnet")
redstone.setBundledOutput(sides.back, colors.lightblue,255)for i=1,5do
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 ==230and yellow <241and lime <243)thenprint("Tür wird geschlossen")
redstone.setBundledOutput(sides.back, colors.lightblue,255)for i=1,5do
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)endelseprint("Eingabe nicht möglich, Nummer nicht verwendet, oder Tor bereits geöffnet/geschlossen")print("Bitte erneut versuchen")
os.sleep(2)
computer.shutdown(true)end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
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
Link to post
Share on other sites