Index: /code/branches/presentationFS14/data/gui/scripts/testscript.lua
===================================================================
--- /code/branches/presentationFS14/data/gui/scripts/testscript.lua	(revision 10076)
+++ /code/branches/presentationFS14/data/gui/scripts/testscript.lua	(revision 10076)
@@ -0,0 +1,92 @@
+-- Set some test variables
+xm = 1000 
+ym = 0
+zm = 0
+
+xl = -1000 
+yl = 3000 
+zl = -1000
+
+xr = 2000
+yr = 500
+zr = 2000
+
+d = 5
+Tabs = 0
+
+pi = 3.1415
+
+-- Get a local pointer to a scriptcontroller
+local ctrl = orxonox.ScriptController:getScriptController()
+
+-- If it worked, call its "movetoposition" function
+if ctrl ~= nil then
+  -- Move to the starting point at (xl+3000,yl,zl) while looking 
+  -- at xl,yl,zl over the time span of 3 seconds
+  ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
+
+  -- From there, perform a rotation around the harvester placed there
+  -- in 100 steps
+  dt = math.pi/100
+  for t = 0,math.pi,dt do
+    xt = math.cos(t)
+    yt = math.sin(t)
+
+    ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
+  end
+
+
+  -- Update absolute time
+  Tabs = math.pi + 0.9
+
+  
+
+  -- Move away again, still looking at the station
+  ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
+
+
+
+  -- Update absolute time
+  Tabs = Tabs + 0.4 + 3
+
+  
+
+  
+
+  -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
+  ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2, Tabs+0.2)
+
+  Tabs = Tabs + 2 + 0.2
+
+   ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4, Tabs+0)
+
+   Tabs = Tabs + 4 
+
+  for t = 0,math.pi,dt do
+    xt = math.cos(t)
+    zt = math.sin(t)
+
+    ctrl:eventScheduler("mal", xr+600*xt, yr, zr+600*zt, xr, yr, zr, dt, Tabs+t)
+  end
+
+  Tabs = Tabs + math.pi
+
+  ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3, Tabs+0.2)
+
+  Tabs = Tabs + 3 + 0.2
+
+  ctrl:eventScheduler("mal", xm,ym,zm, xl,yl,zl, 4, Tabs+2.5)
+
+
+end
+
+
+
+-- Output the newctrlid variable we set from the C++ code
+if newctrlid ~= nil then
+  orxonox.execute("orxout message test " .. newctrlid)
+end
+
+--orxonox.execute("setPause 1")
+
+
Index: /code/branches/presentationFS14/data/levels/levelTry.oxw
===================================================================
--- /code/branches/presentationFS14/data/levels/levelTry.oxw	(revision 10076)
+++ /code/branches/presentationFS14/data/levels/levelTry.oxw	(revision 10076)
@@ -0,0 +1,178 @@
+<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
+<LevelInfo
+ name = "levelTry"
+ description = "Docking into a spacestation."
+ tags = "showcase"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+  include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipAssff.oxt")
+  include("templates/spaceshipPirate.oxt")
+  include("templates/spaceshipEscort.oxt")
+  include("templates/bigship.oxt")
+  include("templates/spaceshipTurret.oxt")
+  include("templates/spaceshipCollateralDamage.oxt")
+  include("templates/FPS.oxt")
+?>
+
+<Level
+  gametype = Deathmatch
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
+  <Scene
+    ambientlight = "0.5, 0.5, 0.5"
+    skybox       = "Orxonox/Starbox"
+    negativeWorldRange = "-100000, -100000, -100000"
+    positiveWorldRange = " 100000,  100000,  100000"
+    gravity      = "0,0,0"
+    hasPhysics   = true
+  >
+
+    <?lua
+      include("includes/pickups.oxi")
+    ?>
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
+    <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+    <!--
+    <StaticEntity position  = "2800,0,0" mass=10000 collisionType=static >
+      <attached>
+        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" />
+        <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
+        <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
+        <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" />
+        <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
+        <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" />
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
+        <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 />
+        <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" />
+        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
+        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
+        <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 />
+        <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
+        <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
+      </collisionShapes>
+    </StaticEntity>
+    -->
+
+
+    <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
+    <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
+      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
+    />
+
+    <StaticEntity position  = "2000,500,2000" mass=10000 collisionType=static >
+      <attached>
+        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
+      </attached>
+    </StaticEntity>
+
+    <StaticEntity position  = "-1000,3000,-1000" mass=10000 collisionType=static >
+      <attached>
+        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
+      </attached>
+    </StaticEntity>
+
+
+
+
+<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
+    <ControllerDirector position="0,0,0">
+        <events>
+            <takeControl>
+                <EventListener event="takeControl" />
+            </takeControl>
+        </events>
+    </ControllerDirector>
+
+<!-- FPS Player as destination of the dock -->
+<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
+      <attached>
+        <DockingTarget name="spaceShip" />
+        <DistanceTriggerBeacon name="bcnDestroyer" />
+        <DockingTarget name="destroyer" />
+      </attached>
+</FpsPlayer>
+
+
+<!-- Cube as test SpaceStation
+
+The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
+Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
+
+-->
+  <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
+      <attached>
+        <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
+      </collisionShapes>
+  </StaticEntity>
+
+<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
+<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
+
+
+<!-- Some more stuff -->
+
+    <!-- triple large belt around the planet  -->
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
+    ?>
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
+    ?>
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
+    ?>
+
+    <Planet
+      position="15000,0,-1000"
+      scale="5000"
+      collisionType="dynamic"
+      linearDamping="0.8"
+      angularDamping="0"
+      mass="10000000"
+      pitch="0"
+      mesh="planets/ganymede.mesh"
+      atmosphere="atmosphere1"
+      rotationaxis="1,0,0"
+      rotationrate="1.0"
+      atmospheresize="80.0f"
+      imagesize="1024.0f"
+      collisiondamage = 2
+      enablecollisiondamage = true
+    >
+      <attached>
+        <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="5000" position="0,0,0" />
+      </collisionShapes>
+    </Planet>
+
+  </Scene>
+
+</Level>
+
Index: /code/branches/presentationFS14/data/levels/michaelstestfile.lua
===================================================================
--- /code/branches/presentationFS14/data/levels/michaelstestfile.lua	(revision 10076)
+++ /code/branches/presentationFS14/data/levels/michaelstestfile.lua	(revision 10076)
@@ -0,0 +1,1 @@
+orxout("event: theme")
Index: /code/branches/presentationFS14/data/levels/scriptController.oxw
===================================================================
--- /code/branches/presentationFS14/data/levels/scriptController.oxw	(revision 10076)
+++ /code/branches/presentationFS14/data/levels/scriptController.oxw	(revision 10076)
@@ -0,0 +1,198 @@
+<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
+<LevelInfo
+ name = "Fancy orxout tests"
+ description = "Docking into a spacestation."
+ tags = "showcase"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+  include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipAssff.oxt")
+  include("templates/spaceshipPirate.oxt")
+  include("templates/spaceshipEscort.oxt")
+  include("templates/bigship.oxt")
+  include("templates/spaceshipTurret.oxt")
+  include("templates/spaceshipCollateralDamage.oxt")
+  include("templates/FPS.oxt")
+?>
+
+<Level
+  gametype = Deathmatch
+>
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+
+  <Scene
+    ambientlight = "0.5, 0.5, 0.5"
+    skybox       = "Orxonox/Starbox"
+    negativeWorldRange = "-100000, -100000, -100000"
+    positiveWorldRange = " 100000,  100000,  100000"
+    gravity      = "0,0,0"
+    hasPhysics   = true
+  >
+
+    <?lua
+      include("includes/pickups.oxi")
+    ?>
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
+    <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+    <StaticEntity position  = "2800,0,0" mass=10000 collisionType=static >
+      <attached>
+        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
+        <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
+        <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
+        <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
+        <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
+        <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
+        <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
+        <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
+        <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
+        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
+        <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
+        <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
+        <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
+        <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
+      </collisionShapes>
+    </StaticEntity>
+
+<!-- Docking  -->
+    <Dock position="2830,20,50" roll=0 yaw=0 >
+        <animations>
+            <MoveToDockingTarget target="destroyer" />
+        </animations>
+        <effects>
+            <DockToShip target="spaceShip" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="dockMe" />
+            </execute>
+
+	    <undocking>
+		<EventListener event="undockMe" />
+	    </undocking>
+	
+            <activity>
+                <EventListener event=notGameEnd />
+            </activity>
+        </events>
+        <attached>
+	<!-- Trigger for docking with billboard -->
+
+		<!-- removed -->
+
+	<!-- Trigger for undocking with billboard -->
+	    <!-- <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 /> -->
+	    <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
+                beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
+            />
+        </attached>
+    </Dock>
+
+    <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
+    <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
+      beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
+    />
+
+
+<!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING  -->
+    <ScriptController position="0,0,0">
+        <events>
+            <party>
+                <EventListener event="dockMe" />
+            </party>
+
+        </events>
+
+    </ScriptController>
+
+
+<!-- FPS Player as destination of the dock -->
+<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
+      <attached>
+        <DockingTarget name="spaceShip" />
+        <DistanceTriggerBeacon name="bcnDestroyer" />
+        <DockingTarget name="destroyer" />
+      </attached>
+</FpsPlayer>
+
+
+<!-- Cube as test SpaceStation
+
+The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
+Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
+
+-->
+  <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
+      <attached>
+        <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
+      </collisionShapes>
+  </StaticEntity>
+
+<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
+<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
+
+
+<!-- Some more stuff -->
+
+    <!-- triple large belt around the planet  -->
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
+    ?>
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
+    ?>
+    <?lua
+        dofile("includes/asteroidField.lua")
+        asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
+    ?>
+
+    <Planet
+      position="15000,0,-1000"
+      scale="5000"
+      collisionType="dynamic"
+      linearDamping="0.8"
+      angularDamping="0"
+      mass="10000000"
+      pitch="0"
+      mesh="planets/ganymede.mesh"
+      atmosphere="atmosphere1"
+      rotationaxis="1,0,0"
+      rotationrate="1.0"
+      atmospheresize="80.0f"
+      imagesize="1024.0f"
+      collisiondamage = 2
+      enablecollisiondamage = true
+    >
+      <attached>
+        <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="5000" position="0,0,0" />
+      </collisionShapes>
+    </Planet>
+
+  </Scene>
+
+</Level>
+
Index: /code/branches/presentationFS14/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/presentationFS14/src/orxonox/CMakeLists.txt	(revision 10075)
+++ /code/branches/presentationFS14/src/orxonox/CMakeLists.txt	(revision 10076)
@@ -65,4 +65,5 @@
     infos/PlayerInfo.h
     sound/SoundManager.h
+    controllers/ScriptController.h
   PCH_FILE
     OrxonoxPrecompiledHeaders.h
Index: /code/branches/presentationFS14/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/CMakeLists.txt	(revision 10075)
+++ /code/branches/presentationFS14/src/orxonox/controllers/CMakeLists.txt	(revision 10076)
@@ -10,3 +10,4 @@
   DroneController.cc
   FormationController.cc
+  ControllerDirector.cc
 )
Index: /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.cc
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.cc	(revision 10076)
+++ /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.cc	(revision 10076)
@@ -0,0 +1,158 @@
+/*
+ * First try of a ControllerDirector. Target: An event occurs in the levelTry.oxw
+ * file, which is "heard" by an object of the type of this class. It then SHOULD
+ * (because it is not working) execute the party function.
+ */
+
+#include "ControllerDirector.h"
+#include "ScriptController.h"
+#include "core/CoreIncludes.h"
+
+//#include "network/NetworkFunction.h"
+
+#include "infos/HumanPlayer.h"
+#include "interfaces/PlayerTrigger.h"
+#include "worldentities/pawns/Pawn.h"
+#include "core/LuaState.h"
+
+
+namespace orxonox
+{
+    RegisterClass(ControllerDirector);
+
+    ControllerDirector::ControllerDirector(Context* context) : ArtificialController(context)
+    {
+        // Register the object with the framework
+        RegisterObject(ControllerDirector);
+
+        // output a message to ensure we know the constructor was run
+        orxout()<<"hello universe constructor blablub"<< endl;
+
+
+
+        // Initialize member variables
+        this->player_ = NULL;
+        this->entity_ = NULL;
+        this->pTrigger_ = NULL;
+        this->context_ = context;
+    }
+
+    void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ControllerDirector, XMLPort, xmlelement, mode);
+
+        orxout()<< "ControllerDirector::XMLPort " 
+          << "An instance of ControllerDirector has been created." << endl;
+    }
+
+    void ControllerDirector::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        // Call the xmleventport functions of the classes we derive from
+        SUPER(ControllerDirector, XMLEventPort, xmlelement, mode);
+
+        // Add an event sink for a "takeControl" event, which leads to the
+        // function takeControl() being called.
+        XMLPortEventSink(ControllerDirector, BaseObject, "takeControl", 
+          takeControl, xmlelement, mode);
+    }
+
+
+
+
+    void ControllerDirector::takeControl(Controller * controller, BaseObject * trigger) 
+    {
+       /* Output a message confirming that the function was called */
+       orxout()<<"test takecontrol."<< endl;
+
+       /* First, we set up a new controller to attach to the unit that
+        * triggered our event. 
+        */
+       static int ctrlid = 1;
+       bool prepok = preparationToTakeControl(trigger);
+       if( prepok == true) 
+       {
+         /* Create a scriptcontroller object */
+         ScriptController *newctrl = new ScriptController(this->context_);
+
+         /* Make the player we were given its slave */
+         newctrl->setPlayer(this->player_);
+
+         /* Start controlling that object */
+         newctrl->takeControl(ctrlid);
+       }
+       else
+         return;
+       
+       /* Set up a luastate to use for running the scripts */
+       LuaState * ls = new LuaState();
+       
+       /* Assemble a string to define a controller id variable in lua space */
+       std::stringstream tmp;
+       tmp << "newctrlid = " << ctrlid << endl;
+       std::string todo = tmp.str();
+       
+       /* Run the string using the luastate created earlier */
+       ls->doString(todo);
+
+       /* Now run the script on this controller. This will still have the above
+        * variable "newctrlid" defined, which means it can make use of it.
+        */
+
+       ls->doFile("testscript.lua");
+
+       /* Increase the controller ID so we have a different one for
+        * the next time it is triggered */
+       ctrlid += 1;
+    } 
+
+	
+    bool ControllerDirector::preparationToTakeControl(BaseObject * trigger) 
+    {
+        this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger);
+        this->player_ = NULL;
+
+        orxout() << "Preparation to take Control!" << endl; 
+
+        // Check whether it is a player trigger and extract pawn from it
+        if(this->pTrigger_ != NULL)
+        {
+            // Get the object which triggered the event.
+            this->player_ = this->pTrigger_->getTriggeringPlayer();  
+
+            // Check if there actually was a player returned.
+            if( this->player_ == NULL) return false;
+        }
+        else
+        {
+            orxout() << "ControllerDirector::preparationToTakeControl " 
+              << "Not a player trigger, can't extract pawn from it.." << endl;
+            return false;
+        }
+
+	this->entity_ = this->player_->getControllableEntity();
+	assert(this->entity_);
+
+        return true;
+    }
+
+    /* // Currently unused
+    void ControllerDirector::setNewController(Controller * controller) {
+
+
+        orxout() << "New Controller is going to be set!" << endl;
+
+        this->entity_->setDestroyWhenPlayerLeft(false);
+        this->player_->pauseControl();
+        this->entity_->setController(controller);
+        this->player_->startControl(this->entity_);
+        //this->setControllableEntity(this->entity_);
+    }
+    */
+       
+    
+
+}
+
+
+
+
Index: /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.h
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.h	(revision 10076)
+++ /code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.h	(revision 10076)
@@ -0,0 +1,70 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ControllerDirector_H__
+#define _ControllerDirector_H__
+
+#include "OrxonoxPrereqs.h"
+#include "ArtificialController.h"
+#include "core/EventIncludes.h"
+
+
+namespace orxonox
+{
+    class _OrxonoxExport ControllerDirector : public ArtificialController
+    {
+        public:
+            ControllerDirector(Context* context);
+            virtual ~ControllerDirector() { }
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            bool party(bool bTriggered, BaseObject* trigger);
+	    virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+	
+	
+            /* Take over control of a given object */
+	    void takeControl(Controller * controller, BaseObject * trigger);
+	    bool preparationToTakeControl(BaseObject * trigger);
+
+            // currently unused
+	    //void setNewController(Controller * controller);
+	
+
+
+        private:
+	   
+            PlayerInfo* player_;
+            ControllableEntity* entity_; 
+            PlayerTrigger * pTrigger_;
+            Context* context_;
+	
+
+    };
+}
+
+#endif /* _ControllerDirector_H__ */
Index: /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.cc
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.cc	(revision 10075)
+++ /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.cc	(revision 10076)
@@ -28,5 +28,9 @@
 
 #include "ScriptController.h"
