Results 1 to 2 of 2

Thread: Runespan Functions

  1. #1
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default Runespan Functions

    The below gets any platforms on level 3. Returns "Info" which tells you what the platform requires to cross.

    Any variables in the Info class that are set to true are required to cross the platform.. It's easy to add a platform by just using ACA and getting the speed, color and tolerance then add it to ReturnInfo function.

    It can find platforms by the colours on it OR by examining the platform and using regex's to determine what text is in the chat via BlackChat text. Oh and it returns a point to the platform which can be used for clicking it.

    Feel free to edit or post your own. Oh and just one more thing.. SPS works in there. All platforms are static and the requirements to cross them never change. They are always in the same location as well. At least for me :S

    Simba Code:
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}
    {$I SRL/SRL/Misc/PaintSmart.Simba}
    {$I SRL/SRL/Misc/Debug.Simba}

    type
      Info = record
        Location: TPoint;
        Color: TIntegerArray;
        Tolerance: TIntegerArray;
        Speed: TExtendedArray;
        Air, Earth, Fire, Water, Nature, Mind, Elemental: Boolean;
    end;

    var
      PlatForm: Info;

    Function ReturnInfo(Level: Integer): Info;
    begin
      Case Level Of
        3:
          begin
            Result.Color:= [6174568];
            Result.Tolerance:= [8];
            Result.Speed:= [0.06, 0.31];
          end;
      end;
    end;

    Procedure ResetInfo;
    begin
      Platform.Location:= Point(-1, -1);
      Platform.Air:= False;
      Platform.Earth:= False;
      Platform.Elemental:= False;
      Platform.Fire:= False;
      Platform.Mind:= False;
      Platform.Nature:= False;
      Platform.Water:= False;
    end;

    Function FindPlatform(Level: Integer): Info;
    var
      CTS, L, I, X, Y: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
      B: TBox;
    begin
      ResetInfo;
      Platform:= ReturnInfo(Level);

      CTS:= GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Platform.Speed[0], Platform.Speed[1]);
      FindColorsTolerance(TPA, Platform.Color[0], MSX1, MSY1, MSX2, MSY2, Platform.Tolerance[0]);
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if Length(TPA) < 1 then
        Exit;

      ATPA:= TPAToATPAEx(TPA, 50, 43);
      SortATPAFromSize(ATPA, 100, False);

      L := High(ATPA);
      For I := 0 to L do
      begin
        B := GetTPABounds(ATPA[I]);
        with B do
        begin
          ColorToleranceSpeed(2);
          SetColorSpeed2Modifiers(0.25, 1.35);
          Platform.Earth:= FindColorTolerance(X, Y, 3703711, B.X1, B.Y1, B.X2, B.Y2, 13);
          SetColorSpeed2Modifiers(0.2, 0.2);

          //Platform.Air:= FindColorTolerance(X, Y, Col, B.X1, B.Y1, B.X2, B.Y2, Tol);


          //Platform.Fire:= FindColorTolerance(X, Y, Col, B.X1, B.Y1, B.X2, B.Y2, Tol);

          SetColorSpeed2Modifiers(0.67, 2.04);
          Platform.Water:= FindColorTolerance(X, Y, 13085784, B.X1, B.Y1, B.X2, B.Y2, 15);
          SetColorSpeed2Modifiers(0.2, 0.2);
          SetColorSpeed2Modifiers(0.64, 1.16);
          Platform.Nature:= FindColorTolerance(X, Y, 3913574, B.X1, B.Y1, B.X2, B.Y2, 13);
          SetColorSpeed2Modifiers(0.2, 0.2);
          ColorToleranceSpeed(CTS);
        end;
      end;
      SortTPAFrom(TPA, Point(MSCX, MSCY));
      //MiddleTPAEx(TPA, Platform.Location.X, Platform.Location.Y);
      Platform.Location:= TPA[0];
      Result:= Platform;
    end;

    Function PlatformType(Level: Integer): Info;
    var
      I, L: Integer;
      Text: TStringArray;
    begin
      FindPlatform(3);
      MMouse(Platform.Location.X, Platform.Location.Y, 0, 0);
      if (WaitUptextMulti(['plat', 'form', 'latfo', 'atfo'], 1500)) then
      begin
        ClickMouse2(MOUSE_RIGHT);
        if WaitOptionMulti(['mine', 'exa', 'ami', 'examine', 'Examine'], 600) then
        begin
          Wait(1500);
          Text:= ChatBoxTextArray(clBlack);
          if (Length(Text) < 1) then
            Exit;
          L:= High(Text);
          For I:= 0 To L do
          begin
            if (ExecRegExpr('Earth|earth', Text[I])) then
              Platform.Earth:= True;
            if (ExecRegExpr('Fire|fire', Text[I])) then
              Platform.Fire:= True;
            if (ExecRegExpr('Water|water', Text[I])) then
              Platform.Water:= True;
            if (ExecRegExpr('Nature|nature', Text[I])) then
              Platform.Nature:= True;
            if (ExecRegExpr('Air|air', Text[I])) then
              Platform.Air:= True;
            if (ExecRegExpr('Mind|mind', Text[I])) then
              Platform.Mind:= True;
            if (ExecRegExpr('Elemental|elemental', Text[I])) then
              Platform.Elemental:= True;
          end;
        end;
      end;
    end;

    begin
      Smart_Server := 72;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;

      SetupSRL;
      ClearDebug;
      //FindPlatform(3);
      PlatformType(3);
    end.

  2. #2
    Join Date
    Dec 2011
    Location
    Berlin
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    It is looking nice I would use some of the functions for my personal script later! Thank you for sharing"

    I will try to answer all Runescape related questions!

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
  •