Results 1 to 11 of 11

Thread: AirCrafter Blog

  1. #1
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default AirCrafter Blog

    Well. This time I'm going to try to follow through with creating the script.

    Here's what I have so far:
    SCAR Code:
    program New;
    {.include SRL\SRL\Misc\Smart.scar}
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Reflection\Reflection.scar}


    var
      GuildFork, BottomGuild,
        BelowGate, BareSpot, AlmostThere, SuccessSpot,
        ArcRoadSpot, ArcForkRoadSpot, RockRoadSpot,
        TreeRoadSpot, BelowGateSpot, BottomGuildSpot,
        TopGuildSpot, BankSpot: TPoint;
      x, y, BareSpotDTM, RuinColor, AltarColor, PortalColor: Integer;


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

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;

    end;


    procedure SetupScript;
    begin
      GuildFork := Point(3007, 3344);
      BottomGuild := Point(3007, 3333);
      BelowGate := Point(3007, 3316);
      BareSpotDTM := DTMFromString('78DA630C606260A866400159B50A0CFC409A1' +
           '188FF0301632C504D09AA1A3F7D2630CD08E533C603F9F9A86AAC' +
           'FDD950D580CCC94455A3E5C080AA260AA8A699805DC9986E16614' +
           '533270DA8A614558D8C0BAA1A00B6150D66');
      BareSpot := Point(2998, 3308);
      AlmostThere := Point(2992, 3301);
      SuccessSpot := Point(2985, 3294);
      ArcRoadSpot := Point(2992, 3282);
      ArcForkRoadSpot := Point(3004, 3286);
      RockRoadSpot := Point(3006, 3299);
      TreeRoadSpot := Point(3006, 3307);
      BelowGateSpot := Point(3008, 3317);
      BottomGuildSpot := Point(3006, 3329);
      TopGuildSpot := Point(3007, 3344);
      BankSpot := Point(3012, 3355);
    end;


    function WalkToStone: boolean;
    var
      sx, sy: integer;
    begin
      if not LoggedIn then Exit;
      if not WalkToTile(GuildFork, 3, 0) then
      begin
        if not RadialRoadWalk(FindFallyRoadColor, 190, 244, 48, 0, 0) then  //Guild Fork
        begin
          Players[CurrentPlayer].Loc := 'bank';
          Exit;
        end;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(BottomGuild, 3, 0) then
      begin
        if not RadialRoadWalk(FindFallyRoadColor, 186, 236, 61, 0, 0) then //Bottom of guild
        begin
          Players[CurrentPlayer].Loc := 'Guild Fork'; //bott
          Exit;
        end;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(BelowGate, 3, 0) then
      begin
        if not RadialRoadWalk(FindRoadColor, 133, 203, 68, 0, 0) then //Below the gate
        begin
          Players[CurrentPlayer].Loc := 'Bottom of the Guild'; //bel
          Exit;
        end;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(BareSpot, 3, 0) then
      begin
        if not DTMRotated(BareSpotDTM, sx, sy, MMX1, MMY1, MMX2, MMY2) then
        begin
          Players[CurrentPlayer].Loc := 'Below the Gate'; //bare
          Exit;
        end else
          Mouse(sx, sy, 2, 2, True);
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(AlmostThere, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Bare Spot'; //alm
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(SuccessSpot, 1, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Almost There';
        Exit;
      end;
      Result := True;
      Players[CurrentPlayer].Loc := 'There';
    end;

    function WalkToBank: boolean;
    var sx, sy: integer;
    begin
      if not LoggedIn then Exit;
      if not RadialRoadWalk(FindRoadColor, 107, 147, 48, 0, 0) then
      begin
        if not WalkToTile(ArcRoadSpot, 3, 0) then
        begin
          Players[CurrentPlayer].Loc := 'Altar';
          Exit;
        end;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(ArcForkRoadSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Arc Road Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(RockRoadSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Arc Fork Road Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(TreeRoadSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Rock Road Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(BelowGateSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Tree Road Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(BottomGuildSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Below Gate Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not WalkToTile(TopGuildSpot, 3, 0) then
      begin
        Players[CurrentPlayer].Loc := 'Bottom Guild Spot';
        Exit;
      end;
      r_Flag;
      FindNormalRandoms;
      if not FindSymbol(sx, sy, 'bank') then
      begin
        if not WalkToTile(BankSpot, 1, 0) then
        begin
          Players[CurrentPlayer].Loc := 'Top Guild Spot';
          Exit;
        end;
      end
      else
        Mouse(sx, sy, 0, 0, True);
      if TileOnMS(BankSpot, 0) then
      begin
        Result := True;
        Players[CurrentPlayer].Loc := 'Bank';
      end;
    end;
     

    function FindObjectATPASpiralTolerance(Color, Tolerance: Integer; UpText: string): TPoint;
    var
    i, Timer: Integer;
    tempPoint: TPoint;
    tempTPA: TPointArray;
    tempATPA: T2DPointArray;
    begin
      FindColorsSpiralTolerance(MSCX, MSCY, tempTPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
      repeat
        MarkTime(Timer);
        if length(tempTPA)=0 then
        begin
          Inc(Tolerance);
          FindColorsSpiralTolerance(MSCX, MSCY, tempTPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
        end;
      until((length(tempTPA)>0) or (TimeFromMark(Timer)>=60000));
      tempATPA := SplitTPA(tempTPA, 5);
      SortATPASize(tempATPA, True);
      for i := 0 to High(tempATPA) do
      begin
        tempPoint := MiddleTPA(tempATPA[i]);
        MMouse(tempPoint.x, tempPoint.y, 0, 0);
        Wait(250 + Random(150));
        if IsUpText(UpText) then
        begin
          Result := tempPoint;
          Exit;
        end;
      end;
    end;


    function FindRuin: boolean;
    var
      RuinPoint: TPoint;
    begin
      if not LoggedIn then Exit;
      RuinColor := 9272937;
      RuinPoint := FindObjectATPASpiralTolerance(RuinColor, 5, 'ruin');
      MMouse(RuinPoint.x, RuinPoint.y, 0, 0);
      Wait(125 + Random(500));
      if IsUpText('ruin') then
      begin
        Mouse(RuinPoint.x, RuinPoint.y, 0, 0, True);
        Result := True;
      end
      else
        WriteLn('Couldn''t find ruin!');
        Exit;
    end;

    function FindAltar: boolean;
    var
      AltarPoint: TPoint;
    begin
      if not LoggedIn then Exit;
      AltarColor := 6051161;
      AltarPoint := FindObjectATPASpiralTolerance(AltarColor, 5, 'Altar');
      MMouse(AltarPoint.x, AltarPoint.y, 0, 0);
      Wait(125 + Random(500));
      if IsUpText('Altar') then
      begin
        Mouse(AltarPoint.x, AltarPoint.y, 0, 0, True);
        Result := True;
      end
      else
        WriteLn('Couldn''t find altar!');
        Exit;
    end;

    function FindPortal: boolean;
    var
      PortalPoint: TPoint;
    begin
      if not LoggedIn then Exit;
      PortalColor := 8959933;
      PortalPoint := FindObjectATPASpiralTolerance(PortalColor, 5, 'Portal');
      MMouse(PortalPoint.x, PortalPoint.y, 0, 0);
      Wait(125 + Random(500));
      if IsUpText('Portal') then
      begin
        Mouse(PortalPoint.x, PortalPoint.y, 0, 0, True);
        Result := True;
      end
      else
        WriteLn('Couldn''t find portal!');
        Exit;
    end;


    begin
    SetupSRL;
    DeclarePlayers;
    SmartSetupEx(161, True, True, False);
    SetTargetDC(SmartGetDC);
    LoginPlayer;
    SetupScript;
    if not WalkToStone then WriteLn('Player got lost at: ' + Players[CurrentPlayer].Loc);
    if (Players[CurrentPlayer].Loc = 'There') then
    begin
      Wait(1250);
      FindNormalRandoms;
      r_Flag;
      Wait(1000 + Random(250));
      FindNormalRandoms;
      if FindRuin then
      begin
        WriteLn('Found ruin.');
        repeat
          Wait(100);
          FindNormalRandoms;
          Status('RoadCheck');
          ClearDebug;
        until not FindColor(x, y, FindRoadColor, MMX1, MMY1, MMX2, MMY2);
        WriteLn('RoadCheck := Success');
        if FindAltar then
        begin
          WriteLn('Found altar.');
          r_Flag;
          Wait(1000 + Random(350));
          r_Flag;
          if FindPortal then
          begin
            WriteLn('Found portal.');
            r_Flag;
            FindNormalRandoms;
            if not WalkToBank then WriteLn(Players[CurrentPlayer].Loc);
          end;
        end;
      end;
    end;
    end.

    It uses reflection as it's main walking tool, with RRW as a backup. Right now, I only have it being able to walk from Fally East Bank to the ruins, then open the ruin, craft the ess, open the portal, then walk to the bank.

    If you want to help me, PLEASE DO!

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

    Default

    SCAR Code:
    procedure SetupPlaces;
    begin
      GuildFork := Point(3007, 3344);
      BottomGuild := Point(3007, 3333);
      BelowGate := Point(3007, 3316);
      BareSpotDTM := DTMFromString('78DA630C606260A866400159B50A0CFC409A1' +
           '188FF0301632C504D09AA1A3F7D2630CD08E533C603F9F9A86AAC' +
           'FDD950D580CCC94455A3E5C080AA260AA8A699805DC9986E16614' +
           '533270DA8A614558D8C0BAA1A00B6150D66');
      BareSpot := Point(2998, 3308);
      AlmostThere := Point(2992, 3301);
      SuccessSpot := Point(2985, 3294);
    end;

    Make all the individual points into one TPA, reduces memory .
    Just comment a list telling which is which.
    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

  3. #3
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Make all the individual points into one TPA, reduces memory .
    Just comment a list telling which is which.
    How would that reduce memory?
    Hup Holland Hup!

  4. #4
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Meh. Idk.

    The only thing I could think of is that it doesn't have to declare a lot of individual variables, just a bunch into 1. Don't really see much difference though, if any.

  5. #5
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    In a time where every pc got 512+mb of RAM, those few bytes don't really matter.
    I made a new script, check it out!.

  6. #6
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol. So, in other words I didn't have to change it. But, oh well.

    Can I make any improvements?

    EDIT: Changed the Location styles.

  7. #7
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    UPDATED.

    Added open ruin, find altar, find portal, walk to bank.

    Please help me make improvements!

  8. #8
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    add loops in your find alter and portal. like make it try more than once... like

    MouseSHity.
    if TimeFromMaker(IAMGAy) > 10000;
    Break;
    Until IsUpTexT('alter');

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

    Default

    Quote Originally Posted by NiCbaZ View Post
    if TimeFromMaker(IAMGAy) > 10000;
    Rofl...
    “Ignorance, the root and the stem of every evil.”

  10. #10
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    NiCbaz, the FindObjectATPASpiralTolerance goes through all of it's TPAs until it finds the appropriate UpText, then it returns the x, y of that point.

  11. #11
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh mybad didnt read through that function...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. AirCrafter
    By TViYH in forum OSR Help
    Replies: 6
    Last Post: 10-02-2008, 09:17 PM
  2. W16 AirCrafter
    By Jackrawl in forum OSR Help
    Replies: 11
    Last Post: 09-22-2007, 06:49 PM
  3. [RS2][SRL]AirCrafter v0.1[SRL][RS2]
    By magnetical in forum RS3 Outdated / Broken Scripts
    Replies: 18
    Last Post: 02-19-2007, 06:03 PM

Posting Permissions

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