summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_autopilot.lua
blob: 09c85c140a3290459aebcfa6cd35339a45011636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()