Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CIncX=colors.yellow
- CDecX=colors.blue
- CIncMX=colors.white
- CDecMX=colors.red
- DispX=0
- CIncY=colors.cyan
- CDecY=colors.green
- CIncMY=colors.purple
- CDecMY=colors.magenta
- DispY=0
- CIncZ=colors.orange
- CDecZ=colors.lightBlue
- CIncMZ=colors.gray
- CDecMZ=colors.black
- DispZ=0
- PWR=colors.brown
- MULInc=colors.pink
- MULDec=colors.lime
- interval = 0.2
- Side="bottom"
- MUL=0
- BuffX=0
- BuffY=0
- BuffZ=0
- function resetDir()
- impulse(63,CDecX)
- impulse(63,CDecMX)
- impulse(63,CDecY)
- impulse(63,CDecMY)
- impulse(63,CDecZ)
- impulse(63,CDecMZ)
- impulse(24,MULDec)
- end
- function ChDir()
- local sx=""
- local sy=""
- local sz=""
- print("X")
- BuffX=read()
- print("Y")
- BuffY=read()
- print("Z")
- BuffZ=read()
- print("M")
- MUL=read()
- SetDir()
- end
- function SetDir()
- local CSum=0
- if abs(BuffX)>abs(BuffY) then n=abs(BuffX) else n=abs(BuffY)
- if n<abs(BuffZ) then n=abs(BuffZ)
- if BuffX>0 and DispX<0 then impulse(DispX,CDecX)
- if BuffX<0 and DispX>0 then impulse(DispX,CDecMX)
- if BuffY>0 and DispY<0 then impulse(DispY,CDecY)
- if BuffY<0 and DispY>0 then impulse(DispY,CDecMY)
- if BuffZ>0 and DispZ<0 then impulse(DispZ,CDecZ)
- if BuffZ<0 and DispZ>0 then impulse(DispZ,CDecMZ)
- x=BuffX
- y=BuffY
- z=BuffZ
- for j = 1,n do
- if x>DispX and BuffX<0 then begin CSum=Csum+CDecMX x=x-1 end
- if x<DispX and BuffX<0 then begin CSum=Csum+CIncMX x=x+1 end
- if x>DispX and BuffX>0 then begin CSum=Csum+CDecX x=x-1 end
- if x<DispX and BuffX>0 then begin CSum=Csum+CIncX x=x+1 end
- if y>DispX and BuffY<0 then begin CSum=Csum+CDecMY y=y-1 end
- if y<DispX and BuffY<0 then begin CSum=Csum+CIncMY y=y+1 end
- if y>DispX and BuffY>0 then begin CSum=Csum+CDecY y=y-1 end
- if y<DispX and BuffY>0 then begin CSum=Csum+CIncY y=y+1 end
- if z>DispX and BuffZ<0 then begin CSum=Csum+CDecMZ z=z-1 end
- if z<DispX and BuffZ<0 then begin CSum=Csum+CIncMZ z=z+1 end
- if z>DispX and BuffZ>0 then begin CSum=Csum+CDecZ z=z-1 end
- if z<DispX and BuffZ>0 then begin CSum=Csum+CIncZ z=z+1 end
- impulse(1, CSnum)
- CSnum=0
- end
- BuffX=DispX
- print("finished!")
- end
- function impulse(n, clr)
- for j = 1,n do
- rs.setBundledOutput(SIDE, clr)
- sleep(interval)
- rs.setBundledOutput(SIDE, 0)
- sleep(interval)
- end
- end
- function Parser(input)
- if input == "exit" then exit()
- if input == "dir" then ChDir()
- if input == "jmp" then JMP()
- if input == "resetdir" then ResetDir()
- end
- function JMP()
- print("jumping...")
- rs.setBundledOutput(SIDE, clr)
- sleep(3*interval)
- rs.setBundledOutput(SIDE, 0)
- sleep(interval)
- print("finished!")
- end
- end
- repeat
- input = read()
- Parser(input)
- while input !="exit"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement