Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ScriptableController/data/gui/scripts/testscript.lua @ 10072

Last change on this file since 10072 was 10066, checked in by smerkli, 11 years ago

Some cleanups, added a "change look" command

File size: 1.2 KB
RevLine 
[10065]1-- Set some test variables
2xm = 1000 
3ym = 0
4zm = 0
[10035]5
[10065]6xl = -1000 
7yl = 3000 
8zl = -1000
[10035]9
[10065]10d = 5
11Tabs = 0
[10035]12
[10065]13pi = 3.1415
[10037]14
[10047]15-- Get a local pointer to a scriptcontroller
[10045]16local ctrl = orxonox.ScriptController:getScriptController()
[10047]17
18-- If it worked, call its "movetoposition" function
[10046]19if ctrl ~= nil then
[10065]20  -- Move to the starting point at (xl+3000,yl,zl) while looking
21  -- at xl,yl,zl over the time span of 3 seconds
[10066]22  ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
[10065]23
24  -- From there, perform a rotation around the harvester placed there
25  -- in 100 steps
26  dt = math.pi/100
27  for t = 0,math.pi,dt do
28    xt = math.cos(t)
29    yt = math.sin(t)
30
[10066]31    ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
[10065]32  end
33
34  -- Update absolute time
[10066]35  Tabs = math.pi + 0.9
[10065]36
37  -- Move away again, still looking at the station
38  ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
39
[10066]40  -- Update absolute time
41  Tabs = Tabs + 0.4 + 3
[10065]42
[10066]43  -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
44  ctrl:eventScheduler("chl", xl, yl, zl, 3500, 0, 0, 3, Tabs)
45
[10046]46end
47
[10057]48
49
[10047]50-- Output the newctrlid variable we set from the C++ code
[10046]51if newctrlid ~= nil then
52  orxonox.execute("orxout message test " .. newctrlid)
53end
[10037]54
[10045]55--orxonox.execute("setPause 1")
[10037]56
[10045]57
Note: See TracBrowser for help on using the repository browser.