Results 1 to 16 of 16

Thread: Falling into a trap

  1. #1
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default Falling into a trap

    I'm trying to make it so the script checks if i fell into the trap after it clicks Jump but i can't seem to get it working. Also when you fall into the pit you get damage taken, i also tried so it checks for hp bar but none are working. I appreciate any help this is holding me back

    SCAR Code:
    Function FallCheck: boolean;
    var
      xas, yas: Integer;
      theChat: String;

    begin
    xas:=MSCX;
       yas:=MSCY;
      theChat := GetChatBoxText(8, clBlack);
      if(ExecRegExpr('You Fall', theChat) OR ExecRegExpr('onto the spik', theChat)) then
      begin
        FellIntoTrap := True;
        writeln('We fell into the trap');
           end;

           if(ExecRegExpr('manage to cross', theChat) OR ExecRegExpr('off safely ', theChat)) then
            begin
        FellIntoTrap := false;
         writeln('We didnt fall into the trap');
            end;

            repeat
           if (FellIntoTrap) then
           begin
              if (FindObjCustom(xas, yas, ['limb'], [1062452], 20)) then
              begin
               CheckAndClick('limb', xas,yas, 'L')
               writeLn('Climbing out of pit');
                  FellIntoTrap := false;
                     end;
           end;
            until Not (FellIntoTrap);
            if NOT(FellIntoTrap) then
           begin

               writeLn('Yay we didnt fall in!');

           end;
      end;

       Function JumpLeaves:boolean;
     begin

     if (FindJumpLeaves(x, y)) then
     begin
     CheckAndClick('Jump', x, y, 'L')
      Wait(6000);
      FallCheck;
     end;
    Last edited by jman1208; 07-19-2012 at 10:13 PM.

  2. #2
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    How about something like this:
    Simba Code:
    function FallCheck: boolean;
    var
      xas, yas: Integer;
    begin
      xas := MSCX;
      yas := MSCY;
      Result := FindChatBoxText('You Fall', 8, clMessage) or FindChatBoxText('onto the spik', 8, clMessage);
      if (Result) then
        WriteLn('You fell into the trap')
      else
        WriteLn('You did not fall, Yay!');
    end;

    function GetOutOfTrap: Boolean;
    Var
      x, y, xas, yas : integer;
    begin
      if (FindObjCustom(xas, yas, ['limb'], [1062452], 20)) then
      begin
        if(WaitUpText('limb', 200+Random(500)))then
          begin
            GetMousePos(x, y);
            if((x = xas) and (y = yas))then
              ClickMouse2(mouse_Left)
            else
              Mouse(xas, yas, 3, 3, mouse_Left);
          end;
        writeLn('Climbing out of pit');
        Result := DidRedClick;
      end;
    end;

    function JumpLeaves: boolean;
    var
      Tries, x, y : integer;
    begin
      if (FindJumpLeaves(x, y)) then
      begin
        CheckAndClick('Jump', x, y, 'L') Wait(6000);
        Tries := 0;
        if (FallCheck) then
          while ((not GetOutOfTrap) and (Tries < 5)) do
            inc(Tries);
      end;
    end;

    If you don't understand what any of the code does then just ask
    Last edited by putonajonny; 07-20-2012 at 01:44 AM.

  3. #3
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    also, you can use a mmpercentblack (or something similar to that) to find out what percent of the MM is black. typically in traps > 90% is black, but out of them 0% is black

  4. #4
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by putonajonny View Post
    How about something like this:


    If you don't understand what any of the code does then just ask

    Thanks! Its almost working well but the only issue i'm having right now is that there's 3 rocks it can choose inside the cave and you can only get to 1 depending on where you fall, so it will click on rocks on another wall sometimes and not the one directly infront or closest. But for now i have a quick fix it changes angles after 3 tries. This is what i got now

    Simba Code:
    function FallCheck: boolean;
    var
      xas, yas: Integer;
    begin
      xas := MSCX;
      yas := MSCY;
       Result := (DungeonColor(x, y));
       if (Result) then
       begin
        WriteLn('You fell into the trap')
        end;
      if Not (result) then
      begin
        WriteLn('You did not fall, Yay!');
        end;
    end;
    function GetOutOfTrap: Boolean;
    Var
      Trys, x, y, xas, yas : integer;
    begin
    Result := (FindJumpLeaves(x,y));
    SetAngle(SRL_Angle_High);
              MakeCompass('n');
         If Not (result) then

         begin
         repeat
          if (Trys > 5) then
                begin
                ChangeAngle;
                writeLN('Changing angle tried too long')
                Trys := 0;
                end;
         writeLN('Trying to get out of cave');
      if (FindObjCustom(xas, yas, ['limb'], [1062452], 20)) then
      begin
        if(WaitUpText('limb', 200+Random(500)))then
          begin

            GetMousePos(x, y);
            inc(Trys);
            if((x = xas) and (y = yas))then
              ClickMouse2(mouse_Left)

            else
               wait(300);
              Mouse(xas, yas, 3, 3, mouse_Left);


                  end;
                  end;
                until (FindJumpLeaves(x,y));
                end else
              if (result) then
              begin
             writeLn('Were out!');
             exit;
            end;
             end;

    Last edited by jman1208; 07-20-2012 at 04:17 AM.

  5. #5
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    For this part:
    Simba Code:
    if (Result) then
       begin
        WriteLn('You fell into the trap')
        end;
      if Not (result) then
      begin
        WriteLn('You did not fall, Yay!');
        end
    You can shorten it by using an if else statement, and you don't need the begins and ends if you are just doing one thing:
    Simba Code:
    if (Result) then
      WriteLn('You fell into the trap')//Notice there is no ; here
    else
      WriteLn('You did not fall, Yay!');

    I am assuming this is where you end up if you fail:

    What do you have to click to get out?
    Last edited by putonajonny; 07-20-2012 at 11:11 AM.

  6. #6
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by putonajonny View Post
    For this part:
    Simba Code:
    if (Result) then
       begin
        WriteLn('You fell into the trap')
        end;
      if Not (result) then
      begin
        WriteLn('You did not fall, Yay!');
        end
    You can shorten it by using an if else statement, and you don't need the begins and ends if you are just doing one thing:
    Simba Code:
    if (Result) then
      WriteLn('You fell into the trap')//Notice there is no ; here
    else
      WriteLn('You did not fall, Yay!');

    I am assuming this is where you end up if you fail:

    What do you have to click to get out?

    You have to click the rocks closest to you because you can't walk inside

  7. #7
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    This part?

    And not this one:

  8. #8
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    - autocolor climbing rocks
    - sort by dist (or use findColorsSpriralTol of the mscx/mscy)
    - create atpa
    - atpa[0] should be the rocks, use middle x/y of atpa[0] and check for uptext

  9. #9
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default


    have this picture come up when you fall in

  10. #10
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    - autocolor climbing rocks
    - sort by dist (or use findColorsSpriralTol of the mscx/mscy)
    - create atpa
    - atpa[0] should be the rocks, use middle x/y of atpa[0] and check for uptext
    Ok thanks, i've never used atpa's before( this is my second script, i'm still fairly new) ill try to find a tutorial and see if i can figure it out

    Quote Originally Posted by putonajonny View Post
    This part?

    And not this one:
    Yes exactly
    Last edited by jman1208; 07-20-2012 at 10:32 PM.

  11. #11
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by jman1208 View Post
    Ok thanks, i've never used atpa's before( this is my second script, i'm still fairly new) ill try to find a tutorial and see if i can figure it out



    Yes exactly
    If you do not want to use FindColorsSpiralTolerance then i would suggest useing ACA and color the rocks(dark brown) this could also be used in order to tell if you fell you could search for the uptext that the rocks have i'm assuming 'limb' (climb) but honestly FindColorsSpiralTolerance will be more accurate however if you are looking for the quick fix going with ACA would be the way GL

    EDIT: On second thought ACA is showing that alot of the surrounding rocks have similar colors...

  12. #12
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Quote Originally Posted by getdropped69 View Post
    If you do not want to use FindColorsSpiralTolerance then i would suggest useing ACA and color the rocks(dark brown) this could also be used in order to tell if you fell you could search for the uptext that the rocks have i'm assuming 'limb' (climb) but honestly FindColorsSpiralTolerance will be more accurate however if you are looking for the quick fix going with ACA would be the way GL

    EDIT: On second thought ACA is showing that alot of the surrounding rocks have similar colors...
    his aca should look something like this: http://puu.sh/LBRs with a distance of about 10-15

  13. #13
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    How does the minimap look before&after? could use PercentColorMM.

  14. #14
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    How does the minimap look before&after? could use PercentColorMM.
    or even a count color if it turns mostly black that would be easier. There are so many different ways you could go at this it is really up to your preference but thats why we are he to show you the tools just woundering where exactly is that trap any ways i dont think i have ever been where ever it is.

  15. #15
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Quote Originally Posted by getdropped69 View Post
    or even a count color if it turns mostly black that would be easier. There are so many different ways you could go at this it is really up to your preference but thats why we are he to show you the tools just woundering where exactly is that trap any ways i dont think i have ever been where ever it is.
    its in the elven lands (dont know exactly what its called - far far west on world map - west of ardy, south west of tree gnome stronghold)

  16. #16
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Trying to make a grenwaller :P?

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
  •