Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2015, 2:36:07 PM (9 years ago)
Author:
maxima
Message:

New XMLPort for ControllerDirector. The name of the script can now be set via XMLPort. Level scriptController plays the new Script 'presentation.lua'

Location:
code/branches/presentationFS15/src/orxonox/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationFS15/src/orxonox/controllers/ControllerDirector.cc

    r10262 r10499  
    4141    {
    4242        SUPER(ControllerDirector, XMLPort, xmlelement, mode);
     43        XMLPortParam(ControllerDirector, "scriptname", setScriptName, getScriptName, xmlelement, mode).defaultValues("testscript");
    4344
    4445        orxout(verbose)<< "ControllerDirector::XMLPort "
     
    8384       else
    8485         return;
    85        
     86
    8687       /* Set up a luastate to use for running the scripts */
    8788       LuaState * ls = new LuaState();
     
    9899        * variable "newctrlid" defined, which means it can make use of it.
    99100        */
    100 
    101        ls->doFile("testscript.lua");
     101       std::string scr = this->scriptname_ + ".lua";
     102       ls->doFile(scr);
    102103
    103104       /* Increase the controller ID so we have a different one for
  • code/branches/presentationFS15/src/orxonox/controllers/ControllerDirector.h

    r10262 r10499  
    4747            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    4848
     49            inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
     50            inline const std::string& getScriptName() const { return this->scriptname_; }
     51
    4952
    5053            /* Take over control of a given object */
     
    5558            //void setNewController(Controller * controller);
    5659
    57         private:
     60        protected:
     61            std::string scriptname_;   
    5862            PlayerInfo* player_;
    5963            ControllableEntity* entity_;
Note: See TracChangeset for help on using the changeset viewer.