Pascal error "unknow name"

Discussion in 'Modding' started by Lieutenant-Général, Jun 25, 2018.

  1. Lieutenant-Général

    Lieutenant-Général Active Member

    Hi,

    I work on a unit editor, and i have a very strange error then i change "unit.script".

    This code work fine :
    Code:
    var bCheckBuilding : Boolean;
    
          if (objprop.sid='pikeman') then
          begin
             objbase.maxhp := 90;
             SetObjBaseWeapon(objprop, objbase, 0, 8, 0, 35, 100, 0, 100000, gc_obj_weapon_kind_pike, True);
             SetObjBasePrice(objbase, 25, 0, 0, 3, 20, 0);
             SetObjBaseProtection(objbase, 3, 2, 4, 210, {7}6, 40);
             SetObjBaseMaterialCanKill(objprop, gc_obj_material_body, gc_obj_material_body, gc_obj_material_woodwall, 0, 0, 0);
             SetObjBaseSearchBuildVisionScore(objprop, objbase, 700, 144, 1, 10);
             objprop.bstandground := True;
             objprop.usage := gc_obj_usage_lightinfantry;
             objprop.aiforce := 10;
             objprop.walkintervalfactor := cWalkIntervalInf;
          end;     
    
          if (not bCheckBuilding) then //unit found
          begin
             objprop.bprotector := not objprop.bcapture;
             objprop.bcancapture := (not objprop.bcapture) and (objprop.usage<>gc_obj_usage_peasant);
          end;
    but this code (difference in bold)
    Code:
    var bCheckBuilding : Boolean;
          if (objprop.sid='pikeman') then
          begin
             objbase.maxhp := 90;
             SetObjBaseWeapon(objprop, objbase, 0, 8, 0, 35, 100, 0, 100000, gc_obj_weapon_kind_pike, True);
             SetObjBasePrice(objbase, 25, 0, 0, 3, 20, 0);
             SetObjBaseProtection(objbase, 3, 2, 4, 210, {7}6, 40);
             SetObjBaseMaterialCanKill(objprop, gc_obj_material_body, gc_obj_material_body, gc_obj_material_woodwall, 0, 0, 0);
             SetObjBaseSearchBuildVisionScore(objprop, objbase, 700, 144, 1, 10);
             objprop.bstandground := True;
             objprop.usage := gc_obj_usage_lightinfantry;
             objprop.aiforce := 10;
             objprop.walkintervalfactor := cWalkIntervalInf;
          end
          else
             bCheckBuilding := True;
          end;     
          if (not bCheckBuilding) then //unit found
          begin
             objprop.bprotector := not objprop.bcapture;
             objprop.bcancapture := (not objprop.bcapture) and (objprop.usage<>gc_obj_usage_peasant);
          end;
    
    Raise an "unknow name" at line "if (not bCheckBuilding) then".

    Anobody can explain me the reasons of this error?
     
  2. Code:
    var bCheckBuilding : Boolean;
          if (objprop.sid='pikeman') then
          begin
             objbase.maxhp := 90;
             SetObjBaseWeapon(objprop, objbase, 0, 8, 0, 35, 100, 0, 100000, gc_obj_weapon_kind_pike, True);
             SetObjBasePrice(objbase, 25, 0, 0, 3, 20, 0);
             SetObjBaseProtection(objbase, 3, 2, 4, 210, {7}6, 40);
             SetObjBaseMaterialCanKill(objprop, gc_obj_material_body, gc_obj_material_body, gc_obj_material_woodwall, 0, 0, 0);
             SetObjBaseSearchBuildVisionScore(objprop, objbase, 700, 144, 1, 10);
             objprop.bstandground := True;
             objprop.usage := gc_obj_usage_lightinfantry;
             objprop.aiforce := 10;
             objprop.walkintervalfactor := cWalkIntervalInf;
          end
          else
          begin
             bCheckBuilding := True;
          end;    
          if (not bCheckBuilding) then //unit found
          begin
             objprop.bprotector := not objprop.bcapture;
             objprop.bcancapture := (not objprop.bcapture) and (objprop.usage<>gc_obj_usage_peasant);
          end;
    
    end requires begin - either you remove end or add begin
     
    Lieutenant-Général likes this.
  3. Lieutenant-Général

    Lieutenant-Général Active Member

    I was think it was the "end" of the "if", my skill in pascal is very bad... A lot of thank!
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice