Results 1 to 10 of 10

Thread: Can't get my script to work properly?

  1. #1
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default Can't get my script to work properly?

    I've been trying for most of today to get this script working how i'd like it to work. I've only started to learn to script a couple days ago, that's why theres a few bugs. Basically it will only use the same iron rock every time and will only do it once even though i have made the main loop like this

    Begin
    repeat
    FindObject
    MineOre
    Antiban
    until(false)

    Here is my script code if someone could help me getting this working 100% i'd be so grateful;
    Simba Code:
    program FindObject;
    {$DEFINE SMART}
    {.include SRL\SRL.simba}


    const
      SRLStats_User     = '';   // Your SRL Stats Username
      SRLStats_Password = '';   // Your SRL Stats Password
      SERVER            = 35;  // Enter "0" to pick a random server.
      MEMBERS           = True;
      Version           ='1.4';

      Procedure DeclarePlayers;
    begin;
      HowManyPlayers:=1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer:=0;

      Players[0].Name:='';
      Players[0].Pass:='';
      Players[0].Nick:='';
      Players[0].Active:=True;
    end;
    procedure AntiBan;
    begin
      if(not(LoggedIn))then
      Exit;
      FindNormalRandoms;
      case Random(160) of
      0:
      begin
       WriteLn('AntiBan Is Being Performed');
       GameTab(Tab_Stats);
       HoverSkill('Mining', false);
       wait(2500 + Random(1000));
       Mouse(659, 189, 0, 0, True);
      end;
      1:
      begin
       WriteLn('Bored')
       BoredHuman;
      end;
      end;
    end;

    var
      x, y: Integer;

    function FindObject(var fx, fy: Integer): Boolean;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      X, Y, Z: Extended;
      PlusOne, MineCounter : integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.03, 0.52);

      if not(FindColorsTolerance(arP, 2436940, MSX1, MSY1, MSX2, MSY2, 12)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      arUC := arC;
      ClearSameIntegers(arUC);
      arL := High(arUC);
      arL2 := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 1.17) and (X <= 10.58) and (Y >= 1.01) and (Y <= 8.64) and (Z >= 0.65) and (Z <= 4.38) then
        begin
          for j := 0 to arL2 do
          begin
            if (arUC[i] = arC[j]) then
            begin
              SetLength(arAP, Length(arAP) + 1);
              arAP[High(arAP)] := arP[j];
            end;
          end;
        end;
      end;

      SortTPAFrom(arAP, Point(MSCX, MSCY));
      ararP := SplitTPAEx(arAP, 10, 10);
      arL := High(ararP);

      for i := 0 to arL do
      begin
        if (Length(ararP[i]) < 10) then Continue;
        P := MiddleTPA(ararP[i]);
        MMouse(P.x, P.y, 5, 5);
        Wait(100 + Random(100));
        if (IsUpText('ine')) then
        begin;
          Result := True;
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
      begin
        Writeln('FindObject could not find object.');
        Exit;
      end;

      GetMousePos(fx, fy);
    begin
    {if not FindNormalRandoms then
          if not LoggedIn then
             TerminateScript}
    ;
      MakeCompass('N');
       SetAngle(SRL_ANGLE_HIGH);
       wait(200+random(400));

        case random(2) of
      0: Mouse(fx, fy, 5, 5, True);
      1: begin
        Mouse(fx, fy, 5, 5, False);
        WaitOption('Mine', 500);
      if (invfull) then DropAll
          end;
       end;
    MarkTime(MineCounter);
    repeat
        Antiban;
        Wait(100);
        if InvCount=Plusone Then
          writeln('We Mined an ore');
        Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
        end;
    begin
      Smart_Signed := TRUE;
      Smart_Members := MEMBERS;
      Smart_SuperDetail := FALSE;
      Smart_Server := 35;
      ActivateClient;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      wait(4000+random(400));
      repeat
      FindObject;
      Antiban;
      until(false)
    end.

    The issue is that it will only click once on an ore and then just stalls until lobby
    Last edited by Syntax; 05-30-2012 at 09:46 AM.

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

    Default

    Two things.

    First you have the Mine function AND you have a FindObject function, that's two functions to find the ore, why not just one?

    Second, I believe the culprit is
    Simba Code:
    repeat
        MarkTime(MineCounter);
        Antiban;
        Wait(100);
        if InvCount=Plusone Then
          writeln('We Mined an ore');
        Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)

    You have the MarkTime AFTER the repeat, meaning each time the loop starts over, the timer is reset (which is probably quite fast), so then TimeFromMark(MineCounter) will NEVER > 6500 since it keeps marking/resting timer so fast, so If InvCount=PlusOne never happens, it will just loop forever.

    The fix is to put the MarkTime BEFORE the repeat.
    That should do it buddy!

  3. #3
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    From the looks of it, the MineOre function doesn't have a way to find an ore. You've set it to click a point (x, y) and search for 'mine' uptext, but there's nothing storing values in (x, y)! You should merge FindObject() and MineOre.

    Also, you should probably stop leaving your account info in your script >.<

  4. #4
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default

    Ok did everything you guys suggested but still not working
    Code:
    program FindObject;
    {$DEFINE SMART}
    {.include SRL\SRL.simba}
    
    
    const
      SRLStats_User     = '';   // Your SRL Stats Username
      SRLStats_Password = '';   // Your SRL Stats Password
      SERVER            = 35;  // Enter "0" to pick a random server.
      MEMBERS           = True;
      Version           ='1.4';
    
      Procedure DeclarePlayers;
    begin;
      HowManyPlayers:=1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer:=0;
    
      Players[0].Name:='';
      Players[0].Pass:='';
      Players[0].Nick:='';
      Players[0].Active:=True;
    end;
    procedure AntiBan;
    begin
      if(not(LoggedIn))then
      Exit;
      FindNormalRandoms;
      case Random(160) of
      0:
      begin
       WriteLn('AntiBan Is Being Performed');
       GameTab(Tab_Stats);
       HoverSkill('Mining', false);
       wait(2500 + Random(1000));
       Mouse(659, 189, 0, 0, True);
      end;
      1:
      begin
       WriteLn('Bored')
       BoredHuman;
      end;
      end;
    end;
    
    var
      x, y: Integer;
    
    function FindObject(var fx, fy: Integer): Boolean;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      X, Y, Z: Extended;
      PlusOne, MineCounter : integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.03, 0.52);
    
      if not(FindColorsTolerance(arP, 2436940, MSX1, MSY1, MSX2, MSY2, 12)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      arUC := arC;
      ClearSameIntegers(arUC);
      arL := High(arUC);
      arL2 := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 1.17) and (X <= 10.58) and (Y >= 1.01) and (Y <= 8.64) and (Z >= 0.65) and (Z <= 4.38) then
        begin
          for j := 0 to arL2 do
          begin
            if (arUC[i] = arC[j]) then
            begin
              SetLength(arAP, Length(arAP) + 1);
              arAP[High(arAP)] := arP[j];
            end;
          end;
        end;
      end;
    
      SortTPAFrom(arAP, Point(MSCX, MSCY));
      ararP := SplitTPAEx(arAP, 10, 10);
      arL := High(ararP);
    
      for i := 0 to arL do
      begin
        if (Length(ararP[i]) < 10) then Continue;
        P := MiddleTPA(ararP[i]);
        MMouse(P.x, P.y, 5, 5);
        Wait(100 + Random(100));
        if (IsUpText('ine')) then
        begin;
          Result := True;
          Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
      begin
        Writeln('FindObject could not find object.');
        Exit;
      end;
    
      GetMousePos(fx, fy);
    begin
    {if not FindNormalRandoms then
          if not LoggedIn then
             TerminateScript};
      MakeCompass('N');
       SetAngle(SRL_ANGLE_HIGH);
       wait(200+random(400));
    
        case random(2) of
      0: Mouse(fx, fy, 5, 5, True);
      1: begin
        Mouse(fx, fy, 5, 5, False);
        WaitOption('Mine', 500);
      if (invfull) then DropAll
          end;
       end;
    MarkTime(MineCounter);
    repeat
        Antiban;
        Wait(100);
        if InvCount=Plusone Then
          writeln('We Mined an ore');
        Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
        end;
    begin
      Smart_Signed := TRUE;
      Smart_Members := MEMBERS;
      Smart_SuperDetail := FALSE;
      Smart_Server := 35;
      ActivateClient;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      wait(4000+random(400));
      repeat
      FindObject;
      Antiban;
      until(false)
    end.

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

    Default

    Debug Debug Debug

    Add a bunch of writelns all over with some type of messagee that tells you what part of the script that writeln is at.
    Run the script, and see where they stop happening, and there is where the problem is.

  6. #6
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Debug Debug Debug

    Add a bunch of writelns all over with some type of messagee that tells you what part of the script that writeln is at.
    Run the script, and see where they stop happening, and there is where the problem is.
    Well, i think its something to do from the mining section from the writeins- I want to figure this out myself but i don't know..

  7. #7
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default

    Bump

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

    Default

    Post your latest code in simba tags, explain what's wrong again.

  9. #9
    Join Date
    Dec 2006
    Location
    UK!!
    Posts
    910
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    if InvCount=Plusone Then
          writeln('We Mined an ore');
        Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
        end;
    From a quick browse, you never set plusOne to anything. So I don't think it will ever say we mined an ore.

    So it will keep getting skipped. Although I haven't really looked through it.

  10. #10
    Join Date
    Nov 2011
    Location
    Australia
    Posts
    418
    Mentioned
    2 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by [S]paz View Post
    Code:
    if InvCount=Plusone Then
          writeln('We Mined an ore');
        Until (InvCount=PlusOne) or (TimeFromMark (MineCounter) > 6500)
        end;
    From a quick browse, you never set plusOne to anything. So I don't think it will ever say we mined an ore.

    So it will keep getting skipped. Although I haven't really looked through it.
    Has been saying "We Mined An Ore" but just ain't clicking its going over the objects just keeps clicking on the same one and only once then script stalls to lobby. Getting really frustrating, not sure if i got colours incorrect in aca but doubt it and the clicking method i'm sure is ok.
    Thanks for the feedback.

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
  •