+#include "infos/PlayerInfo.h"
 #include "core/CoreIncludes.h"
+#include "worldentities/ControllableEntity.h"
+#include "core/LuaState.h"
+#include <cmath>
 
 namespace orxonox
@@ -37,4 +41,222 @@
     {
         RegisterObject(ScriptController);
+
+        /* By default, this controller has ID 0, which means it is not assigned
+         * to anything yet. 
+         */
+        this->ctrlid_ = 0;
+
+        /* Set default values for all variables */
+        /* - pointers to zero */
+        this->player_ = NULL;
+        this->entity_ = NULL;
+
+        /* - times */
+        this->scTime = 0.0f;
+        this->eventTime = 0.0f;
+
+        /* - Points in space */
+        this->startpos = Vector3(0,0,0);
+        //this->lookAtPosition = Vector3(0,0,0);
+
+        /* - Processing flag */
+        this->processing = false;
+
+        /* - Counters */
+        this->eventno = 0;
+
+    }
+
+    void ScriptController::takeControl(int ctrlid)
+    {
+        /* Output some debugging information */
+        orxout() << "ScriptController: Taking control" << endl;
+        orxout() << "This-pointer: " << this << endl;
+
+        /* Set the controller ID (the argument here should be nonzero) */
+        this->ctrlid_ = ctrlid;
+
+        /* Store the entity pointer in a private variable */
+        this->entity_ = this->player_->getControllableEntity();
+        assert(this->entity_);
+         
+        /* Add the controller here to this entity. Apparently this still leaves
+         * any preexisting human controllers in place. 
+         */
+        this->entity_->setDestroyWhenPlayerLeft(false);
+        this->player_->pauseControl();
+        this->entity_->setController(this);
+        this->setControllableEntity(this->entity_);
+        this->entity_->mouseLook();
+        this->entity_->setVisible(false);
+    }
+
+    const Vector3& ScriptController::getPosition()
+    {
+      return this->entity_->getPosition();
+    }
+
+    ScriptController* ScriptController::getScriptController()
+    {
+      /* Output a message that confirms this function was called */
+      orxout() << "Great success!" << std::endl;
+
+      /* Debugging: print all the scriptcontroller object pointers */
+      for(ObjectList<ScriptController>::iterator it = 
+        ObjectList<ScriptController>::begin(); 
+        it != ObjectList<ScriptController>::end(); ++it)
+      { orxout() << "Have object in list: " << *it << endl; }
+
+      /* Find the first one with a nonzero ID */
+      for(ObjectList<ScriptController>::iterator it = 
+        ObjectList<ScriptController>::begin(); 
+        it != ObjectList<ScriptController>::end(); ++it)
+      { 
+        // TODO: do some selection here. Currently just returns the first one
+        if( (*it)->getID() > 0 )
+        { orxout() << "Controller to return: " << *it << endl;
+          return *it; 
+        }
+      
+      }
+      return NULL;
+    }
+
+    void ScriptController::execute(event ev)
+    {
+        /* Debugging output */
+        //orxout() << "Executing event " << ev.fctName 
+          //<< " with parameters:\n " 
+          //<< ev.x1 << " " << ev.y1 << " " << ev.z1 << "\n"
+          //<< ev.x2 << " " << ev.y2 << " " << ev.z2 << "\n"
+          //<< ev.duration << endl;
+
+        /* Event is starting, hence set the time to 0 */
+        this->eventTime = 0.0f;
+        this->processing = true;
+
+        /* Copy the event into the currentEvent holder */
+        this->currentEvent = ev;
+
+        /* Store starting position */
+        this->startpos = this->entity_->getPosition();
+    }
+
+
+    void ScriptController::tick(float dt)
+    {
+        /* Call the tick function of the classes we derive from */
+        SUPER(ScriptController, tick, dt);
+
+        /* If this controller has no entity entry, do nothing */
+        if( !(this->entity_) ) return;
+
+        /* See if time has come for the next event to be run */
+        if(this->eventList.size() > 0 && this->eventList[0].eventTime <= scTime)
+        { /* Execute the next event on the list */
+          this->execute(this->eventList[0]);
+          this->eventList.erase(this->eventList.begin());
+          this->eventno -= 1;
+        }
+
+        /* Update the local timers in this object */
+        scTime += dt; eventTime += dt;
+
+        /* If we've arrived at the target, stop processing */
+        if( eventTime > currentEvent.duration && this->processing == true)
+        { this->processing = false;
+
+          /* If we reached the last event, also reenable the normal movement
+           * and make the model visible again
+           */
+          if( this->eventno == 0 )
+          {
+            this->entity_->mouseLook();
+            this->entity_->setVisible(true);
+          }
+        }
+
+        /* Get a variable that specifies how far along the trajectory
+         * we are 
+         */
+        float dl = eventTime / currentEvent.duration; 
+
+        /* Depending  */
+        /* Do some moving */
+        if( this->processing )
+        { 
+          if( this->currentEvent.fctName == "mal" )
+          {
+            /* Set the position to the correct place in the trajectory */
+            this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1);
+
+            /* Look at the specified position */
+            this->entity_->lookAt(this->currentEvent.v2);
+
+            /* Update look at position */
+            //this->lookAtPosition = this->currentEvent.v2;
+          }
+          else if( this->currentEvent.fctName == "chl" )
+          {
+            /* Sweep the look from v1 to v2 */
+            this->entity_->lookAt( (1-dl)*this->currentEvent.v1 + 
+              dl * this->currentEvent.v2 );
+          }
+
+
+          /* Force mouse look */
+          if( this->entity_->isInMouseLook() == false )
+            this->entity_->mouseLook();
+        }
+    }
+
+    void ScriptController::eventScheduler(std::string instruction, 
+      float x1, float y1, float z1, 
+      float x2, float y2, float z2, 
+      float duration, float executionTime)
+    {
+      /* put data (from LUA) into time-sorted eventList*/ 
+      /* Nimmt den befehl und die argumente aus luascript und ertellt einen
+       * struct pro event, diese structs werden sortiert nach eventTime
+       */
+      struct event tmp;
+
+      /* Fill the structure with all the provided information */
+      tmp.fctName = instruction;
+      //tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
+      //tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
+      tmp.v1 = Vector3(x1,y1,z1);
+      tmp.v2 = Vector3(x2,y2,z2);
+      tmp.duration = duration;
+      tmp.eventTime = executionTime;
+
+      orxout() << tmp.fctName << endl;
+
+      /* Add the created event to the event list */
+      if(eventList.size()==0)
+      { /* The list is still empty, just add it */
+        orxout() << "eventList empty (01)" << endl;
+        eventList.insert(eventList.begin(), tmp);
+        this->eventno += 1;
+        return; /* Nothing more to do, the event was added */
+      }
+
+      /* Event was not added yet since the list was not empty. Walk through
+       * the list of events and add it so that the events are correctly in
+       * order.
+       */
+      for (std::vector<event>::iterator it=eventList.begin(); it<eventList.end(); it++)
+      { if(tmp.eventTime < it->eventTime)
+        { eventList.insert(it,tmp);
+          this->eventno += 1;
+          //orxout()<<"new event added"<<endl;
+          return;
+        }
+      }
+
+      /* If the event was still not added here, it belongs in the end of the list */
+      eventList.insert(eventList.end(), tmp);
+      this->eventno += 1;
+
     }
 }
Index: /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.h
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.h	(revision 10075)
+++ /code/branches/presentationFS14/src/orxonox/controllers/ScriptController.h	(revision 10076)
@@ -30,18 +30,95 @@
 #define _ScriptController_H__
 
-#include "OrxonoxPrereqs.h"
+#include "OrxonoxPrereqs.h"                 /* die ganzen tolua, kopiert aus Dock.h*/
 #include "ArtificialController.h"
+#include "core/EventIncludes.h"
 
-namespace orxonox
-{
-    class _OrxonoxExport ScriptController : public ArtificialController
-    {
+
+
+namespace orxonox  // tolua_export
+{  // tolua_export
+
+    /** Structure to describe a single event */
+    struct event 
+    {   
+        /** Instruction for this event */
+        std::string fctName;
+
+        Vector3 v1;
+        Vector3 v2;
+
+        /** Time span of the event */
+        float duration;
+
+        /** Start point in time of the event */
+        float eventTime;
+    }; 
+
+    class _OrxonoxExport ScriptController // tolua_export 
+       : public ArtificialController, public Tickable
+    {  // tolua_export
         public:
             ScriptController(Context* context);
             virtual ~ScriptController() { }
 
+            void takeControl(int ctrlid);
+            void setPlayer(PlayerInfo* player) { this->player_ = player; }
+           
+            virtual void tick(float dt);
+
+            // LUA interface
+            // tolua_begin 
+            void eventScheduler(std::string instruction, 
+              float x1, float y1, float z1, 
+              float x2, float y2, float z2, 
+              float duration, float executionTime);
+
+            static ScriptController* getScriptController();
+
+            int getID() { return ctrlid_; }
+
+            // tolua_end
+            const Vector3& getPosition();
+
+            void execute(event ev);
+
         private:
-    };
-}
+            /* Information about the player that this ScriptController will
+             * control */
+            /* - Player pointer */
+            PlayerInfo* player_;
+
+            /* - Entity pointer, this is for convenience and will be the same as 
+             *   player_->getControllableEntity() 
+             */
+            ControllableEntity* entity_;
+
+            /* Controller ID, defaults to 0 and is set using takeControl() */
+            int ctrlid_;
+
+            /* List of events to walk through */
+            std::vector<event> eventList;
+            unsigned int eventno;
+
+            /* Time since the creation of this ScriptController object */
+            float scTime;  
+
+            /* Boolean that specifies whether we're processing an event right
+             * now */
+            bool processing;
+
+            /* Data about the event currently being processed */
+            /* - The event itself */
+            event currentEvent;
+
+            /* - Time this event has been going on for */
+            float eventTime;
+            Vector3 startpos;
+
+            /* - Position to look at during that transition */
+            //Vector3 lookAtPosition;
+
+    };// tolua_export
+} // tolua_export
 
 #endif /* _ScriptController_H__ */
Index: /code/branches/presentationFS14/src/orxonox/controllers/testscript.lua
===================================================================
--- /code/branches/presentationFS14/src/orxonox/controllers/testscript.lua	(revision 10076)
+++ /code/branches/presentationFS14/src/orxonox/controllers/testscript.lua	(revision 10076)
@@ -0,0 +1,1 @@
+print	('1: Hello World')
