Results 1 to 5 of 5

Thread: Include problem

  1. #1
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default Include problem

    i made my own include marpis_include.scar, and put {.include marpis_include.scar} to my main script. the script worked flawlessly. the marpis_include.scar has a type like this:
    SCAR Code:
    type
      mUser = record
       Name, Pass, RunDir, FightMode, CurrentSkill: string;
       Active, Eat, UseRanged, BuryBones, UseAutotalk, MultiCombat, UseMM: boolean;
       MonsterColors, PickupColors: TIntegerArray;
       MonsterNames, PickupNames: TStringArray;
       FoodDTM, att, str, def, ran, hp, combat: integer;
      end;

    Then i thought i wanna make it have a BoxReward: TStringArray; too.
    i added it there after PickupNames, so that line now looks like this:
    MonsterNames, PickupNames, BoxReward: TStringArray;
    marpis_include.scar is located at scardirectory/Includes/ as it should be.
    I saved marpis_include.scar and added a line like this to the main script:
    mFighter[0].BoxReward:= ['oin'];
    and tried to run the script, but SCAR said
    Unknown identifier 'BOXREWARD' in script

    what the heck?

  2. #2
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  3. #3
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I think i delete the include and attach all the functions to the main script...

    SCAR Code:
    {      xx    xx    x     xxxxx   xxxx   xx   xxxx
           xxx  xxx   x xx   xx  xx  x  xx  xx  xx
           xx xx xx  xxxxxx  xxxxx   xxxx   xx    xxx
           xx    xx xx    xx xx  xx  xx     xx  xxxx

     Miscellaneous Autoing Related Procedures, Including Somethataresimilartotheonesinsrl
     made by marpis
    }



    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { Variables
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    var
      RespondedChatLines: TStringArray;
      TalkTimer: integer;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { Types: mUser, TObject2
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}



    type
      mUser = record
       Name, Pass, RunDir, FightMode, CurrentSkill: string;
       Active, Eat, UseRanged, BuryBones, UseAutotalk, MultiCombat, UseMM: boolean;
       MonsterColors, PickupColors: TIntegerArray;
       BoxReward, MonsterNames, PickupNames: TStringArray;
       FoodDTM, att, str, def, ran, hp, combat: integer;
      end;
     
      TObject2 = record
       x: integer;
       y: integer;
       InFight: boolean;
      end;



    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { procedure DeleteATPAIndex(i: Integer; var arr: T2DPointArray);
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    procedure DeleteATPAIndex(i: Integer; var arr: T2DPointArray);
    begin
     swap(arr[i], arr[High(arr)]);
     SetLength(arr, High(arr));
    end;
     
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function FindObjects
        var Objs: Array of TObject2    Here the found objects are stored
        width, height:                 Size of the object
        colors:                        TIntegerArray, object colors
        tolerance:                     Color tolerance
        ExcludeSelf:                   Ignore objects at the same spot than you are
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function FindObjects(var Objs: Array of TObject2; width, height: integer; colors: TIntegerArray; tolerance: integer; ExcludeSelf: boolean): boolean;
    var
      TPA, TempTPA, MobTPA: TPointArray;
      ATPA: T2DPointArray;
      i, j: integer;
      P: TPoint;
      Box: TBox;
    begin
     if not loggedin then exit;
     for i:= 0 to high(colors) do
     begin
      FindColorsSpiralTolerance(MSCX, MSCY, TempTPA, colors[i], MSX1, MSY1, MSX2, MSY2, tolerance);
      TPA:= CombineTPA(TPA, TempTPA);
     end;
     if High(TPA) < 1 then exit;
     ATPA:= SplitTPAEx(TPA, width, height);
     for i:= 0 to High(ATPA) do
     begin
      for j:= 0 to high(colors) do
      begin
       P:= MiddleTPA(ATPA[i]);
       FindColorsSpiralTolerance(P.x, P.y, TempTPA, colors[j], P.x-25, P.y-25, P.x+25, P.y+25, tolerance);
       MobTPA:= CombineTPA(MobTPA, TempTPA);
      end;
      Box:= IntToBox(245, 145, 275, 180);
      if (PointInBox(P, Box) and ExcludeSelf) then
       DeleteATPAIndex(i, ATPA);
     end;
     SetArrayLength(Objs, Length(ATPA));
     Result:= Length(ATPA) > 0;
     for i:= 0 to High(ATPA) do
     begin
      P:= MiddleTPA(ATPA[i]);
      Objs[i].x := P.x;
      Objs[i].y := P.y;
      Objs[i].InFight := IsInFight(P.x, P.y);
     end;
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { m_QuickSort (its a normal quicksort)
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    procedure m_quicksort(var A: array of Integer; iLo, iHi: Integer);
    var
      Lo, Hi, Pivot, T: Integer;
    begin
      Lo := iLo;
      Hi := iHi;
      Pivot := A[(Lo + Hi) div 2];
      repeat
        while A[Lo] < Pivot do Inc(Lo);
        while A[Hi] > Pivot do Dec(Hi);
        if Lo <= Hi then
        begin
          T := A[Lo];
          A[Lo] := A[Hi];
          A[Hi] := T;
          Inc(Lo);
          Dec(Hi);
        end;
      until Lo > Hi;
      if Hi > iLo then m_quicksort(A, iLo, Hi);
      if Lo < iHi then m_quicksort(A, Lo, iHi);
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function ArrangeObjects(Objs: Array of TObject2): array of TObject2;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function ArrangeObjects(Objs: Array of TObject2): array of TObject2;
    var
      i, w: integer;
      Distances, Distances2: TIntegerArray;
    begin
     SetArrayLength(Distances, GetArrayLength(Objs));
     SetArrayLength(Distances2, GetArrayLength(Objs));
     for i:= 0 to High(Objs) do
     begin
      Distances[i] := Distance(MSCX, MSCY, Objs[i].x, Objs[i].y);
      Distances2[i] := Distance(MSCX, MSCY, Objs[i].x, Objs[i].y);
     end;
     m_quicksort(distances, Low(distances), High(distances));
     for i:= 0 to High(Objs) do
     begin
      InIntArrayEx(Distances2, w, distances[i]);
      Result[i] := Objs[w];
     end;
    end;



    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { procedure DeleteObj2ArrayIndex(i: Integer; var arr: Array of TObject2);
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    procedure DeleteObj2ArrayIndex(i: Integer; var arr: Array of TObject2);
    begin
     swap(arr[i], arr[High(arr)]);
     SetLength(arr, High(arr));
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { procedure FilterFightingMonsters(Mobs: Array of TObject2);
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    procedure FilterFightingMonsters(Mobs: Array of TObject2);
    var
      i: integer;
    begin
     for i:= 0 to High(Mobs) do
      if Mobs[i].InFight then
       DeleteObj2ArrayIndex(i, Mobs);
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function HpColor: integer;
    { 0=green, 1=yellow, 2=red 3=dangerous red
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function HpColor: integer;
    var
      x, y: integer;
    begin
     Result := -1;
     if not loggedin then exit;
     if FindColorTolerance(x, y, 65280, 720, 25, 745, 40, 5)
      then Result := 0;
     if FindColorTolerance(x, y, 65535, 720, 25, 745, 40, 5)
      then Result := 1;
     if FindColorTolerance(x, y, 2070783, 720, 25, 745, 40, 5)
      then Result := 2;
     if FindColorTolerance(x, y, 255, 720, 25, 745, 40, 5)
      then Result := 3;
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function LowHP: boolean;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function LowHP: boolean;
    begin
     Result := HPColor > 0;
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function IsOptionMulti(Text: TStringArray): Boolean;
      edited from ChooseOptionMulti()
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function IsOptionMulti(Text: TStringArray): Boolean;
    var
       B: TBox;
       TPA: TPointArray;
       X, Y, I, C: Integer;
       P: TPoint;
    begin
      Result := False;
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
      If Length(TPA) < 10 Then
        Exit;
      B.X2 := 0;
      B.Y2 := 0;
      P := TPA[0];
      For I := 0 To High(TPA) - 1 Do
        If TPA[i].X = TPA[I+1].X - 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X1 := P.X;
            B.Y1 := P.Y;
            Break;
          End Else
            C := C + 1;
        End
        Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;
      InvertTPA(TPA);
      C := 0;
      P := TPA[0];
      For I := 0 To High(TPA) - 1 Do
        If TPA[i].X = TPA[I+1].X + 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X2 := P.X;
            B.Y2 := P.Y;
            Break;
          End Else
            C := C + 1;
        End Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;
      For i:=0 To High(Text) do
        If FindText(X, Y, Text[i], upchars, B.X1, B.Y1, B.X2, B.Y2) Then
        Begin
          Result := True;
          Exit;
        End;
      MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
      Wait(200 + Random(100));
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function IsOption(s: string): boolean;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function IsOption(s: string): boolean;
    begin
     Result:= IsOptionMulti([s]);
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function IsInFight(x, y: integer): Boolean;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function IsInFight(x, y: integer): Boolean;
    var
      G, R: TPointArray;
    begin
      if not loggedin then exit;
      FindColorsTolerance(G, 65280, x-35, y-35, x+35, y+35, 0);
      FindColorsTolerance(R, 255, x-35, y-35, x+35, y+35, 0);
      Result := High(CombineTPA(G, R)) > 10;
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function GetNPCsIn(x1, y1, x2, y2: integer): TPointArray;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function GetNPCsIn(x1, y1, x2, y2: integer): TPointArray;
    begin
      FindColorsSpiralTolerance(MMCX, MMCY, result, 1179390, x1, y1, x2, y2, 18);
      RAaSTPA(result, 4);
      SortTPAFrom(result, Point(MMCX, MMCY));
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function GetArrowCount: integer;     made by: Narcle
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function GetArrowCount: integer;
    begin
      GameTab(5);
      Result := GetAmount(666, 249);
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function RangedInFight: boolean;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function RangedInFight: boolean;
    var
      a, t: integer;
    begin
      a:= GetArrowCount;
      MarkTime(t);
      repeat
       wait(10+random(100));
       result:= GetArrowCount < a;
      until(result or (TimeFromMark(t)> 3499));
    end;

    {*******************************************************************************
    function ItemToDTM(Slot: integer): integer;
    By: marpis
    Description: Creates a DTM of an item in inventory.
    *******************************************************************************}

    function ItemToDTMm(Slot: integer): integer;
    var
      i: integer;
      TPA: TPointArray;
      Box: TBox;
      P: TPoint;
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array of TDTMPointDef;
      TempTDTM: TDTM;
    begin
     if not loggedin then exit;
     if (Slot < 1) or (Slot > 28) then
     begin
      writeln('[ERROR] ItemToDTM: '+inttostr(slot)+' is not a valid inventory slot!');
      exit;
     end;
     Box:= InvBox(slot);
     FindColorsTolerance(TPA, 65536, Box.x1+1, Box.y1+1, Box.x2-1, Box.y2-1, 0);
     if Length(TPA) < 10 then
     begin
      writeln('[ERROR] ItemToDTM: Item not found in slot '+inttostr(slot)+'!');
      exit;
     end;
     RAaSTPA(TPA, 5);
     SetArrayLength(dtmSubPoints, Length(TPA));
     P:= TPA[0];
     dtmMainPoint.x := P.x;
     dtmMainPoint.y := P.y;
     dtmMainPoint.AreaSize := 0;
     dtmMainPoint.AreaShape := 0;
     dtmMainPoint.Color := 65536;
     dtmMainPoint.Tolerance := 0;
     for i:= 1 to High(TPA) do
     begin
      P:= TPA[i];
      dtmSubPoints[i].x := P.x;
      dtmSubPoints[i].y := P.y;
      dtmSubPoints[i].AreaSize := 0;
      dtmSubPoints[i].AreaShape := 0;
      dtmSubPoints[i].Color := 65536;
      dtmSubPoints[i].Tolerance := 0;
     end;
     TempTDTM.MainPoint := dtmMainPoint;
     TempTDTM.SubPoints := dtmSubPoints;
     Result := AddDTM(TempTDTM);
    end;

    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function posexx(substrarr: TStringArray; str: string): integer;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function posexx(substrarr: TStringArray; str: string): integer;
    var
     i: integer;
    begin
     for i:= 0 to High(SUBstrarr) do
     begin
      result:= pos(lowercase(substrarr[i]), lowercase(str));
      if (result > 0) then
       exit;
     end;
    end;


    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function GetChatboxLine(line: integer): string;
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function GetChatboxLine(line: integer): string;
    begin
     result:= GetChatboxText(line, clBlack) + GetChatboxText(line, clChat) + GetChatboxText(line, clTrade) + GetChatboxText(line, clFriend);
    end;


    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}
    { function Autotalk(seconds: integer): boolean;
      seconds is the minimun time between responds. Use this if you like it!
      its great! :) remember to include 2 functions above
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

    function Autotalk(seconds: integer): boolean;
    var
      i, ii: integer;
      MyLevels: array [0..23] of integer;
      ChatLines: array [0..7] of string;
      TSA: TStringArray;
      s: string;
      responded: boolean;
    begin
      if (TimeFromMark(TalkTimer) < seconds*1000) then exit;
      // Read messages in the chatbox
      for i:= 1 to 8 do
       ChatLines[i-1]:= GetChatboxLine(i);
      // Find triggers
      for i:= 7 downto 0 do
      begin
        if (pos(players[currentplayer].nick, Chatlines[i])>12) or (pos(players[currentplayer].nick, Chatlines[i])=0) then
        if not InStrArr(ChatLines[i], RespondedChatLines, false) then
        begin
         {================================== LEVELS ===========================================================}
         if (posexx(['att','att','str','def','rang','magi','healt', 'hp', 'pray'],lowercase(ChatLines[i]))>11) then
         begin
          responded:= true;
          writeln('Answering: Levels');
          GetAllLevels;
          for ii := 0 to 23 do
           Mylevels[ii] := players[currentplayer].Level[ii+1];
          // Attack
          if pos('att', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['att ', 'attack ', 'attlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[0]);
          end;
          // Strength
          if pos('str', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['str ', 'strength ', 'strlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[1]);
          end;
          // Defence
          if pos('def', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['def ', 'defence ', 'deflvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[2]);
          end;
          // Ranged
          if pos('rang', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['rang ', 'ranged ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[3]);
          end;
          // Prayer
          if pos('pray', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['pray ', 'prayer ', 'praylvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[4]);
          end;
          // Magic
          if pos('mag', lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['mag ', 'magic ', 'maglvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[5]);
          end;
          // Runecrafting
          if posexx(['runecraft','rc'], ChatLines[i])>11 then
          begin
           TSA:= ['rc ', 'runecrafting ', 'rclvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[6]);
          end;
          // HP
          if posexx(['hp', 'healt'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['hp ', 'healt ', 'health ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[7]);
          end;
          // Agility
          if posexx(['agi'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['agi ', 'agility ', 'agilvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[8]);
          end;
          // Herblore
          if posexx(['herb'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['herb ', 'herblore ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[9]);
          end;
          // Thieving
          if posexx(['thiev', 'thief'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['thieving ', 'thief ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[10]);
          end;
          // Crafting
          if posexx(['craft'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['crafting ', 'craft ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[11]);
          end;
          // Fletching
          if posexx(['fletc'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fletch ', 'fletching ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[12]);
          end;
          // Slayer
          if posexx(['slay'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['slayer ', 'slaying ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[13]);
          end;
          // Mining
          if posexx(['minin'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['mining ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[14]);
          end;
          // Smithing
          if posexx(['smith'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['smith ', 'smithing ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[15]);
          end;
          // Fishing
          if posexx(['fish'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fish ', 'fishing ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[16]);
          end;
          // Cooking
          if posexx(['cook'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['cooking ', 'cook  ', 'cooklvl']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[17]);
          end;
          // Firemaking
          if posexx(['fm', 'firemak'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['fm ', 'firemaking ', 'fmlvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[18]);
          end;
          // Woodcutting
          if posexx(['wc', 'woodcut'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['wc ', 'woodcut ', 'woodcutting ', 'wclvl ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[19]);
          end;
          // Farming
          if posexx(['farm', 'farmin'], lowercase(ChatLines[i]))>11 then
          begin
           TSA:= ['farm ', 'farming ']
           s:=s + TSA[random(Length(TSA))] + IntToStr(MyLevels[19]);
          end;
          // S A Y    T H E     L I N E
          s:= Trim(s);
          writeln(s);
          TypeSend(s);
         end else
         {================================== MAX HIT ====================================================}
         if (posexx(['max hit', 'maxhit'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Max hit');
          TSA:= ['over 9000!!','more than yours nub','i can 1 hit kalphite queen','too much','you cant even imagine it','insane','not your business','wanna try on arena'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ BOT ACCUSE ===============================================}
         if (posexx(['bot', 'auto', 'macro'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Max hit');
          TSA:= ['haha 8P','lololol','couldnt care less actually','ehmm lol','yea right'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================== ABUSE ====================================================}
         if (posexx(['noob', 'nuub', 'nob', 'newb'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Abuse');
          TSA:= ['phewt','pfft','yea right','could still pwn u'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================= GREETINGS ===================================================}
         if (posexx(['whatup', 'wazzup', 'wazup', 'watap', 'watup', 'what''s up', 'whatsup', 'whats up', 'wasup', 'wassup', 'hi ', 'hello'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Greetings');
          TSA:= ['hi there','yo yo','wasup','whatap','whats up','hello'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ COMPLIMENTS ================================================}
         if (posexx(['nice', 'cool', 'kewl', 'great', 'awesome'], ChatLines[i])>11) and (posexx(['weapon', 'shield', 'armor', 'plate', 'pl8', 'cape', 'helm', 'staff', 'sword', 'gear', 'body', 'leg', 'name'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Compliments');
          TSA:= ['heh thanks','ty','thanks dude','yup','lol','not rly'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ FRIEND REQUEST ================================================}
         if (posexx(['iends?'], ChatLines[i])>11) then
         begin
          responded:= true;
          writeln('Answering: Friend request');
          TSA:= ['ehmm no ty','thx but no thx','not interested','mm naaah','lol no ty','not rly'];
          Typesend(TSA[random(Length(TSA))]);
         end else
        {================================ JUST NAME ================================================}
         if pos(players[currentplayer].nick, ChatLines[i]) > 11 then
         begin
          responded:= true;
          writeln('Answering: Name mentioned');
          TSA:= ['ya', 'yo', 'hmm'];
          Typesend(TSA[random(Length(TSA))]);
         end;
         // end of triggers
         result:= responded;
         if result then
         begin
          MarkTime(TalkTimer);
          SetLength(RespondedChatLines, Length(RespondedChatLines)+1);
          RespondedChatLines[High(RespondedChatLines)] := ChatLines[i];
          exit;
         end;
        end;
     end;
    end;

    begin
    end.

    EDIT: Yep, i deleted the include and attached all the functions to the main script. Now it even looks cooler when it has 1400+ lines
    Last edited by marpis; 05-11-2009 at 12:22 AM.

  4. #4
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hi,

    There is nothing wrong with your include file. It is probably how your using it in your main file. As per the looks of it you should be using it like this:
    SCAR Code:
    var
      mFighter: array [0..100] of mUser;
    You can take out [0..100] if you plan on using SetLength(); Before using it in the script.

    A better way of using it would be:
    SCAR Code:
    type
      mUser = record
       Name, Pass, RunDir, FightMode, CurrentSkill: string;
       Active, Eat, UseRanged, BuryBones, UseAutotalk, MultiCombat, UseMM: boolean;
       MonsterColors, PickupColors: TIntegerArray;
       BoxReward, MonsterNames, PickupNames: TStringArray;
       FoodDTM, att, str, def, ran, hp, combat: integer;
      end;
      mUserArray: array [0..100] of mUser;

    And then in main script:
    SCAR Code:
    mFighter: mUserArray;



    ~NS

  5. #5
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    im using it like
    var mFighter: Array of mUser;
    which is just fine

    well, i think this remains mystery it doesn't matter anymore anyway, but thanks for your help!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •