Results 1 to 18 of 18

Thread: Aim Compass

  1. #1
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default Aim Compass

    It would aim the compass to given coords in minimap


    These are from Ultra cut n bank:
    Code:
    {*******************************************************************************
    function CoordsToDegrees(x, y: integer): integer;
    By: PriSoner
    Description: Returns the direction in degrees (0 to 359) to a set of coordinates
                 relative to your players position on the screen and North.
                 (degrees are in reverse to the convention to stay compatible with
                  MakeCompass etc i.e. 0 = N, 90 = W, 180 = S & 270 = E)
    *******************************************************************************}
    function CoordsToDegrees(x, y: integer): integer;
    var d: double;
    begin
        x := x - 260;
        y := y - 160;
        d := ArcTan2(y, x) * (180 div Pi) + 90;
        if d < 0 then d := d + 360;
        result := round(abs(d - 360) + rs_GetCompassAngleDegrees);
        if result >= 360 then result := result - 360;
    end;

    Code:
    procedure MakeCompassCoords(x, y: integer);
    By: PriSoner
    Description: Moves Compass so that target x & y coordinates are directly north
                 of your player.
    *******************************************************************************}
    procedure MakeCompassCoords(x, y: integer);
    begin
       MakeCompass(IntToStr(CoordsToDegrees(x, y)));
    end;
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  2. #2
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    So you posted someone elses code for no reason it seems?

  3. #3
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    var d: double;
    begin
        x := x - 260;
        y := y - 160;
        d := ArcTan2(y, x) * (180 div Pi) + 90;
        if d < 0 then d := d + 360;
        result := round(abs(d - 360) + rs_GetCompassAngleDegrees);
        if result >= 360 then result := result - 360;
    end;
    Shortened to:
    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    Begin
      If Not rs_OnMinimap(X, Y) Then
        Exit;
      Result := (Round(Degrees(ArcTan2(Y - MMCY, X - MMCX))) + 90) - Round(rs_GetCompassAngleDegrees);
      If (Result < 0) Then
        Result := Result + 360;
    End;


  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    How do you know the "angle" of the coords?
    Do you guys take the middle and then go through the point outside?
    ~Hermen

  5. #5
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    How do you know the "angle" of the coords?
    Do you guys take the middle and then go through the point outside?
    The ArcTan2 function gets the angle...
    lol

  6. #6
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    So you posted someone elses code for no reason it seems?
    Just to show you how PriSoner did it... Is there something wrong with it?
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

  7. #7
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    var d: double;
    begin
        x := x - 260;
        y := y - 160;
        d := ArcTan2(y, x) * (180 div Pi) + 90;
        if d < 0 then d := d + 360;
        result := round(abs(d - 360) + rs_GetCompassAngleDegrees);
        if result >= 360 then result := result - 360;
    end;
    Shortened to:
    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    Begin
      If Not rs_OnMinimap(X, Y) Then
        Exit;
      Result := (Round(Degrees(ArcTan2(Y - MMCY, X - MMCX))) + 90) - Round(rs_GetCompassAngleDegrees);
      If (Result < 0) Then
        Result := Result + 360;
    End;
    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    begin
      if(not(rs_OnMinimap(X, Y))) then
        Exit;
      Result := (FixD(Round(Degrees(ArcTan2(Y - MMCY, X - MMCX))) + 90) - Round(rs_GetCompassAngleDegrees));
    end;

    Shortened even more

    Sorry, but i haven't done that before and felt like doing it xD
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  8. #8
    Join Date
    Jul 2008
    Location
    England
    Posts
    763
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function MakeCompassCoords(x, y: integer): Boolean;
    begin
       Result := MakeCompass(IntToStr(CoordsToDegrees(x, y)));
    end;

    Made it return a Boolean.
    lol

  9. #9
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by antti mies View Post
    Just to show you how PriSoner did it... Is there something wrong with it?
    You posted a new topic showing off someones code that no one requested? Seems like something is wrong to me...

  10. #10
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    You posted a new topic showing off someones code that no one requested? Seems like something is wrong to me...
    Hmm, well i don't think that there is nothing wrong with that Because i think it is good if someone pops some good code up

    Even if it is not own code


    ~Home

  11. #11
    Join Date
    Mar 2007
    Location
    Alberta, Canada
    Posts
    1,780
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    You posted a new topic showing off someones code that no one requested? Seems like something is wrong to me...
    Sure, he might not get all the credit if this is used somehow, but there's nothing wrong with it I don't think.

  12. #12
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    scar Code:
    function CoordsToDegrees(x, y: integer): integer;
    begin
      if(not(rs_OnMinimap(X, Y))) then
        Exit;
      Result := (FixD(Round(Degrees(ArcTan2(Y - MMCY, X - MMCX))) + 90) - Round(rs_GetCompassAngleDegrees));
    end;

    Shortened even more

    Sorry, but i haven't done that before and felt like doing it xD
    What's with the whole shortening atm lol. It only makes it less readable for me
    Ce ne sont que des gueux


  13. #13
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Hmm, well i don't think that there is nothing wrong with that Because i think it is good if someone pops some good code up

    Even if it is not own code


    ~Home
    Lulz, double negative.

  14. #14
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Lulz, double negative.
    I don't understand what you mean

  15. #15
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Don't + nothing = a positive.

  16. #16
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    What's with the whole shortening atm lol. It only makes it less readable for me
    I don't know, everyone else was doin' it so i joined in too
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  17. #17
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Lulz, double negative.
    Don't make fun of someones grammar.
    Where he lacks in english he makes up in niceness, you on the other hand...
    Can't say it here, as I get infracted

    My point: Stop being childish..

  18. #18
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by N1ke! View Post
    Don't make fun of someones grammar.
    Where he lacks in english he makes up in niceness, you on the other hand...
    Can't say it here, as I get infracted

    My point: Stop being childish..
    Hes a

    ~Myles

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
  •