Results 1 to 19 of 19

Thread: Ore Counting Cont.

  1. #1
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default Ore Counting Cont.

    Well once again my Ore Counting continues to fail

    SCAR Code:
    function WaitUntilMined(Rock: TOre): Boolean;
    var
      GetAnimationTime, T, CX, CY, IC, P, First, Second: Integer;
    begin
      Status('Walking to Rock');
      MarkTime(t);
      SetColorspeed2Modifiers(Rock.Hue, Rock.Sat);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 6000) then Exit;
      until (not FlagPresent) and FindBlackChatMessage('u swi') and
        (FindColorTolerance(cx, cy, Rock.Color, MSCX-65, MSCY-65, MSCX+65, MSCY+65, Rock.Tol));
      Status('Mining Rock');
      IC := InvCount;
      MarkTime(t);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 12000) then Exit;
        if (not FindColorTolerance(cx, cy, Rock.Color, MSCX-65, MSCY-65, MSCX+65, MSCY+65, Rock.Tol)) or
          (GetAnimation <= 0) then
        begin
          if (IC = InvCount) then
          begin
          Second := InvCount;
          if (Second > First) then
          Begin
             Inc(Mined);
             Inc(Players[CurrentPlayer].Integers[10]);
             Inc(Stats_CustomVars[1]);
             case Players[CurrentPlayer].Strings[1] Of
                  'copper' :  Inc(Stats_CustomVars[6]);
                  'tin' :    Inc(Stats_CustomVars[7]);
                  'iron' :    Inc(Stats_CustomVars[8]);
                  'coal' :    Inc(Stats_CustomVars[11]);
                  'mith' :    Inc(Stats_CustomVars[12]);
             End;
          End;
          Wait(750);  //was 500
          if ClickContinue(false, false) then
          begin
          Inc(Stats_CustomVars[13]);
          TakePic;
          end;
          Exit
          end else
          Break;
        end;
      until (not IC = InvCount) and (GetAnimation <= 0);
      Result := True;
    end;

    and then my MineOre

    SCAR Code:
    Function MineOre(which: TOre): boolean;
    var x, y, T:integer;
    begin
      if not LoggedIn then Exit;
      Result := true;
      FindNormalRandoms;
      wait(random(500));
      T := GetSystemTime;
      while (not FindOre(which, x, y)) do
      begin
        AntiRandoms;
        Case Random(2) Of
          0: Wait(200 + Random(500));
          1: SleepAndMoveMouse(400 + Random(1000));
        End;
        If (GetSystemTime - T > 60000) Then
        begin
          writeln('couldn''t find ore?'); //lol lol lol lol
          Result := false;
          exit;
        end;
      end;
      if FindOre(which, x, y) then
      begin
        case Random(10) of
          0..8: Mouse(x, y, 0, 0, True);
          9:
          begin
            Mouse(x, y, 0, 0, False);
            if (not WaitOption('ine R', 250)) then Exit;
          end;
        end;
        First := InvCount;
        WaitUntilMined(which);
      end;
      Status('Finding Rocks');
    end;

    The First and Second InvCount are the ones trying to count the ores.
    so I have:
    if (Second > First) then
    Inc(Ores)

    So why is that counting too many??
    Ores Mined: 180 |
    | Loads: 4
    ...

    Cheers for any help again guys.
    T~M

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    try making a temp var for Stats_CustomVars. Incing Stats_CustomVars is what is going wrong. No idea why though... I recall bumping into exactly the same kind of problem.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  3. #3
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Wait so Inc(Players[CurrentPlayer].Integers[10]);
    is getting effected by Inc(Stats_CustomVars[1]);

    Weird, cheers Fawk.
    Btw, what you mean by Temp var?

  4. #4
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    What I recall doing was:
    Temp := 0 (local var)
    Temp := Stats_CustomVars;
    Inc Temp;
    Stats_CustomVars := Temp;

    Dunno why, but it worked. Drove me insane, that I remember.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  5. #5
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    So, Temp:= 0 is set at the beginning of the script
    then the other bits are in WaitUntilMined?
    Correct?

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    nah, Temp := 0 is just to indicate I use a Local Variable for swap.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  7. #7
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Why do you first have

    SCAR Code:
    IC := InvCount;
    if (IC = InvCount) then
          begin
          Second := InvCount;
          if (Second > First) then
    Just be simple.
    Before you click the rock:
    SCAR Code:
    IC:=InvCount;
    //AnitBan/ Whatever You Want
    //Waits
    If InvCount>IC Then True
    SCAR Code:
     


    message is too short

  8. #8
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Sadly it isn't to do with Stats
    I have tried the way YoHoJo does it in his script but still no luck.
    I am now giving the person who fixes and tests to make sure it totally works, $5.

    Script is attached.

    Cheers
    T~M

  9. #9
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't understand how you think that it would count the ore. you have

    if Second = PlusOne then

    before you count and you set PlusOne as...

    First+1

    and you never set first so PlusOne = 1 and InvCount = anywhere from 1 to 28.

    try this:
    SCAR Code:
    function WaitUntilMined(Rock: TOre): Boolean;
    var
      GetAnimationTime, T, CX, CY, IC, P, Temp: Integer;
      TempC, C: Byte;
    begin
      TempC := InvCount();
      Status('Walking to Rock');
      MarkTime(t);
      SetColorspeed2Modifiers(Rock.Hue, Rock.Sat);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 6000) then Exit;
      until (not FlagPresent) and FindBlackChatMessage('u swi') and
        (FindColorTolerance(cx, cy, Rock.Color, MSCX-65, MSCY-65, MSCX+65, MSCY+65, Rock.Tol));
      Status('Mining Rock');
      MarkTime(t);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 12000) then Exit;
        C := InvCount();
        if (C <> tempC) then
        Begin
          Inc(Mined);
          Writeln(Mined);
          Inc(Players[CurrentPlayer].Integers[10]);
          Inc(Stats_CustomVars[1]);
          case Players[CurrentPlayer].Strings[1] Of
            'copper' :  Inc(Stats_CustomVars[6]);
            'tin' :    Inc(Stats_CustomVars[7]);
            'iron' :    Inc(Stats_CustomVars[8]);
            'coal' :    Inc(Stats_CustomVars[11]);
            'mith' :    Inc(Stats_CustomVars[12]);
          End;
          break;
        End;
        Wait(750);  //was 500
        if ClickContinue(false, false) then
        begin
          Inc(Stats_CustomVars[13]);
          TakePic;
        end;
        Exit
        end else
          Break;
      until (GetAnimation <= 0);
      Result := True;
    end;

    you had some stuff really badly done. It is hard to fix what you had without completely rewriting it, but I hope that works now. I don't understand your logic on a lot of what you did. The repeat can be more easily done as a while..do loop and you increasing of variables would be smarter if done with a set constant at the start instead of a case statement everytime.
    Last edited by Blumblebee; 02-02-2010 at 09:45 PM.
    “Ignorance, the root and the stem of every evil.”

  10. #10
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    I do set First in MineOre btw.
    But cheers, I will test now.

  11. #11
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    I do set First in MineOre btw.
    But cheers, I will test now.
    you declare first locally though...

    edit: you have like 8 unused variables in your script too...
    Last edited by Blumblebee; 02-02-2010 at 09:50 PM.
    “Ignorance, the root and the stem of every evil.”

  12. #12
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    {Global Vars}
    Var
      PicN, g, Z, AxeDTM, OreDTM, Loads, RestTime, Switched, StartTime, i, Mined,
       First, ReportMark : Integer;

  13. #13
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    "
    SCAR Code:
    function WaitUntilMined(Rock: TOre): Boolean;
    var
      GetAnimationTime, T, CX, CY, IC, P, First, Second, // <-----------------------------------
      Temp, PlusOne: Integer;
    begin
      PlusOne := First+1;

    thus PlusOne = 1 everytime.
    “Ignorance, the root and the stem of every evil.”

  14. #14
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Omg, I am such an idiot! :s
    btw I keep getting:
    Line 694: [Error] (24875:1): Identifier expected
    SCAR Code:
    begin
          Inc(Stats_CustomVars[13]);
          TakePic;
        end;
        Exit;
        end else  // line 694
          Break;
      until (GetAnimation <= 0);

  15. #15
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Missing begin? Paste the whole function.
    There used to be something meaningful here.

  16. #16
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    Omg, I am such an idiot! :s
    btw I keep getting:
    Line 694: [Error] (24875:1): Identifier expected
    SCAR Code:
    begin
          Inc(Stats_CustomVars[13]);
          TakePic;
        end;
        Exit;
        end else  // line 694
          Break;
      until (GetAnimation <= 0);
    your standards were off and I didn't notice it, my bad. I think this should compile:

    SCAR Code:
    function WaitUntilMined(Rock: TOre): Boolean;
    var
      GetAnimationTime, T, CX, CY, IC, P, Temp: Integer;
      TempC, C: Byte;
    begin
      TempC := InvCount();
      Status('Walking to Rock');
      MarkTime(t);
      SetColorspeed2Modifiers(Rock.Hue, Rock.Sat);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 6000) then Exit;
      until (not FlagPresent) and FindBlackChatMessage('u swi') and
        (FindColorTolerance(cx, cy, Rock.Color, MSCX-65, MSCY-65, MSCX+65, MSCY+65, Rock.Tol));
      Status('Mining Rock');
      MarkTime(t);
      repeat
        Wait(10);
        if (TimeFromMark(t) >= 12000) then Exit;
        C := InvCount();
        if (C <> tempC) then
        Begin
          Inc(Mined);
          Writeln(Mined);
          Inc(Players[CurrentPlayer].Integers[10]);
          Inc(Stats_CustomVars[1]);
          case Players[CurrentPlayer].Strings[1] Of
            'copper' :  Inc(Stats_CustomVars[6]);
            'tin' :    Inc(Stats_CustomVars[7]);
            'iron' :    Inc(Stats_CustomVars[8]);
            'coal' :    Inc(Stats_CustomVars[11]);
            'mith' :    Inc(Stats_CustomVars[12]);
          End;
          break;
        End;
        Wait(750);  //was 500
        if ClickContinue(false, false) then
        begin
          Inc(Stats_CustomVars[13]);
          TakePic;
        end;
      until (GetAnimation <= 0);
      Result := True;
    end;

    I just removed the end else and your initial if..then statement.
    “Ignorance, the root and the stem of every evil.”

  17. #17
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Take out the 'end' above the 'Exit'.

  18. #18
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Blumblebee, it didn't work

  19. #19
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    pm me an account to test and ill fix it.
    “Ignorance, the root and the stem of every evil.”

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
  •