View difference between Paste ID: wnVuibNE and NQsMzQpu
SHOW: | | - or go back to the newest paste.
1-
local programPath="frameengine/move"
1+
local programPath="frameengine/frame"
2
local args={...}
3-
local runningProgram=shell.getRunningProgram()
3+
local runningProgram=""
4
local transmitter
5
local trasmitterSide
6
local intervalBetweenPulses=1.5
7
8
local frequencies={
9
  north=3401,
10
  east=3402,
11
  south=3403,
12
  west=3404,
13
  up=3405,
14
  down=3406
15
}
16
17
if shell~=nil then
18
    runningProgram=shell.getRunningProgram()
19-
  if peripheral.getType(side)=="wireless-transmitter" then
19+
20
21
-- initialize the wireless transmitter
22
for i, side in pairs(redstone.getSides()) do
23
  if peripheral.getType(side)=="wirelessRedstone" then
24
    transmitter=peripheral.wrap(side)
25
    trasmitterSide=side
26
  end
27
end
28
29
if transmitter==nil then
30
  print("No wireless transmitter found!")
31
  return
32-
  redstone.setOutput(trasmitterSide, true)
32+
33
34-
  redstone.setOutput(trasmitterSide, false)
34+
35
  transmitter.setFreq(frequency)
36
  transmitter.set(true)
37
  sleep(0.1)
38
  transmitter.set(false)
39
end
40
41
function move(direction, count)
42
  for i=1, count*2 do
43
    pulse(frequencies[direction])
44
    sleep(intervalBetweenPulses)
45
  end
46
end
47
48
function runMoveCommand()
49
  if #args==2 then
50
    move(args[1], tonumber(args[2]))
51
  else
52
    print("move [north/south/west/east/up/down] [number of blocks]")
53
  end
54
end
55
56
if runningProgram==programPath then
57
  runMoveCommand()
58
end