LoginSignup
0
0

More than 1 year has passed since last update.

マイクラチュートリアル6-2 送信機プログラム

Posted at
-- 送信
local args = {...}
local id = tonumber(args[1])
rednet.open("back")

local table = {
  w = "turtle.forward()",
  a = "turtle.turnLeft() turtle.forward() turtle.turnRight()",
  d = "turtle.turnRight() turtle.forward() turtle.turnLeft()",
  space = "turtle.up()",
  leftShift = "turtle.down()",
  right = "turtle.turnRight()",
  left = "turtle.turnLeft()"
}


print("Press 'q' to terminate")

while true do
  local event, scancode = os.pullEvent("key")
  local key = keys.getName(scancode)

  if key == "q" then
    break
  end

  local message = table[key]
  print(key, "=>" , message or "none")

  if message then
    rednet.send(id, message)
  end

end
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0