Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n=1
- nosaukumi={"#1 Generatori","Sektors #2"}
- computer_id={2,24}
- sleep(4)
- a=peripheral.wrap("right")
- term.redirect(a)
- a.setTextScale(1)
- x=30
- y=2
- laiki={}
- aktivs={}
- for i=1,n do
- laiki[i]=os.clock()
- aktivs[i]="OFF"
- end
- term.clear()
- term.setCursorPos(5,5)
- term.write("ieladejas")
- sleep(1)
- a.setTextScale(1)
- print("")
- print(" __ __ _ _ _ _ ")
- print(" | | | ___ ___ ___ _| || |_ |_|| |_ ")
- print(" |- -|| . || .'|| || . || . || || _|")
- print(" |__|__||___||__,||_|_||___||___||_||_| ")
- print("")
- rednet.close("left")
- rednet.open("left")
- sleep(5)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print()
- print(" +-+-+-+-+-+-+-+-+");
- print(" |X|o|a|n|d|b|i|t|");
- print(" +Automatizetajs-+")
- print()
- if n==0 then
- term.setCursorPos(x,y+2)
- write("Nav parvaldamo iekartu")
- else
- for i=1,n do
- term.setCursorPos(x,y+i)
- write(nosaukumi[i])
- write(" - ")
- write(aktivs[i])
- write(" ")
- local apr=os.clock()-laiki[i]
- write(math.ceil(apr))
- end
- end
- term.setCursorPos(25,10)
- while true do
- i=1
- id,sk=rednet.receive(0.5)
- if id~=nil then
- for l=1,n do
- if id==computer_id[l] then
- sk=sk+1-1
- if sk>0 then
- laiki[l]=os.clock()
- aktivs[l]="ON"
- i=i+1
- end
- if sk==0 then
- aktivs[l]="ON-N"
- laiki[l]=os.clock()
- i=i+1
- end
- end
- end
- else
- break
- end
- if i>10 then
- break
- end
- end
- --Parbaudam
- for i=1,n do
- local apr=math.ceil(os.clock()-laiki[i])-1
- if apr>15 then
- aktivs[i]="OFF"
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment