Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```lua
- local chat = peripheral.find("warpdriveVirtualAssistant")
- local speaker = peripheral.find("warpdriveSpeaker")
- if not chat then print("Assistant Not Found...")
- if speaker then speaker.speak("Assistant not found")
- end
- end
- --Define Name
- chat.name("[name")
- --Speaker shall speak
- local function speak(a)
- speaker.speak("[".."Auto Nav".."]: "..a)
- end
- while true do
- sleep(0.08)
- local state = 0
- local CMD = 0
- state, CMD = chat.pullLastCommand()
- string = string.lower(CMD)
- -- Match and extract X and Z
- local x_value, z_value = string:match("x:(%d+),%s*y:%d+,%s*z:(%d+)")
- if state then
- speak("X: "..x_value)
- -- Y is ignored for safety
- speak("Z: "..z_value)
- --same thing in text form
- print("X: "..x_value)
- -- Y is ignored for safety
- print("Z: "..z_value)
- end
- end
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement