Results 1 to 19 of 19

Thread: function help *advanced only plz*

  1. #1
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default function help *advanced only plz*

    here is function...
    SCAR Code:
    function CountItemsDTMs(DTM : TIntegerArray; Including : Boolean) : Integer;
    var r : LongInt; Item : TBox; I : Integer;
    begin
      if not LoggedIn then Exit;
      GameTab(4);
      Wait(500);
      for r := 1 to 28 do
      begin
        if GetInvItemBounds(r, Item) then
        for I := 0 to High(DTM) do
        begin
          if Including then
          begin
            if FindDTM(DTM[I], x, y, Item.x1, Item.y1, Item.x2, Item.y2) then //line 379
              Inc(Result);
          end
          else
          begin
            if not FindDTM(DTM[I], x, y, Item.x1, Item.y1, Item.x2, Item.y2) then
              Inc(Result);
          end;
          FreeDTM(DTM[I]);
        end;
      end;
    end;

    here is error
    Code:
    [Runtime Error] : Exception: Access violation at address 006D691C in module 'scar.exe'. Read of address 00000000 in line 379 in script
    help is appreciated and if you want it rep'd(for your cyberpenis...)

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, California
    Posts
    276
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try this.
    SCAR Code:
    function CountItemsDTMs(DTM : TIntegerArray; Including : Boolean) : Integer;
    var r : LongInt; Item : TBox; I : Integer;
    begin
      if not LoggedIn then Exit;
      GameTab(4);
      Wait(500);
      I := 1;
      for r := 1 to 28 do
      begin
        if GetInvItemBounds(r, Item) then
        for I := 0 to High(DTM) do
        begin
          if Including then
          begin
            if FindDTM(DTM[i], x, y, Item.x1, Item.y1, Item.x2, Item.y2) then //line 379
              Inc(Result);
          end
          else
          begin
            if not FindDTM(DTM[i], x, y, Item.x1, Item.y1, Item.x2, Item.y2) then
              Inc(Result);
          end;
          FreeDTM(DTM[i]);
        end;
      end;
    end;
    Current Project: All In 1 Falador Script - 20% DONE

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Same problem...

  4. #4
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    How do you declare DTM? Maybe it starts at 1 instead of 0.

  5. #5
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    How do you declare DTM? Maybe it starts at 1 instead of 0.
    do you want this?
    SCAR Code:
    function CountBarsInInv : Integer;
    var barss : Integer;
    begin
      barss := Barz;
      Result := CountItemsDTMs([Barss], True);
      FreeDTM(Barz);
    end;

  6. #6
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    SCAR Code:
    function CountItemsDTMs(DTMs: TIntegerArray; Including: Boolean): integer;
    var
      i, Hi, c: integer;
    begin
      Hi := High(DTMs);
      if Hi < 0 then Exit;
      for i := 0 to Hi do
      begin
        c := CountItems(DTMs[i], 'dtm', []);
        if Including then
          IncEx(Result, c)
        else
          DecEx(Result, c);
      end;
    end;

  7. #7
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    do you want this?
    SCAR Code:
    function CountBarsInInv : Integer;
    var barss : Integer;
    begin
      barss := Barz;
      Result := CountItemsDTMs([Barss], True);
      FreeDTM(Barz);
    end;
    No, how do you declare the variable called "DTM"?
    Like, is it "var DTM: Array of Integer;" or "var DTM: Array [x..x] of Integer;"?

  8. #8
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    No, how do you declare the variable called "DTM"?
    Like, is it "var DTM: Array of Integer;" or "var DTM: Array [x..x] of Integer;"?
    its not var dtm... its just dtm:TIntegerArray.

  9. #9
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Solved... just used saturn's with some extra stuff(script specific)
    end result without extra stuff
    SCAR Code:
    function CountItemsDTMs(DTMs: TIntegerArray; Including: Boolean): integer;
    var
      i, Hi, c: integer;
    begin
      if not Including then Result := 28;
      Hi := High(DTMs);
      if Hi < 0 then Exit;
      for i := 0 to Hi do
      begin
        c := CountItems(DTMs[i], 'dtm', []);
        if Including then
          IncEx(Result, c)
        else
          DecEx(Result, c);
      end;
    end;

  10. #10
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    its not var dtm... its just dtm:TIntegerArray.
    I'm blind, I thought it was a global var >.<

  11. #11
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    You are freeing the DTM after you already freed it.

    In your function you free it. Then in the function you are calling it from, you free it again.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  12. #12
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    You are freeing the DTM after you already freed it.

    In your function you free it. Then in the function you are calling it from, you free it again.
    not with the new one...

  13. #13
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    end;
          FreeDTM(DTM[i]);
        end;

    SCAR Code:
    Result := CountItemsDTMs([Barss], True);
      FreeDTM(Barz);

    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  14. #14
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    nava this is the new one...
    SCAR Code:
    function CountItemsDTMs(DTMs: TIntegerArray; Including: Boolean): integer;
    var
      i, Hi, c: integer;
    begin
      if not Including then Result := 28;
      Hi := High(DTMs);
      if Hi < 0 then Exit;
      for i := 0 to Hi do
      begin
        c := CountItems(DTMs[i], 'dtm', []);
        if Including then
          IncEx(Result, c)
        else
          DecEx(Result, c);
      end;
    end;
    so no i don't free them twice...

  15. #15
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Good

    You still getting errors?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  16. #16
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    nope
    i am just trying to fix up the banking procs in my script... they fail

  17. #17
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure Bank;
    begin
      if(FindObjCustom(x, y, ['ank', 'ooth'], [4276550, 3628151, 857627, 4679037], 7))then
      begin
        Mouse(x, y, 2, 2, false);
        Wait(RandomRange(50, 100));
        ChooseOption('ckly');
      end;
    end;


  18. #18
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    SCAR Code:
    procedure Bank;
    begin
      if(FindObjCustom(x, y, ['ank', 'ooth'], [4276550, 3628151, 857627, 4679037], 7))then
      begin
        Mouse(x, y, 2, 2, false);
        Wait(RandomRange(50, 100));
        ChooseOption('ckly');
      end;
    end;

    slightly more complicated than that...
    it has to withdraw and deposit stoofa... it finds the bank fine...

  19. #19
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah I was working on the withdraw/deposit.. only thing is.. originally I was going to just search for it... but then I thought.. what if it's a small bank and you can obviously find it?

    so.. you could just look for the DTM in MSX and then if it doesn't find it, scrolls down like.. 1-4 rows (get the ms for how long it takes for each row) then look again, if it can't find it, search for it..

    would be easy but I don't have the time.. and I don't need it..

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Advanced Powerminer
    By IluvSCAR in forum RS3 Outdated / Broken Scripts
    Replies: 0
    Last Post: 03-20-2008, 12:34 AM
  2. Need fairly advanced c++ help
    By syberium in forum C/C++ Help and Tutorials
    Replies: 8
    Last Post: 07-18-2007, 03:39 AM
  3. dtm Q.[advanced]
    By del_signo in forum OSR Help
    Replies: 9
    Last Post: 03-20-2007, 02:09 AM

Posting Permissions

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