Results 1 to 8 of 8

Thread: Finding the angle of a rotated DDTM.

  1. #1
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Finding the angle of a rotated DDTM.

    Ok, so I read up on DDTMS and thought that I had them figured out, apparently not . I can't figure out what I am doing wrong, but the DTM never returns as found. Unfortunately, I don't seem to be able to find any documentation on the FindRotatedDTM function, so I have tried to mimic examples given.

    So here is the code I have so far.

    SCAR Code:
    function getCorrectedCompassAngle(roadColor, tol : Integer) : Extended;
    var
       RoadCent : TDTMPointDef;
       RoadSub : Array[0..6] of TDTMPointDef;
       RoadDTMSkel : TDTM;
       RoadDTM : Integer;
       empty : Integer;
       angle : Extended;
    begin
       Result := 0;
       if (findVarrokEastBank) then   // Make sure we are near the bank.
       begin
          RoadCent.x := 619;
          RoadCent.y := 46;
          RoadCent.areasize := 0;
          RoadCent.areashape := 0;
          RoadCent.color := roadColor;
          RoadCent.tolerance := tol;

          RoadSub[0].x := 618;
          RoadSub[0].y := 62;
          RoadSub[0].areasize := 0;
          RoadSub[0].areashape := 0;
          RoadSub[0].color := roadColor;
          RoadSub[0].tolerance := tol;

          RoadSub[1].x := 623;
          RoadSub[1].y := 62;
          RoadSub[1].areasize := 0;
          RoadSub[1].areashape := 0;
          RoadSub[1].color := roadColor;
          RoadSub[1].tolerance := tol;

          RoadSub[2].x := 606;
          RoadSub[2].y := 47;
          RoadSub[2].areasize := 0;
          RoadSub[2].areashape := 0;
          RoadSub[2].color := roadColor;
          RoadSub[2].tolerance := tol;

          RoadSub[3].x := 607;
          RoadSub[3].y := 42;
          RoadSub[3].areasize := 0;
          RoadSub[3].areashape := 0;
          RoadSub[3].color := roadColor;
          RoadSub[3].tolerance := tol;

          RoadSub[4].x := 635;
          RoadSub[4].y := 44;
          RoadSub[4].areasize := 0;
          RoadSub[4].areashape := 0;
          RoadSub[4].color := roadColor;
          RoadSub[4].tolerance := tol;

          RoadSub[5].x := 634;
          RoadSub[5].y := 49;
          RoadSub[5].areasize := 0;
          RoadSub[5].areashape := 0;
          RoadSub[5].color := roadColor;
          RoadSub[5].tolerance := tol;
         
          RoadSub[6].x := 586;
          RoadSub[6].y := 21;
          RoadSub[6].areasize := 0;
          RoadSub[6].areashape := 0;
          RoadSub[6].color := roadColor;
          RoadSub[6].tolerance := tol;

          RoadDTMSkel.MainPoint := RoadCent;
          RoadDTMSkel.SubPoints := RoadSub;
          RoadDTM := AddDTM(RoadDTMSkel);

          if FindDtmRotated(RoadDTM, empty, empty, MMX1, MMY1, MMX2, MMY2, Radians(-30), Radians(30), 0.005, angle) then
          begin
             Result := angle;
          end else
             WriteLn ('didnt find DTM: ' + IntToStr(RoadDTM));
          FreeDTM(RoadDTM);
       end;
    end;

    This was called with getCorrectedCompassAngle(FindVarrockRoadColor, 20);

    attached is the reference image as well as the DTM that the DDTM was based off of. Any help would be appreciated.

    As you could probably tell, the ultimate goal is to try and get a correct compass angle from the startup. I have noticed that the compass can be off by up to 15 degees! (rough guesstimate) and I wanted to use this function to correct that, however, since it never returns true I don't know how I can correctly adjust.

    Again, any help would be appreciated, thanks!

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

    Default

    1DDTMS are already rotated for you, which means a simple Finddtm would work, which means, the angle where you find them would be always 0.

    If you want to use a FindDTMRotated, then make a DTM for it, instead of a DDTM.
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  3. #3
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Maybe use If DTMRotated, Finds it 30 degrees either side

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

    Default

    You could also just use MakeCompass(Direction:String) to get your compass to point a specific way.

    Nava2
    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

  5. #5
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    You could also just use MakeCompass(Direction:String) to get your compass to point a specific way.

    Nava2
    Unfortunatly, Make compass has two problems with it

    1. Changing the compass angle to exactly any angle each time the game starts is very detectable.

    2. It is based on the little compass in the corner, which can be quite far off from the real mini map angle (By as much as 15 degrees from what I have seen)

    I think I may have come up with a new method and I am giving that a shot. Wish me luck!

  6. #6
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by leelokhin View Post
    1DDTMS are already rotated for you, which means a simple Finddtm would work, which means, the angle where you find them would be always 0.

    If you want to use a FindDTMRotated, then make a DTM for it, instead of a DDTM.
    No I don't think thats right. You still need to use FindDTMRotated for DDTMs because they still rotate.

    Boberman- does the function display the debug text 'didn't find dtm' or doesn't it display anytyhing. If it does then its probably your DTM thats stuffed. If it doesn't it could be that your FindVarrockEastBank thing is broken.

  7. #7
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    as naumam said, just use DTMRotated instead of FindDTMRotated... I use it all the time and it has never gave me trouble
    METAL HEAD FOR LIFE!!!

  8. #8
    Join Date
    Dec 2007
    Location
    Somewhere in Idaho
    Posts
    480
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Im positive that FindVarrokEastBank works correctly (used in other places in the script with no problem) The DTM has to be blamed. Ultimately, I came up with a better method of getting what I want. (In the script demonstration/testing forum I gave it in the thread Real compass angles)

    Thanks for the help though.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. DTM Rotated
    By Mr_Bum in forum OSR Help
    Replies: 4
    Last Post: 12-10-2008, 07:02 AM
  2. DTM rotated?
    By TheChineseMan in forum OSR Help
    Replies: 2
    Last Post: 08-31-2008, 03:43 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
  •