summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_autopilot.lua
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/scripts/lua/test_autopilot.lua')
-rw-r--r--indra/newview/scripts/lua/test_autopilot.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/test_autopilot.lua b/indra/newview/scripts/lua/test_autopilot.lua
new file mode 100644
index 0000000000..09c85c140a
--- /dev/null
+++ b/indra/newview/scripts/lua/test_autopilot.lua
@@ -0,0 +1,22 @@
+local LLAgent = require 'LLAgent'
+local LLListener = require 'LLListener'
+
+local pos = LLAgent.getGlobalPosition()
+pos[1]+=10 -- delta x
+pos[2]+=5 -- delta y
+LLAgent.requestStand()
+LLAgent.startAutoPilot{target_global=pos,allow_flying=false,stop_distance=1}
+
+local listener = LLListener(LLAgent.autoPilotPump)
+
+function listener:handleMessages(event_data)
+ if event_data.success then
+ print('Destination is reached')
+ LLAgent.requestSit()
+ else
+ print('Failed to reach destination')
+ end
+ return false
+end
+
+listener:start()