Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.60 KB | None | 0 0
  1.     CIncX=colors.yellow    
  2.     CDecX=colors.blue
  3.     CIncMX=colors.white
  4.     CDecMX=colors.red
  5.     DispX=0
  6.     CIncY=colors.cyan
  7.     CDecY=colors.green  
  8.     CIncMY=colors.purple
  9.     CDecMY=colors.magenta
  10.     DispY=0
  11.     CIncZ=colors.orange
  12.     CDecZ=colors.lightBlue
  13.     CIncMZ=colors.gray
  14.     CDecMZ=colors.black
  15.     DispZ=0
  16.     PWR=colors.brown
  17.     MULInc=colors.pink
  18.     MULDec=colors.lime
  19.     interval = 0.2
  20.     Side="bottom"
  21.     MUL=0
  22.     function resetDir()
  23.     impulse(63,CDecX)
  24.     impulse(63,CDecMX)
  25.     impulse(63,CDecY)
  26.     impulse(24,CDecMY)
  27.     end
  28.     function ChDir()
  29.         local sx=""
  30.         local sy=""
  31.         local sz=""
  32.         print("X")
  33.         DispX=read()
  34.         print("Y")
  35.         DispY=read()
  36.         print("Z")
  37.         DispZ=read()
  38.         print("M")
  39.         MUL=read()
  40.         SetDir()
  41.     end
  42. function SetDir()
  43. local CSum=0
  44. if abs(BuffX)>abs(BuffY) then n=abs(BuffX) else n=abs(BuffY)
  45. if n<abs(BuffZ) then n=abs(BuffZ)
  46.     if BuffX>0 and DispX<0 then impulse(DispX,CDecX)
  47.     if BuffX<0 and DispX>0 then impulse(DispX,CDecMX)
  48.     if BuffY>0 and DispY<0 then impulse(DispY,CDecY)
  49.     if BuffY<0 and DispY>0 then impulse(DispY,CDecMY)
  50.     if BuffZ>0 and DispZ<0 then impulse(DispZ,CDecZ)
  51.     if BuffZ<0 and DispZ>0 then impulse(DispZ,CDecMZ)
  52.     x=BuffX
  53.     y=BuffY
  54.     z=BuffZ
  55.     for j = 1,n do
  56.     begin
  57.        
  58.         if x>DispX and BuffX<0 then begin CSum=Csum+CDecMX x=x-1 end
  59.         if x<DispX and BuffX<0 then begin CSum=Csum+CIncMX x=x+1 end
  60.         if x>DispX and BuffX>0 then begin CSum=Csum+CDecX  x=x-1 end
  61.         if x<DispX and BuffX>0 then begin CSum=Csum+CIncX  x=x+1 end
  62.        
  63.         if y>DispX and BuffY<0 then begin CSum=Csum+CDecMY y=y-1 end
  64.         if y<DispX and BuffY<0 then begin CSum=Csum+CIncMY y=y+1 end
  65.         if y>DispX and BuffY>0 then begin CSum=Csum+CDecY  y=y-1 end
  66.         if y<DispX and BuffY>0 then begin CSum=Csum+CIncY  y=y+1 end
  67.        
  68.         if z>DispX and BuffZ<0 then begin CSum=Csum+CDecMZ z=z-1 end
  69.         if z<DispX and BuffZ<0 then begin CSum=Csum+CIncMZ z=z+1 end
  70.         if z>DispX and BuffZ>0 then begin CSum=Csum+CDecZ  z=z-1 end
  71.         if z<DispX and BuffZ>0 then begin CSum=Csum+CIncZ  z=z+1 end
  72.        
  73.         impulse(1, CSnum)
  74.         CSnum=0
  75.     end
  76.    
  77. end
  78.     function impulse(n, clr)
  79.      for j = 1,n do
  80.       rs.setBundledOutput(SIDE, clr)
  81.       sleep(interval)
  82.       rs.setBundledOutput(SIDE, 0)
  83.       sleep(interval)
  84.      end
  85.     end
  86. function Parser(input)
  87. if input == "exit" then exit()
  88. if input == "dir" then ChDir()
  89. if input == "jmp" then JMP()
  90. if input == "resetdir" then ResetDir()
  91. end
  92.  
  93. function JMP()
  94.      print("jumping...")
  95.       rs.setBundledOutput(SIDE, clr)
  96.       sleep(3*interval)
  97.       rs.setBundledOutput(SIDE, 0)
  98.       sleep(interval)
  99.      print("finished!")
  100.     end
  101. end
  102. repeat
  103. input = read()
  104. Parser(input)
  105. while input !="exit"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement