Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Send keyboard inputs as rednet signals to a set ID
- peripheral.find("modem", rednet.open);
- local id = 0;
- local event, key;
- function setID()
- print("Setting new ID\nPress Right Ctrl to set");
- print("Last ID: "..tostring(id));
- key = 0;
- id = 0;
- while true do
- event, key = os.pullEvent("key");
- if key == 345 then
- break
- elseif key > 47 and key < 58 then
- id = id * 10 + (key - 48);
- print(tostring(id));
- end
- end
- print("ID set");
- end
- print("Change ID with Right Ctrl\nMove with wasd\nPlace with rfc\nDig with tgv\nInspect blocks with yhb\nGrab items with ujn\nDrop items with ikm\nRefuel with z\nChange slot with 1 and 2\nEquip new tool with x\nAttack with ol,");
- setID();
- while true do
- event, key = os.pullEvent("key");
- --print(tostring(key));
- if key == 345 then
- setID();
- else
- rednet.send(id, key);
- local id, message = rednet.receive();
- if key == 49 then
- print("Selected "..message);
- elseif message ~= "" then
- print(message);
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement