Index: code/trunk/data/gui/scripts/GameplayMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/GameplayMenu.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/GameplayMenu.lua	(revision 8858)
@@ -18,20 +18,20 @@
 function P.GameplayThemeCombobox_changed(e)
     -- theme
-    logMessage(0, "event: theme")
+    orxout("event: theme")
 end
 
 function P.GameplayDifficultyEasyButton_clicked(e)
     -- difficulty easy
-    logMessage(0, "event: easy")
+    orxout("event: easy")
 end
 
 function P.GameplayDifficultyNormalButton_clicked(e)
     -- difficulty normal
-    logMessage(0, "event: normal")
+    orxout("event: normal")
 end
 
 function P.GameplayDifficultyHardButton_clicked(e)
     -- difficulty hard
-    logMessage(0, "event: hard")
+    orxout("event: hard")
 end
 
Index: code/trunk/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/MultiplayerMenu.lua	(revision 8858)
@@ -117,8 +117,8 @@
         local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
         CEGUI.toListbox(listbox):resetList()
-        local discovery = orxonox.WANDiscovery:getInstance()
-        cout(0, "discovering.\n" )
+        local discovery = orxonox.WANDiscovery()
+        orxout("discovering." )
         discovery:discover()
-        cout(0, "discovered.\n" )
+        orxout("discovered." )
         P.serverList = {}
         local index = 0
Index: code/trunk/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua	(revision 8858)
@@ -136,5 +136,5 @@
     if index > queue.first then -- Move all older notifications up in the list.
         for i=index-1,-1,queue.first do
-            cout(0, i)
+            orxout(i)
             item = queue.items[i]
             item:setYposition(CEGUI.UDim(0, itemHeight*(queue.last-i-1)))
Index: code/trunk/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/trunk/data/gui/scripts/QuestGUI.lua	(revision 8857)
+++ code/trunk/data/gui/scripts/QuestGUI.lua	(revision 8858)
@@ -220,5 +220,5 @@
 function P.selectQuest(list, quest)
     if quest == nil then -- If the input quest is nil, there is nothing to be selected, an error is output and the first quest is selected instead.
-        cout(1, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
+        orxout(orxonox.level.internal_error, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
         list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
         return
@@ -240,5 +240,5 @@
         list:setItemSelectState(list:getListboxItemFromIndex(index), true)
     else -- If the quest isn't found an error is output and the first quest is selected instead.
-        cout(1, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
+        orxout(orxonox.level.internal_error, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
         list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
     end
@@ -313,5 +313,5 @@
             end
         else
-            cout(1, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
+            orxout(orxonox.level.internal_error, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
         end
     end
Index: code/trunk/data/levels/presentationDM.oxw
===================================================================
--- code/trunk/data/levels/presentationDM.oxw	(revision 8857)
+++ code/trunk/data/levels/presentationDM.oxw	(revision 8858)
@@ -16,4 +16,5 @@
  name         = "Presentation"
  description  = "A simple testlevel"
+ gametype     = Deathmatch
 >
   <templates>
@@ -46,11 +47,12 @@
       for i = 1, 100, 1 do
         j = math.random()
+        scale = j * 50 + 5
     ?>
-      <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass="<?lua print(j * 50) ?>" scale="<?lua print(j * 5) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+      <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass="<?lua print(scale) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
         <attached>
-          <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+          <Model scale="<?lua print(scale) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
         </attached>
         <collisionShapes>
-          <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+          <SphereCollisionShape radius="<?lua print(scale * 2.5) ?>" />
         </collisionShapes>
       </MovableEntity>
Index: code/trunk/data/levels/templates/FPS.oxt
===================================================================
--- code/trunk/data/levels/templates/FPS.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/FPS.oxt	(revision 8858)
@@ -30,5 +30,5 @@
     
     <?lua
-	include("includes/weaponSettingsFPS.oxi")
+	include("../includes/weaponSettingsFPS.oxi")
     ?>
 
Index: code/trunk/data/levels/templates/spaceshipAssff.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipAssff.oxt	(revision 8858)
@@ -56,5 +56,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsAssff.oxi")
+  include("../includes/weaponSettingsAssff.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipAssff2.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff2.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipAssff2.oxt	(revision 8858)
@@ -56,5 +56,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsAssff2.oxi")
+  include("../includes/weaponSettingsAssff2.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipGhost.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipGhost.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipGhost.oxt	(revision 8858)
@@ -53,5 +53,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsGhost.oxi")
+  include("../includes/weaponSettingsGhost.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipH2.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipH2.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipH2.oxt	(revision 8858)
@@ -22,5 +22,5 @@
 
 <?lua
-  include("includes/weaponSettingsH2.oxi")
+  include("../includes/weaponSettingsH2.oxi")
 ?>
     <engines>
Index: code/trunk/data/levels/templates/spaceshipHXY.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXY.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipHXY.oxt	(revision 8858)
@@ -37,5 +37,5 @@
 
 <?lua
-  include("includes/weaponSettingsHXY.oxi")
+  include("../includes/weaponSettingsHXY.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipHXYSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXYSL.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipHXYSL.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsHXY.oxi")
+  include("../includes/weaponSettingsHXY.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipPirate.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipPirate.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipPirate.oxt	(revision 8858)
@@ -55,5 +55,5 @@
 
 <?lua
-  include("includes/weaponSettingsPirate.oxi")
+  include("../includes/weaponSettingsPirate.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipSwallow.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipSwallow.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipSwallow.oxt	(revision 8858)
@@ -50,5 +50,5 @@
     </collisionShapes>
 <?lua
-  include("includes/weaponSettingsSwallow.oxi")
+  include("../includes/weaponSettingsSwallow.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipTransporter.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporter.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipTransporter.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsTransporter.oxi")
+  include("../includes/weaponSettingsTransporter.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/levels/templates/spaceshipTransporterSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporterSL.oxt	(revision 8857)
+++ code/trunk/data/levels/templates/spaceshipTransporterSL.oxt	(revision 8858)
@@ -36,5 +36,5 @@
 
 <?lua
-  include("includes/weaponSettingsTransporter.oxi")
+  include("../includes/weaponSettingsTransporter.oxi")
 ?>
   </SpaceShip>
Index: code/trunk/data/lua/LuaStateInit.lua
===================================================================
--- code/trunk/data/lua/LuaStateInit.lua	(revision 8857)
+++ code/trunk/data/lua/LuaStateInit.lua	(revision 8858)
@@ -7,9 +7,19 @@
 end
 
--- Create function to log text like COUT, but always prints a line!
-logMessage = function(level, message)
-  luaState:luaLog(level, message)
+-- Prints output to the console and the logfile
+--
+-- Accepts the following arguments:
+--   orxout("message")
+--   orxout(orxonox.level.levelname, "message")
+--   orxout(orxonox.level.levelname, "context", "message)
+orxout = function(arg1, arg2, arg3)
+  if arg1 and arg2 and arg3 then
+    luaState:luaOutput(arg1, arg2, arg3)
+  elseif arg1 and arg2 then
+    luaState:luaOutput(arg1, arg2)
+  else
+    luaState:luaOutput(arg1)
+  end
 end
-cout = logMessage
 
 -- Redirect dofile in order to load with the resource manager
@@ -42,5 +52,5 @@
 require = function(moduleName)
   if not luaState:fileExists(moduleName .. ".lua") then
-    logMessage(2, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
+    orxout(orxonox.level.internal_warning, "Warning: Lua function require() could not find file '" .. moduleName .. ".lua' ")
     return nil
   end
@@ -85,5 +95,5 @@
   -- Fallback pause function
   pause = function()
-    logMessage(2, [["Warning: debug() called in Lua, but Debugger is not active.
+    orxout(orxonox.level.internal_warning, [["Warning: debug() called in Lua, but Debugger is not active.
 Do you have the IOConsole disabled and are you using Lua version 5.1?"]])
   end
@@ -98,5 +108,5 @@
     end
     -- Display the error message
-    logMessage(1, "Lua runtime error: "..err)
+    orxout(orxonox.level.internal_error, "Lua runtime error: "..err)
   end
 
@@ -106,5 +116,5 @@
   else
     -- Fallback: print stack trace
-    logMessage(3, debug.traceback(""))
+    orxout(orxonox.level.internal_error, debug.traceback(""))
   end
   return err -- Hello Lua debugger user! Please type 'set 2' to get to the
Index: code/trunk/data/overlays/OrxonoxLoading.overlay
===================================================================
--- code/trunk/data/overlays/OrxonoxLoading.overlay	(revision 8857)
+++ 	(revision )
@@ -1,13 +1,0 @@
-Orxonox/LoadingScreenSample
-{
-   container Panel(Orxonox/LoadingScreenSample)
-   {
-      metrics_mode pixels
-      vert_align top
-      left 12
-      top 12
-      width 300
-      height 300
-      material Orxonox/LoadingScreenSample
-   }
-}
Index: code/trunk/data/overlays/debug.oxo
===================================================================
--- code/trunk/data/overlays/debug.oxo	(revision 8857)
+++ code/trunk/data/overlays/debug.oxo	(revision 8858)
@@ -40,12 +40,4 @@
 <Template name="defaultHUD">
   <OverlayGroup name = "defaultHUD" scale = "1, 1">
-    <ChatOverlay
-     name     = "chat"
-     position = "0.03, 0.08"
-     font     = "VeraMono"
-     caption  = ""
-     textsize = 0.025
-    />
-
     <KillMessage
      name     = "killmessage"
@@ -84,4 +76,12 @@
     />
 
+    <ChatOverlay
+     name     = "chat"
+     position = "0.03, 0.08"
+     font     = "VeraMono"
+     caption  = ""
+     textsize = 0.025
+    />
+
   </OverlayGroup>
 </Template>
Index: code/trunk/data/tcl/init.tcl
===================================================================
--- code/trunk/data/tcl/init.tcl	(revision 8857)
+++ code/trunk/data/tcl/init.tcl	(revision 8858)
@@ -169,6 +169,8 @@
     foreach {channel s} $input break
 
-    if {$channel == "stdout" || $channel == "stderr"} {
-        execute puts $newline $s
+    if {$channel == "stdout"} {
+        execute log $s
+    } elseif {$channel == "stderr"} {
+        execute error $s
     } else {
         eval [concat ::tcl::puts $args]
