Results 1 to 4 of 4

Thread: Simple question

  1. #1
    Join Date
    Apr 2012
    Location
    Land of the Rising Sun
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    77 Post(s)

    Default Simple question

    I'm trying to setup a fail safe for a script, in case the character ends up in a location where they can see an iron rock, but can't reach it.

    This is what I've got, but I can't seem to get it to work.

    Here are the two procedures.



    Code:
    Procedure WrongSideOfWall;
    begin
      if FindChatBoxText('You can''t reach that.',8,ClBlack) then
      begin
        WriteLn('Wrong side of wall, attempting to get to right spot');
      end;
    end;  
    
    
    
    Procedure MineOres;
    var
      x, y, PlusOne, OreCounter: Integer;
    begin
      MarkTime(TooLong);
      PlusOne:= InvCount+1;
      If FindObjCustom(x, y, ['ron'], [3491704, 3557754, 3755136, 3294324], 5) Then
        begin
          FindNormalRandoms;
          StatsGuise('Found Iron.');
          MMouse (x, y, 5, 5);
          ClickMouse2(Mouse_left)
        end;
    
        Flag;
        MarkTime(OreCounter);
        WrongSideOfWall;
        If (TimeFromMark(TooLong) > 30000) Then
        FailSafe('Failed to find Iron.');
    
        repeat
        If (TimeFromMark(TooLong) > 30000) Then
        FailSafe('Failed to find Iron.');
        Antiban;
        Wait(100);
        If InvCount=PlusOne Then
        begin
          StatsGuise('Mined a precious Iron.');
          Proggy;
        end;
        until (InvCount=PlusOne) or (TimeFromMark(OreCounter) > 3000+random(1500));
    end;
    My Scripts: DWT Iron Miner

  2. #2
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Won't you get error on this line?

    if FindChatBoxText('You can''t reach that.',8,ClBlack) then

    The word "can't" just ended your string with the '

  3. #3
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Instead of 'FindChatBoxText('You can''t reach that.',8,ClBlack)' try this:
    Simba Code:
    FindBlackChatMessage('t reach th')

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  4. #4
    Join Date
    Apr 2012
    Location
    Land of the Rising Sun
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    77 Post(s)

    Default

    Quote Originally Posted by Haxz View Post
    Won't you get error on this line?

    if FindChatBoxText('You can''t reach that.',8,ClBlack) then

    The word "can't" just ended your string with the '
    Nah it doesn't make an error cause I have two ' marks, but maybe it messes up the string.

    Instead of 'FindChatBoxText('You can''t reach that.',8,ClBlack)' try this:

    Simba Code:
    FindBlackChatMessage('t reach th')
    Thanks Flight, that worked straight away


    EDIT:

    on another note, could anyone tell me what's wrong with the following?

    I want the script to retry moving to the right area and click a TPA if it fails to find the TPA.

    So far, it will attempt to move to the right area, but just clicks the area 3 times (max attempts) then logs out without trying to click the shortcut again.


    Simba Code:
    Procedure FindShortcut2;
    var
      PathTPA, WallTPA:TPointArray;
      PathATPA:T2DPointArray;
      PathBox:TBox;
      attempts: integer;
      i, r, counter:integer;
    begin
     if not(loggedin) then
        exit;
      Wait(RandomRange(2000, 200));
      SetColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.13, 0.43);

      if FindColorsSpiralTolerance(MSX1, MSY1, PathTPA, 4413280, MSX1, MSY1, MSX2, MSY2, 20) then
      begin
          PathATPA := SplitTPAEx(PathTPA, 25, 25);
          SortATPASize(PathATPA, True);
          for i := 0 to high(PathATPA) do
          begin
            PathBox := GetTPABounds(PathATPA[i]);
            SetColorSpeed2Modifiers(0.20, 3.85);

            if FindColorsSpiralTolerance(MSX1, MSY1, WallTPA, 12118515, PathBox.X1, Pathbox.Y1, Pathbox.X2, Pathbox.Y2, 10) then
            Break;

            if i = high(PathATPA) then
            begin
              WriteLn('Failed to find wall color.');
              repeat
              Inc(attempts);
              RunBack;
              Obstaclearea2;
              until (i= high(PathATPA) = false) or (attempts > 3);       //Meant to move to the right area and re-search for the wall if it doesn't find the colors.
           end;

            if (attempts > 3) then
            begin
              StatsGuise('Failed to find shortcut after a few tries, logging out.');
              Failsafe('Failed to find wall and path colors.');
              Logout;[/COLOR]
            end;
          end;
          SetColorToleranceSpeed(1);
          SetColorSpeed2Modifiers(0.2, 0.2);
          marktime(counter);
          while (not isuptext('wall')) do
          begin
            r := random(length(WallTPA));
            mmouse(WallTPA[r].x, WallTPA[r].y, 2, 2);
            wait(randomrange(200, 500));

            if timefrommark(counter) > 15000 then
            begin
              WriteLn('Failed to click the shortcut.');        //Meant to move to the right area and try and click the shortcut again if it fails.
              repeat
              Obstaclearea2;
              Inc(attempts);
              until (DidRedClick = true)  or (attempts > 3);
            end;
            if (attempts > 3) then
            begin
              StatsGuise('Failed to find shortcut after a few tries, logging out.');
              Failsafe('Failed to find shortcut after banking.');
              Logout;
            end;
          end;
          ClickMouse2(Mouse_left);
      end;
      Wait(RandomRange(3000, 5000));
    end;
    Last edited by Thief; 05-22-2013 at 12:03 PM.
    My Scripts: DWT Iron Miner

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
  •