Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8205 in orxonox.OLD for branches/script_engine/src


Ignore:
Timestamp:
Jun 7, 2006, 5:06:47 PM (18 years ago)
Author:
snellen
Message:

ScriptTrigger now loads its parameters

Location:
branches/script_engine/src/lib/script_engine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/script_engine/src/lib/script_engine/script_trigger.cc

    r8202 r8205  
    2323  WorldEntity ::loadParams(root);
    2424 
    25    /*{ LoadParam(root, "file", this, ScriptTrigger, setScript)
     25   { LoadParam(root, "file", this, ScriptTrigger, setScript)
    2626        .describe("the fileName of the script, that should be triggered by this script trigger")
    2727        .defaultValues("");
     
    2929        .describe("the function of the script, that should be triggered by this script trigger")
    3030        .defaultValues("");
    31     LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoord)
     31    LoadParam(root, "abs-coor", this, ScriptTrigger, setAbsCoor)
    3232        .describe("where this script trigger should be located")
    3333        .defaultValues("");
     
    3838        .describe("the delay after which the funtion sould be triggered")
    3939        .defaultValues(0);
    40     LoadParam(root, "worldentity", this, ScriptTrigger, setTargetName)
     40    LoadParam(root, "worldentity", this, ScriptTrigger, setTarget)
    4141        .describe("The name of the target as it is in the *.oxw file")
    4242        .defaultValues("");
    43     LoadParam(root, "worldentityisparent", this, ScriptTrigger, setIsParent)
     43    LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent)
    4444        .describe("The name of the target as it is in the *.oxw file")
    4545        .defaultValues("");
    4646
    47     }*/
     47    }
    4848 timer = delay;
    4949}
     
    6161  {
    6262    PRINTF(2)("Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassName(), this->getName());
     63  }
     64}
     65
     66void ScriptTrigger::setTriggerParent(const std::string& parent)
     67{
     68  BaseObject* parentEntity = ClassList::getObject(parent, CL_WORLD_ENTITY);
     69 
     70  if (parentEntity != NULL)
     71  {
     72    this->setParent(dynamic_cast<WorldEntity*>(parentEntity));
     73  }
     74  else
     75  {
     76    PRINTF(2)("Parent %s for %s::%s does not Exist\n", parent.c_str(), this->getClassName(), this->getName());
    6377  }
    6478}
  • branches/script_engine/src/lib/script_engine/script_trigger.h

    r8202 r8205  
    2222    void setTarget(const std::string& targetName);
    2323    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
     24   
     25    void setTriggerParent(const std::string& name);
    2426 
    25     void setCallOnce(bool call) { this->callOnce = call;}
    26     void setRadius(float radius) { if(radius>0) this->radius = radius;}
    27     void setDelay(float time){if(delay>0) this->delay = delay;}
    28     void setScript(std::string& script){this->scriptFile = script;}
    29     void setFunction(std::string& function){this->functionName = function;}
     27    void setCallOnce(const bool call) { this->callOnce = call;}
     28    void setRadius(const float radius) { if(radius>0) this->radius = radius;}
     29    void setDelay(const float time){if(delay>0) this->delay = delay;}
     30    void setScript(const std::string& script){this->scriptFile = script;}
     31    void setFunction(const std::string& function){this->functionName = function;}
    3032
    3133    std::string getTargetName();
     
    3335  private:
    3436
    35     std::string  parentName;
    3637    WorldEntity* target;
    37     bool         worldEntityIsParent;
    3838    bool         callOnce;
    39     bool         scriptCalled;
    4039    float        radius;
    4140    float        delay;
     
    4342    std::string  functionName;
    4443
    45     bool callScript;
    46     bool triggered;
    47     float timer;
     44   
     45    bool         scriptCalled;
     46    bool         callScript;
     47    bool         triggered;
     48    float        timer;
    4849
    4950};
Note: See TracChangeset for help on using the changeset viewer.