Advertisement
Entityreborn

Sender

Apr 26th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. --[[ startup
  2. id="ZpfzEeat"
  3. loadstring(http.get("http://pastebin.com/raw.php?i=" .. id).readAll())()
  4. ]]--
  5.  
  6. modem = false
  7. myChannel = 6635
  8. targetChannel = 6636
  9.  
  10. for a,b in pairs(rs.getSides()) do
  11.     if peripheral.getType(b) == 'modem' then
  12.         print("Found modem on " .. b .. ", attaching to " .. myChannel)
  13.         modem = peripheral.wrap(b)
  14.         modem.open(myChannel)
  15.         break
  16.     end
  17. end
  18.  
  19. print("Press W to move north, Z to move south, A to west, S to move east, E to move up and D to move down.")
  20.  
  21. while true do
  22.     local event, key = os.pullEvent("key") -- limit os.pullEvent to the 'key' event
  23.     local tosend = false
  24.  
  25.     if key == keys.w then
  26.         tosend = "move.north"
  27.     elseif key == keys.z then
  28.         tosend = "move.south"
  29.     elseif key == keys.a then
  30.         tosend = "move.west"
  31.     elseif key == keys.s then
  32.         tosend = "move.east"
  33.     elseif key == keys.e then
  34.         tosend = "move.up"
  35.     elseif key == keys.d then
  36.         tosend = "move.down"
  37.     end
  38.  
  39.     if tosend then
  40.         modem.transmit(targetChannel, myChannel, tosend)
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement