SHARE
TWEET

v3.01

blawhar May 25th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function variables()
  2.   rednet.open("top")
  3.   out1=peripheral.wrap("flux_gate_79")
  4.   in1=peripheral.wrap("flux_gate_78")
  5.   cap1=peripheral.wrap("draconic_rf_storage_16")
  6.   isCap1={empty=false,full=false,outp=false,inp=false,c=false}
  7.   maxIn=8000000
  8.   maxOut=5000000
  9.  
  10.  lot=1640000000
  11.  
  12.   koupeno=0
  13.   preneseno=0
  14.  -- prenesenoStr  
  15.   pass=0
  16.   pass1=0
  17.   ipass=0
  18.  
  19.   start=false
  20.   cBuy=0
  21.   cCount=0
  22.   gate=true
  23.   isOpened=false
  24.   btnGate=0
  25.   mainScreenGate=false
  26.   passGate=false
  27.  
  28.   count=0
  29.   ID=2284
  30.   price=10
  31.  
  32.  
  33.   redstone.setOutput("left",true)
  34.   sleep(1)
  35.   redstone.setOutput("left",false)
  36.  
  37. end
  38.  
  39. function formatInt(number)
  40.   if number == nil then number = 0 end
  41.   local i,j,minus,int,fraction=tostring(number):find('([-]?)(%d+)([.]?%d*)')
  42.   int=int:reverse():gsub("(%d%d%d)","%1,")
  43.   return minus .. int:reverse():gsub("^,","") .. fraction
  44. end
  45.  
  46.    
  47. function getAllVariables()
  48.  local data=fs.open("cap1.txt","r")
  49.  isCap1.empty=data.readLine()
  50.  isCap1.full=data.readLine()
  51.  isCap1.outp=data.readLine()
  52.  isCap1.inp=data.readLine()
  53.  isCap1.c=data.readLine()
  54.  data.close()
  55.  
  56.  local data=fs.open("cap2.txt","r")
  57.  isCap2.empty=data.readLine()
  58.  isCap2.full=data.readLine()
  59.  isCap2.outp=data.readLine()
  60.  isCap2.inp=data.readLine()
  61.  isCap2.c=data.readLine()
  62.  data.close()
  63.  
  64.  local data=fs.open("gates.txt","r")
  65.  gate=data.readLine()
  66.  isOpened=data.readLine()
  67.  mainScreenGate=data.readLine()
  68.  data.close()
  69.  
  70.  local data=fs.open("pass.txt","r")
  71.  pass=data.readLine()
  72.  data.close()
  73.  
  74.  local data=fs.open("another.txt","r")
  75.  start=data.readLine()
  76.  cBuy=data.readLine()
  77.  count=data.readLine()
  78.  data.close()
  79.  
  80.  local data=fs.open("btnGate.txt","r")
  81.  btnGate=data.readLine()
  82.  data.close()  
  83.  
  84. end
  85.  
  86. function updateCap1()
  87.   local data=fs.open("cap1.txt","w")
  88.   data.writeLine(isCap1.empty)
  89.   data.writeLine(isCap1.full)
  90.   data.writeLine(isCap1.outp)
  91.   data.writeLine(isCap1.inp)
  92.   data.writeLine(isCap1.c)
  93.   data.close()
  94. end
  95.  
  96. function updateCap2()
  97.   local data=fs.open("cap2.txt","w")
  98.   data.writeLine(isCap2.empty)
  99.   data.writeLine(isCap2.full)
  100.   data.writeLine(isCap2.outp)
  101.   data.writeLine(isCap2.inp)
  102.   data.writeLine(isCap2.c)
  103.   data.close()
  104. end
  105.  
  106. function gatesUpdate()
  107.   local data=fs.open("gates.txt","w")
  108.   data.writeLine(gate)
  109.   data.writeLine(isOpened)
  110.   data.writeLine(mainScreenGate)
  111.   data.close()
  112. end
  113.  
  114. function passUpdate()
  115.   local data=fs.open("pass.txt","w")
  116.   data.writeLine(pass)
  117.   data.close()
  118. end
  119.  
  120. function anotherUpdate()
  121.   local data=fs.open("another.txt","w")
  122.   data.writeLine(start)
  123.   data.writeLine(cBuy)
  124.   data.writeLine(count)
  125.   data.close()
  126. end
  127.  
  128. function btnGateUpdate()
  129.   local data=fs.open("btnGate.txt","w")
  130.   data.writeLine(btnGate)
  131.   data.close()
  132.  
  133. end
  134.  
  135. function monClear()
  136.   mon.setBackgroundColor(colors.black)
  137.   mon.clear()
  138.   mon.setCursorPos(1,1)
  139.   mon.setTextColour(colors.white)
  140. end  
  141.  
  142. function monSetup()
  143.   mon=peripheral.wrap("monitor_141")
  144.   mon.setBackgroundColor(colors.black)
  145.   mon.clear()
  146. end
  147.  
  148. function monWrite(ax,ay,tColor,BgColor,atext)
  149.   mon.setBackgroundColor(BgColor)
  150.   mon.setTextColour(tColor)
  151.   mon.setCursorPos(ax,ay)
  152.   mon.write(atext)
  153. end
  154.  
  155. function firstScreen()
  156.   btnGate=1
  157.   monSetup()
  158.   monWrite(10,1,colors.red,colors.black,"TERMINAL #1")
  159.   monWrite(7,3,colors.blue,colors.black,"Max out:")
  160.   monWrite(16,3,colors.white,colors.black,"5")
  161.   monWrite(18,3,colors.purple,colors.black,"MRF/t")
  162.   monWrite(7,5,colors.orange,colors.black,"1 lot:")
  163.   monWrite(14,5,colors.white,colors.black,"1,64")
  164.   monWrite(19,5,colors.purple,colors.black,"BRF")
  165.   monWrite(4,7,colors.red,colors.black,"Price:")
  166.   monWrite(11,7,colors.white,colors.black,"10")
  167.   monWrite(14,7,colors.purple,colors.black,"Dia block/lot")
  168.   monWrite(7,11,colors.white,colors.red,"OTEVRIT PRIPOJKU")
  169.  while true do
  170.   os.pullEvent()
  171.   if btnGate==0 then
  172.     return
  173.   end
  174.  end
  175.  
  176. end
  177.  
  178. function firstInfo()
  179.   btnGate=2
  180.   monClear()
  181.   monWrite(1,1,colors.white,colors.black,"Testovaci provoz. Majtel si")
  182.   monWrite(1,2,colors.white,colors.black,"vyhrazje pravo rusit/upravit")
  183.   monWrite(1,3,colors.white,colors.black,"bez vaseho vedomi. jakykoliv")
  184.   monWrite(1,4,colors.white,colors.black,"pokus o obchazeni systemu se")
  185.   monWrite(1,5,colors.white,colors.black,"tresta. pokud nebude 30 dnu")
  186.   monWrite(1,6,colors.white,colors.black,"aktivni output, pripojka se")
  187.   monWrite(1,7,colors.white,colors.black,"automaticky maze.")
  188.   monWrite(1,11,colors.white,colors.black,"Pokud souhlasis, klikni na:")
  189.   monWrite(18,12,colors.white,colors.green,"SOUHLASIM")
  190.  while true do
  191.   os.pullEvent()
  192.   if btnGate==0 then
  193.     return
  194.   end    
  195.  end
  196. end
  197.  
  198. function passInfo()
  199.   btnGate=3
  200.   monClear()
  201.   monWrite(1,3,colors.white,colors.black,"Kvuli zabezpeceni bude v")
  202.   monWrite(1,4,colors.white,colors.black,"nasledujicim kroku zadano")
  203.   monWrite(1,5,colors.white,colors.black,"4 mistne heslo. Toto heslo")
  204.   monWrite(1,6,colors.white,colors.black,"bude pozdeji pozadovano pri")
  205.   monWrite(1,7,colors.white,colors.black,"zmenach parametru pripojky")
  206.  
  207.   monWrite(1,12,colors.white,colors.black,"pro zadani hesla stiskni")
  208.   monWrite(26,12,colors.white,colors.green,"OK")
  209.  while true do
  210.   os.pullEvent()
  211.   if btnGate == 0 then
  212.     return
  213.   end  
  214.  end
  215. end
  216.  
  217. function firstPass()
  218.   btnGate=4
  219.  
  220.   while true do
  221.     monClear()
  222.     keyboardPrint()
  223.     passGate=true
  224.     zadejPass(1)
  225.     while passGate do
  226.       os.pullEvent()
  227.     end
  228.     pass=pass1
  229.     pass1=0
  230.    
  231.     passGate=true  
  232.     monClear()
  233.     keyboardPrint()
  234.     ipass=0
  235.     zadejPass(3)
  236.     while passGate do
  237.       os.pullEvent()
  238.     end
  239.     if pass==pass1 then
  240.       --printClearWindow()
  241.       --printToWindow(....)
  242.       --mainScreenGate=true
  243.       pass1=0
  244.       btnGate=0
  245.       isOpened=true
  246.       ipass=0
  247.       return
  248.     else
  249.       --printClearWindow()
  250.       printToWindow()
  251.       pass=0
  252.       ipass=0
  253.       pass1=0      
  254.     end
  255.   end
  256. end
  257.  
  258. function getPass()
  259.   btnGate=4
  260.  
  261.   while true do
  262.  
  263.    
  264.     passGate=true  
  265.     monClear()
  266.     keyboardPrint()
  267.     ipass=0
  268.     zadejPass(2)
  269.     while passGate do
  270.       os.pullEvent()
  271.     end
  272.     if pass==pass1 then
  273.       --printClearWindow()
  274.       --printToWindow(....)
  275.       mainScreenGate=true
  276.       pass1=0
  277.       btnGate=0
  278.       ipass=0
  279.       return
  280.     else
  281.       --printClearWindow()
  282.       printToWindow()
  283.       ipass=0
  284.       pass1=0      
  285.     end
  286.   end
  287. end
  288.  
  289.  
  290. --function printClearWindow()
  291.  
  292. --end
  293.  
  294. function printToWindow() --predelat
  295. monClear()
  296. monWrite(1,1,colors.white,colors.black,"CHYBA!")
  297. monWrite(1,2,colors.white,colors.black,"Hesla se neshoduji")
  298. monWrite(1,3,colors.white,colors.black,"opakuj proces")
  299. sleep(4)
  300. end
  301.  
  302.  
  303. function Loader(x)--dodelat
  304.  
  305. if x==1 then
  306. getPass()
  307.  
  308. end
  309.  
  310. btnGate=5
  311.  
  312. monClear()
  313. if x==0 then
  314. monWrite(1,1,colors.white,colors.black,"na cerveny blok poloz ")
  315. monWrite(1,2,colors.white,colors.black,"tesseract, na cerny naplneny")
  316. monWrite(1,3,colors.white,colors.black,"chunkoader* a potvrd")
  317.  
  318. monWrite(1,6,colors.white,colors.black,"* Chunkloader neni nutny,")
  319. monWrite(1,7,colors.white,colors.black,"ale...")
  320.  
  321. monWrite(5,11,colors.white,colors.green,"OK")
  322. monWrite(10,11,colors.white,colors.green,"CANCEL")
  323. else
  324. monWrite(1,1,colors.white,colors.black,"vysunul jsi loader")
  325. monWrite(1,2,colors.white,colors.black,"pro zasunuti stiskni ok")
  326.  
  327. monWrite(5,11,colors.white,colors.green,"OK")
  328.  
  329.  
  330. end
  331.  
  332. redstone.setOutput("bottom",true)
  333. sleep(1)
  334. redstone.setOutput("bottom",false)
  335.  
  336.  
  337.  
  338.  
  339. while true do
  340.  os.pullEvent()
  341.  if btnGate==0 then
  342.    return
  343.  end
  344. end
  345.  
  346. end
  347.  
  348. function buy(x)
  349. if x==1 then
  350. getPass()
  351. end
  352.  
  353.  
  354. btnGate=10
  355. mainScreenGate=false
  356. monClear()
  357. monWrite(1,1,colors.white,colors.black,"vhod dia do crate a potvrd")
  358. monWrite(1,2,colors.white,colors.black,"prepocet chvilku trva,")
  359. monWrite(1,3,colors.white,colors.black,"prosim o strpeni")
  360. monWrite(13,11,colors.white,colors.green,"OK")
  361.  
  362. while true do
  363.   eID,msg,dist=rednet.receive()
  364.   if eID==ID then
  365.   count=tonumber(msg)
  366.   print(count)
  367.   print(msg)
  368.   btnGate=11
  369.   break
  370.   end
  371. end
  372. vratit=(count-math.floor(count/price)*price)
  373. zaplaceno=(math.floor(count/price))*price
  374. koupeno=koupeno+lot*(zaplaceno/price)
  375. cBuy=cBuy+(zaplaceno/price)
  376.  
  377. print(vratit)
  378. print(zaplaceno)
  379.  
  380. monClear()
  381. monWrite(1,1,colors.white,colors.black,"zaplaceno:")
  382. monWrite(1,2,colors.white,colors.black,tostring(zaplaceno))
  383. monWrite(1,3,colors.white,colors.black,"vraceno:")
  384. monWrite(1,4,colors.white,colors.black,tostring(vratit))
  385. monWrite(1,5,colors.white,colors.black,"koupeno nergie:")
  386. monWrite(1,6,colors.lightGray,colors.black,formatInt(lot*(zaplaceno/price)))
  387. monWrite(5,11,colors.white,colors.green,"OK")
  388. monWrite(10,11,colors.white,colors.red,"CANCEL")
  389.  
  390. while true do
  391.  os.pullEvent()
  392.  if btnGate==0 then
  393.    return
  394.  end
  395. end
  396.  
  397.  
  398. end
  399.  
  400.  
  401.  
  402. function mainScreen()
  403.  -- monClear()
  404.   preneseno=0
  405.   prenesenoProc=(preneseno/koupeno)*100
  406.  
  407.  
  408.  
  409.   if isCap1.outp then
  410.     preneseno=cCount*1640000000+(1640000000-cap1.getEnergyStored())
  411.  -- sleep(1)
  412.   elseif isCap2.outp then
  413.     preneseno=cCount*1640000000+(1640000000-cap2.getEnergyStored())
  414.  -- sleep(1)
  415.   end  
  416.  
  417.  monClear()
  418.   monWrite(5,3,colors.white,colors.black,"koupeno")
  419.   monWrite(1,4,colors.lightGray,colors.black,formatInt(koupeno))
  420.   monWrite(3,6,colors.white,colors.black,"preneseno")
  421.   monWrite(1,7,colors.lightGray,colors.black,formatInt(preneseno))
  422.  
  423.   monWrite(19,2,colors.white,colors.green," dokoupit ")
  424.   monWrite(19,3,colors.white,colors.green," energii  ")
  425.  
  426.   monWrite(19,5,colors.white,colors.green," vysunout ")
  427.   monWrite(19,6,colors.white,colors.green," ch.loader")
  428.  
  429.   monWrite(19,8,colors.white,colors.green,"   help   ")
  430.  
  431.   monWrite(19,10,colors.white,colors.red,"  zrusit  ")
  432.   monWrite(19,11,colors.white,colors.red," pripojku ")
  433.  
  434. end
  435.  
  436. function zadejPass(x)
  437.   mon.setTextColor(colors.white)
  438.   mon.setBackgroundColor(colors.black)
  439.   if x==1 then  
  440.       mon.setCursorPos(11,2)
  441.       mon.write("zadej 4 mistne")
  442.       mon.setCursorPos(11,3)  
  443.       mon.write("heslo a potvrd OK")
  444.   elseif x==2 then
  445.       mon.setCursorPos(11,2)
  446.       mon.write("              ")
  447.       mon.setCursorPos(11,2)
  448.       mon.write("zadej heslo")
  449.       mon.setCursorPos(11,3)
  450.       mon.write("a potvrd OK")
  451.   elseif x==3 then
  452.       mon.setCursorPos(11,2)
  453.       mon.write("              ")
  454.       mon.setCursorPos(11,2)
  455.       mon.write("potvrd heslo")
  456.       mon.setCursorPos(11,3)
  457.       mon.write("a potvrd OK")
  458.   end
  459. end
  460.  
  461. function keyboardPrint()
  462.   monClear()
  463.   mon.setBackgroundColour(colors.blue)
  464.   mon.setCursorPos(2,1)
  465.   mon.write("  ")
  466.   mon.setCursorPos(5,1)
  467.   mon.write("  ")
  468.   mon.setCursorPos(8,1)
  469.   mon.write("  ")
  470.   mon.setCursorPos(2,2)
  471.   mon.write("7 ")
  472.   mon.setCursorPos(5,2)
  473.   mon.write("8 ")
  474.   mon.setCursorPos(8,2)
  475.   mon.write("9 ")
  476.  
  477.   mon.setCursorPos(2,4)
  478.   mon.write("  ")
  479.   mon.setCursorPos(5,4)
  480.   mon.write("  ")
  481.   mon.setCursorPos(8,4)
  482.   mon.write("  ")  
  483.   mon.setCursorPos(2,5)
  484.   mon.write("4 ")
  485.   mon.setCursorPos(5,5)
  486.   mon.write("5 ")
  487.   mon.setCursorPos(8,5)
  488.   mon.write("6 ")
  489.  
  490.   mon.setCursorPos(2,7)
  491.   mon.write("  ")
  492.   mon.setCursorPos(5,7)
  493.   mon.write("  ")
  494.   mon.setCursorPos(8,7)
  495.   mon.write("  ")
  496.   mon.setCursorPos(2,8)
  497.   mon.write("1 ")
  498.   mon.setCursorPos(5,8)
  499.   mon.write("2 ")
  500.   mon.setCursorPos(8,8)
  501.   mon.write("3 ")
  502.  
  503.   mon.setCursorPos(2,10)
  504.   mon.write("  ")
  505.   mon.setCursorPos(2,11)
  506.   mon.write("0 ")
  507.   mon.setCursorPos(5,10)
  508.   mon.setBackgroundColor(colors.lime)
  509.   mon.write("  ")
  510.   mon.setCursorPos(5,11)
  511.   mon.write("OK")
  512.   mon.setCursorPos(8,10)
  513.   mon.setBackgroundColor(colors.red)
  514.   mon.write("  ")
  515.   mon.setCursorPos(8,11)
  516.   mon.write("DL")
  517.  
  518.   mon.setCursorPos(28,11)
  519.   mon.write("  ")
  520.   mon.setCursorPos(28,12)
  521.   mon.write("X ")
  522.  
  523.   mon.setBackgroundColor(colors.black)
  524.   mon.setCursorPos(11,5)
  525.   mon.write("PASS:")
  526. end
  527.  
  528.  
  529. function buttons()
  530.   while true do
  531.     event, side, x, y=os.pullEvent("monitor_touch")
  532.     if btnGate==1 then
  533.       if x>6 and x<19 and y==11 then    
  534.         btnGate=0
  535.       end
  536.     elseif btnGate==2 then
  537.       if x>17 and x<27 and y==12 then    
  538.         btnGate=0
  539.       end
  540.     elseif btnGate==3 then
  541.       if x>25 and x<28 and y==12 then
  542.         btnGate=0
  543.      
  544.       end
  545.     elseif btnGate==4 then
  546.       if x>1 and x<4 and y<3 and ipass<4 then
  547.         pass1=pass1*10+7
  548.         mon.setCursorPos(16+ipass,5)
  549.         mon.write("*")
  550.         ipass=ipass+1
  551.       elseif x>4 and x<7 and y<3 and ipass<4 then
  552.         pass1=pass1*10+8
  553.         mon.setCursorPos(16+ipass,5)
  554.         mon.write("*")
  555.         ipass=ipass+1
  556.       elseif x>7 and x<10 and y<3 and ipass<4 then
  557.         pass1=pass1*10+9
  558.         mon.setCursorPos(16+ipass,5)
  559.         mon.write("*")
  560.         ipass=ipass+1
  561.       elseif x>1 and x<4 and y>3 and y<6 and ipass<4 then
  562.         pass1=pass1*10+4
  563.         mon.setCursorPos(16+ipass,5)
  564.         mon.write("*")
  565.         ipass=ipass+1
  566.       elseif x>4 and x<7 and y>3 and y<6 and ipass<4 then
  567.         pass1=pass1*10+5
  568.         mon.setCursorPos(16+ipass,5)
  569.         mon.write("*")
  570.         ipass=ipass+1
  571.       elseif x>7 and x<10 and y>3 and y<6 and ipass<4 then
  572.         pass1=pass1*10+6
  573.         mon.setCursorPos(16+ipass,5)
  574.         mon.write("*")
  575.         ipass=ipass+1
  576.       elseif x>1 and x<3 and y>6 and y<9 and ipass<4 then
  577.         pass1=pass1*10+1
  578.         mon.setCursorPos(16+ipass,5)
  579.         mon.write("*")
  580.         ipass=ipass+1
  581.       elseif x>3 and x<7 and y>6 and y<9 and ipass<4 then
  582.         pass1=pass1*10+2
  583.         mon.setCursorPos(16+ipass,5)
  584.         mon.write("*")
  585.         ipass=ipass+1
  586.       elseif x>7 and x<10 and y>6 and y<9 and ipass<4 then
  587.         pass1=pass1*10+3
  588.         mon.setCursorPos(16+ipass,5)
  589.         mon.write("*")
  590.         ipass=ipass+1
  591.       elseif x>1 and x<4 and y>9 and y<12 and ipass<4 then
  592.         pass1=pass1*10+0
  593.         mon.setCursorPos(16+ipass,5)
  594.         mon.write("*")
  595.         ipass=ipass+1
  596.       elseif x>7 and x<10 and y>9 and y<12 then
  597.         if ipass>0 then
  598.           pass1=math.floor(pass1/10)
  599.           ipass=ipass-1
  600.           mon.setCursorPos(16+ipass,5)
  601.           mon.write(" ")
  602.         end
  603.       elseif x>4 and x<7 and y>9 and y<12 and ipass==4 then
  604.  
  605.         passGate=false
  606.  
  607.      
  608.       end
  609.     elseif btnGate==5 then
  610.       if x>4 and x<8 and y==11 then
  611.         btnGate=0
  612.      redstone.setOutput("left",true)
  613.         sleep(1)
  614.            redstone.setOutput("left",false)
  615.       end
  616.     elseif btnGate==10 then
  617.       if x>13 and x<16 and y==11 then
  618.         rednet.send(ID,1)
  619.      mainScreenGate=true
  620.  
  621.    end
  622.     elseif btnGate==11 then
  623.       if x>4 and x<8 and y==11 then
  624.         rednet.send(ID,3)
  625.            btnGate=0
  626.            mainScreenGate=true
  627.            if (not start) and cBuy>0 then
  628.              start=true
  629.          
  630.      end
  631.         --start=true
  632.       elseif x>9 and x<17 and y==11 then
  633.         rednet.send(ID,2)
  634.            btnGate=0
  635.      mainScreenGate=true
  636.       end
  637.     elseif btnGate==0 then
  638.       if x>18 and x<29 and y>1 and y<4 then
  639.       btnGate=10
  640.       elseif x>18 and x<29 and y>4 and y<7 then
  641.    btnGate=5
  642.    end
  643.      
  644.      
  645.  end  
  646.     sleep(0.1)
  647.   end
  648. end
  649.  
  650. function disp()
  651.   while true do
  652.    
  653.     term.clear()
  654.     term.setCursorPos(1,1)
  655.     print("pass: "..pass)
  656.     print("start: "..start)
  657.     print("gate: "..gate)
  658.     print("cap1:empty:"..(isCap1.empty and 'true' or 'false').." ,full:"..(isCap1.full and 'true' or 'false').." ,outp:"..(isCap1.outp and 'true' or 'false').." ,inp:"..(isCap1.inp and 'true' or 'false'))
  659.     print("cBuy: "..cBuy.." ,count: "..cCount)
  660.  
  661.     if not isOpened then
  662.       firstScreen()
  663.       firstInfo()
  664.       passInfo()
  665.       firstPass()
  666.       buy(0)
  667.       Loader(0)
  668.    
  669.    else
  670.      if mainScreenGate then
  671.        mainScreen()
  672.      end
  673.    if btnGate==10 then
  674.      buy(1)
  675.    elseif btnGate==5 then
  676.      Loader(1)
  677.    end
  678.    
  679.    end
  680.  
  681.     sleep(0.1)
  682.   end
  683. end
  684.  
  685.  
  686. function capReg()
  687.   while true do
  688.    
  689.     if start then
  690.       if gate and isCap1.full then
  691.          count=0
  692.           isCap1.outp=true
  693.           gate=false
  694.         end  
  695.     end
  696.  
  697.  
  698.     if count==i then
  699.       start=false
  700.       gate=true
  701.     end  
  702.  
  703.  -- cap1 empty/full  begin
  704.     if cap1.getEnergyStored()==cap1.getMaxEnergyStored() then
  705.       isCap1.full=true
  706.     else
  707.       isCap1.full=false
  708.     end
  709.  
  710.     if cap1.getEnergyStored()==0 then
  711.       isCap1.empty=true
  712.     else
  713.       isCap1.empty=false
  714.     end    
  715.  
  716. -- cap1 empty/full  end
  717.  
  718. --cap1 set in/out flow begin
  719.     if isCap1.outp then
  720.       out1.setSignalLowFlow(maxOut)
  721.     else
  722.       out1.setSignalLowFlow(0)
  723.     end  
  724.    
  725.        
  726.     if isCap1.inp then
  727.       in1.setSignalLowFlow(maxIn)
  728.     else
  729.       in1.setSignalLowFlow(0)
  730.     end
  731.    
  732.  
  733.     if isCap1.empty and isCap1.outp then
  734.       isCap1.outp=false
  735.       isCap1.c=true
  736.     end
  737.    
  738.     if isCap1.full and isCap1.inp then
  739.       isCap1.inp=false
  740.     end
  741.    
  742. -- cap1 fill/unfill start/stop begin
  743. --fill
  744.     if isCap1.empty and not isCap1.outp then
  745.       isCap1.inp=true
  746.     end
  747. --unfill
  748.     if isCap1.full and not isCap1.inp and start then
  749.       isCap1.outp=true
  750.       count=count+1
  751.     end
  752.  
  753. -- cap1 fill/unfill start/stop end
  754.    
  755.   sleep(0.1)
  756.  
  757.   end  
  758. end
  759.  
  760.  
  761. variables()
  762.  
  763. --updateCap1()
  764. --updateCap2()
  765. --gatesUpdate()
  766. --passUpdate()
  767. --anotherUpdate()
  768. --btnGateUpdate()
  769.  
  770. --getAllVariables()
  771.  
  772. parallel.waitForAny(buttons,disp,capReg)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top