Results 1 to 5 of 5

Thread: Help with a reflection check

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with a reflection check

    I am currently working on a script. It is going to use color with reflection backup (or vice-versa).

    This is the part of the script right herrr that is troubling me,

    Simba Code:
    function CheckIron: TPoint;
    var
    i: integer;
    IronTPA: TPointArray;
    begin
      Result := Point(-1, -1);
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(MSCX, MSCY, IronTPA, 969971, MSX1, MSY1, MSX2, MSY2, 20); // Dummy color
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
      for i := 0 to high(GoldTPA) do
      begin
        MMouse(IronTPA[I].x, IronTPA[I].y, 2, 2);
        if(IsUpTextMultiCustom(['ine','ock','cks'])) then
        begin
          Result := IronTPA[I];
          Writeln('Iron Found, or a different rock. Doing a reflection check.');
    // this right herrr
        end
      end;
    end;

    I was wondering, what could I do for a reflection check if it finds the rock to make sure it is iron and it isn't mined?

    Thanks in advanced.

  2. #2
    Join Date
    Oct 2008
    Posts
    500
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You will have to collect the ids of the mined/unmined rocks of your area. Then, once you find the rock using color, convert the Point into a TTile, and check the ID of the object found on that tile. Compare it to your array of Rock IDs and there ya go.

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ahh, thank you.
    I'm quiet new to reflection, and know some of it, but I do not know its limits.
    If anyone would like to help me send me a PM.

    Edit:
    I finally got my IDs for the 4 rocks (Gold and Iron).

    Set up my const
    Simba Code:
    // Don't TOUCH THIS
      TallIRockID = 9720;
      ShortIRockID = 9722;        // Reflection IDs
      TallGRockID = 9717;
      ShortGRockID = 9718;
      //Looking South - Tall gold is left and short is right

    Confusing if you don't know what I'm talking about, but this isn't the problem.

    Simba Code:
    function CheckIron: TPoint;
    var
    i: integer;
    IronTPA: TPointArray;
    IRock: TTile;
    begin
      Result := Point(-1, -1);
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 0.13);
      FindColorsSpiralTolerance(MMCX, MMCY, IronTPA, 1713730, MMX1, MMY1, MMX2, MMY2, 5);
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(1);
      for i := 0 to high(IronTPA) do
      begin
        MMouse(IronTPA[I].x, IronTPA[I].y, 2, 2);
        if(IsUpTextMultiCustom(['ine','ock','cks'])) then
        begin
          Result := IronTPA[I];
          Writeln('Iron Found, or a different rock. Doing a reflection check.');
          IRock := PointToTile(IronTPA[I]);



        end
      end;
    end;

    Those empty three lines are my problem. How would I grab the ID of the tile and see if it matches the ID from the const?

  4. #4
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    I think its something like this:
    Simba Code:
    procedure GetIDAtTile(TTile);
    var
      rock: TRSObject;
    begin
      rock := GetObjectAt(TTile, 0);
      writeln(rock.ID);
    end;
    Im not on a comp with simba on it, so im not sure about the exact command.

  5. #5
    Join Date
    Oct 2008
    Posts
    500
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Something like:
    First Add
    Rock : TRSObject
    Then
    Rock := GetObjectAt(IRock);

    After That Rock.ID will return the ID of the object on the tile you found.

    :/ KingKong beat me to it.

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
  •