Index: code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc	(revision 10065)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc	(revision 10066)
@@ -47,5 +47,4 @@
         this->ctrlid_ = 0;
 
-
         /* Set default values for all variables */
         /* - pointers to zero */
@@ -55,11 +54,9 @@
         /* - times */
         this->scTime = 0.0f;
-        this->timeToTarget = 0.0f;
         this->eventTime = 0.0f;
 
         /* - Points in space */
-        this->target = Vector3(0,0,0);
         this->startpos = Vector3(0,0,0);
-        this->lookAtPosition = Vector3(0,0,0);
+        //this->lookAtPosition = Vector3(0,0,0);
 
         /* - Processing flag */
@@ -95,12 +92,4 @@
     }
 
-    /* Yet to be implemented and tested */
-    //void ScriptController::yieldControl()
-    //{
-        //this->player_->startControl(this->entity_);
-        //this->setActive(false);
-        //this->controllableEntity_ = NULL;
-    //}
-
     const Vector3& ScriptController::getPosition()
     {
@@ -136,16 +125,20 @@
     void ScriptController::execute(event ev)
     {
-        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;
-
+        /* 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();
-        this->processing = true;
-
-        if(ev.fctName == "mal")
-          moveAndLook(ev.x1, ev.y1, ev.z1, ev.x2, ev.y2, ev.z2, ev.duration);
     }
 
@@ -157,31 +150,24 @@
 
         /* If this controller has no entity entry, do nothing */
-        if( !(this->entity_) )
-          return;
-
-        //orxout() << "Size 0: " << this->eventList.size() << endl;
+        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 */
+        { /* Execute the next event on the list */
           this->execute(this->eventList[0]);
           this->eventList.erase(this->eventList.begin());
           this->eventno -= 1;
-          //orxout() << "Size 1: " << this->eventList.size() << endl;
-          //orxout() << "Eventno is now: " << this->eventno << endl;
         }
 
         /* Update the local timers in this object */
-        scTime += dt;
-        eventTime += dt;
+        scTime += dt; eventTime += dt;
 
         /* If we've arrived at the target, stop processing */
-        if( eventTime > timeToTarget && this->processing == true)
+        if( eventTime > currentEvent.duration && this->processing == true)
         { this->processing = false;
 
-          //orxout() << "Size 4: " << this->eventList.size() << endl;
-          //orxout() << "Eventno: " << this->eventno << endl;
-          
+          /* If we reached the last event, also reenable the normal movement
+           * and make the model visible again
+           */
           if( this->eventno == 0 )
           {
@@ -194,14 +180,28 @@
          * we are 
          */
-        float dl = eventTime / timeToTarget; 
-
+        float dl = eventTime / currentEvent.duration; 
+
+        /* Depending  */
         /* Do some moving */
         if( this->processing )
         { 
-          /* Set the position to the correct place in the trajectory */
-          this->entity_->setPosition( (1-dl)*startpos + dl * target );
-
-          /* Look at the specified position */
-          this->entity_->lookAt(lookAtPosition);
+          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 */
@@ -209,30 +209,4 @@
             this->entity_->mouseLook();
         }
-    }
-
-    void ScriptController::moveAndLook(
-      float xm, float ym, float zm,
-      float xl, float yl, float zl,
-      float t )
-    {
-      orxout()<<"moveAndLook executed"<<endl;
-
-      /* Set the local variables required for this event */
-      this->target = Vector3(xm,ym,zm);
-      this->lookAtPosition = Vector3(xl,yl,zl);
-      this->timeToTarget = t;
-
-
-      orxout() << "Moving This-pointer: " << this << endl;
-
-      if(this->entity_ != NULL)
-        orxout()<<"not-NULL-entity"<<endl;
-      else 
-        return;
-
-      if(this->player_ != NULL)
-        orxout()<<"not-NULL-player"<<endl;
-      else 
-        return;
     }
 
@@ -250,6 +224,8 @@
       /* 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.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;
Index: code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h	(revision 10065)
+++ code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h	(revision 10066)
@@ -39,19 +39,18 @@
 {  // tolua_export
 
+    /** Structure to describe a single event */
     struct event 
     {   
+        /** Instruction for this event */
         std::string fctName;
-        float x1;
-        float y1;
-        float z1;
 
-        float x2;
-        float y2;
-        float z2;
+        Vector3 v1;
+        Vector3 v2;
 
+        /** Time span of the event */
         float duration;
 
+        /** Start point in time of the event */
         float eventTime;
-
     }; 
 
@@ -61,9 +60,6 @@
         public:
             ScriptController(Context* context);
-
             virtual ~ScriptController() { }
 
-            //virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            
             void takeControl(int ctrlid);
             void setPlayer(PlayerInfo* player) { this->player_ = player; }
@@ -73,7 +69,4 @@
             // LUA interface
             // tolua_begin 
-            void moveAndLook(float xm, float ym, float zm,
-              float xl, float yl, float zl, float t);
-
             void eventScheduler(std::string instruction, 
               float x1, float y1, float z1, 
@@ -115,10 +108,7 @@
             bool processing;
 
-            /* Data about the point to go to and what to look at */
-            /* - Target position */
-            Vector3 target;
-
-            /* - Time it should take to get there */
-            float timeToTarget;
+            /* Data about the event currently being processed */
+            /* - The event itself */
+            event currentEvent;
 
             /* - Time this event has been going on for */
@@ -127,5 +117,5 @@
 
             /* - Position to look at during that transition */
-            Vector3 lookAtPosition;
+            //Vector3 lookAtPosition;
 
     };// tolua_export
