Advertisement
jaklsfjlsak

Dest虚拟助手3月13

Mar 13th, 2025
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. ```lua
  2. local chat = peripheral.find("warpdriveVirtualAssistant")
  3. local speaker = peripheral.find("warpdriveSpeaker")
  4.   if not chat then print("Assistant Not Found...")
  5.     if speaker then speaker.speak("Assistant not found")
  6.     end
  7.   end
  8.  
  9. --Define Name
  10. chat.name("[name")
  11.  
  12. --Speaker shall speak
  13. local function speak(a)
  14.         speaker.speak("[".."Auto Nav".."]: "..a)
  15. end
  16.  
  17.  
  18. while true do
  19. sleep(0.08)
  20. local state = 0
  21. local CMD = 0
  22.   state, CMD = chat.pullLastCommand()
  23.     string = string.lower(CMD)
  24.  
  25.       -- Match and extract X and Z
  26.  local x_value, z_value = string:match("x:(%d+),%s*y:%d+,%s*z:(%d+)")
  27.  
  28. if state then
  29.  speak("X: "..x_value)
  30.  -- Y is ignored for safety
  31.  speak("Z: "..z_value)
  32.  
  33.  --same thing in  text form
  34.   print("X: "..x_value)
  35.  -- Y is ignored for safety
  36.  print("Z: "..z_value)
  37. end
  38. end
  39. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement