Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local programPath="frameengine/frame"
- local args={...}
- local runningProgram=""
- local transmitter
- local trasmitterSide
- local intervalBetweenPulses=1.5
- local frequencies={
- north=3401,
- east=3402,
- south=3403,
- west=3404,
- up=3405,
- down=3406
- }
- if shell~=nil then
- runningProgram=shell.getRunningProgram()
- end
- -- initialize the wireless transmitter
- for i, side in pairs(redstone.getSides()) do
- if peripheral.getType(side)=="wirelessRedstone" then
- transmitter=peripheral.wrap(side)
- trasmitterSide=side
- end
- end
- if transmitter==nil then
- print("No wireless transmitter found!")
- return
- end
- function pulse(frequency)
- transmitter.setFreq(frequency)
- transmitter.set(true)
- sleep(0.1)
- transmitter.set(false)
- end
- function move(direction, count)
- for i=1, count*2 do
- pulse(frequencies[direction])
- sleep(intervalBetweenPulses)
- end
- end
- function runMoveCommand()
- if #args==2 then
- move(args[1], tonumber(args[2]))
- else
- print("move [north/south/west/east/up/down] [number of blocks]")
- end
- end
- if runningProgram==programPath then
- runMoveCommand()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement