Results 1 to 15 of 15

Thread: MakeCompassEx

  1. #1
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default MakeCompassEx

    I dont know if has been made, but here it is. Just has Nw, Se,Ne and so on degrees added to the normal MakeCompass.

    SCAR Code:
    function MakeCompassEx(Direction: string): Boolean;
    var
      StartAngle, Angle, DirectionDeg, i: Extended;
      Left: Boolean;
      Mark, DirectionDegBH: Integer;
    begin
      Result := False;
      StartAngle := (rs_GetCompassAngleDegrees);
      if (StartAngle < 0) or (not LoggedIn) then Exit;
      try
        DirectionDeg := FixD(StrToFloat(Direction));
      except
        case LowerCase(Direction) of
          'n': DirectionDeg := 0;
          'w': DirectionDeg := 90;
          's': DirectionDeg := 180;
          'e': DirectionDeg := 270;
          'nw': DirectionDeg := 30;
          'ne': DirectionDeg := 330;
          'sw': DirectionDeg := 135;
          'se': DirectionDeg := 225;
        end;
      end;
      if (MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0 then
      begin
        Result := True;
        Exit;
      end;
      Left := (Round((360 - StartAngle) + DirectionDeg) mod 360 > Round((StartAngle + 360) - DirectionDeg) mod 360);
      if Left then
        KeyDown(VK_LEFT)
      else
        KeyDown(VK_RIGHT);
      Wait(10);
      MarkTime(Mark);
      repeat
        Wait(1);
        Angle := rs_GetCompassAngleDegrees;
        if ((TimeFromMark(Mark) > 6000) and (i < 1.0)) or
          ((TimeFromMark(Mark) > 10000) and (i < 2.0)) or
          ((TimeFromMark(Mark) > 14000) and (i < 3.0)) then
        begin
          i := i + 1.0;
        end;
      until ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i))
        or (TimeFromMark(Mark) > 14000)
        or (Angle < 0);
      if Left then
        KeyUp(VK_Left)
      else
        KeyUp(VK_Right);
      Wait(10);
      Result := ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i));
    end;

  2. #2
    Join Date
    Jun 2007
    Location
    Ohio
    Posts
    341
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It looks good. I don't really know why u would use anything other than the cardinal directions unless your like radial walking and want the thing between north and east.

    but i might use it for kicks and giggles

  3. #3
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    why not just enter

    MakeCompass('45');

    etc?

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  4. #4
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    BH, North is 0, West is 270, South is 180, and East is 90.

    NorthEast = 45
    NorthWest = 315
    SouthWest = 225
    SouthEast = 135

  5. #5
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    BH, North is 0, West is 270, South is 180, and East is 90.

    NorthEast = 45
    NorthWest = 315
    SouthWest = 225
    SouthEast = 135
    Under normal circumstances that would be true however MakeCompass and rs_GetCompassAngleDegrees do not follow the conventional clockwise but works in the reverse... Confused me no end when I was writing my compass functions!!

    BobboHobbo is still wrong though with ne & nw. Just a minor error.

    The Relavent section should be:

    SCAR Code:
    'n': DirectionDeg := 0;
          'w': DirectionDeg := 90;
          's': DirectionDeg := 180;
          'e': DirectionDeg := 270;
          'nw': DirectionDeg := 45;
          'ne': DirectionDeg := 315;
          'sw': DirectionDeg := 135;
          'se': DirectionDeg := 225;

    Personally i think just using degrees gives you much more flexibility, however given that they are in reverse this would avoid confusion for many.
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  6. #6
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Compasses are different than math circles..

    They turn to the other side ^^

    Compass:



    Unit circle:

    Verrekte Koekwous

  7. #7
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Also, if we are dealing with a 0..360 circle, you can't just say that for example NW is 45, because it doesn't matter in which direction you go, NW is always 315. AFAIK?


    SCAR Code:
    program New;
    begin
      Writeln(FloatToStr(Degrees(ArcTan2(-1 , 1))));
    end.

    There. -45, not 45.

    So, if you calculate the point on the arc using Sin and Cos, it's the same wether you use -45 or 315, but not 45.

  8. #8
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mastaraymond View Post
    Compasses are different than math circles..

    They turn to the other side ^^
    Yes i know.. my point was that we are dealing with Compass functions and not maths circles.. therefore you would expect inputting degrees into a Compass function to conform to Compass specifications and not Maths Circles..

    Anyway the current Compass fuctions don't even conform the the Maths circle standard as they have been rotated by counter-clockwise by 90 degrees to make 0 degrees North ...

    It confused me greatly, because when I wrote my function I went to the trouble of making the degrees coresspond to the Compass standard only to find out that none of the other compass functions in SRL were compatible..
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  9. #9
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    I don't understand what you're saying... Look, if Rs_GetCompassAngleDegrees returns 270, and you make the compass 180, you made it point South.

  10. #10
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats why we need some conversion to use ArcTan, sin and cos on Compass functions..
    Verrekte Koekwous

  11. #11
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    LOL, I tried and tried to change the compass numbers. Every time I would make them conform to an actual compass and then adjust all the relevant functions to work with it, someone would screw something up and then change it back. Oh well.

    SRL's compass output has always been "degrees compass is rotated to the right" or some weird definition.

    So when you're facing west, the compass is rotated 90 degrees to the right. When facing east, the compass is rotated 270 degrees to the right. Etc.


  12. #12
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    I don't understand what you're saying... Look, if Rs_GetCompassAngleDegrees returns 270, and you make the compass 180, you made it point South.
    yes making compass 180 makes it point south which is correct regardless.

    but if you MakeCompass('90'); it points West instead of East.

    and if as you say you use rs_GetCompassAngleDegrees and it returns 270 you are actually pointing East wheras on a Compass 270 degree would mean you were pointing West..
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  13. #13
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by PriSoner View Post
    yes making compass 180 makes it point south which is correct regardless.

    but if you MakeCompass('90'); it points West instead of East.

    and if as you say you use rs_GetCompassAngleDegrees and it returns 270 you are actually pointing East wheras on a Compass 270 degree would mean you were pointing West..
    Then you dont know howto read the compass.. (I guess....).

    Look at this images, should explain all. The red line on the MM Compass is the north..



    Basicly, its the "inner" circle that turns around, while the "outside" of the circle (the one with the degrees) stands at an set position..
    Verrekte Koekwous

  14. #14
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    The compass pointer can't point West. It can only point North. That's what a compass does. So in your example, the point of the compass is pointing North (LEFT), and the player is facing East (UP). Since you're facing East, and since East is at 90 degrees on your standard reference compass, why should the angle function return anything but 90?

    It comes down to whether you want to the angle function to tell you which angle you're facing, or which angle the compass pointer is pointing. RS used to have NESW letters on the compass without any pointer. Would the current angle system make any sense at all if the pointer went away?

    No, it wouldn't because the current system is backwards.


  15. #15
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    at the end of the day this is all irrelevant, it's wrong but it's so engrained it realistically couldn't be fixed without screwing up a lot of scripts..

    the only time it should/could be fixed is with SRL5
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


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
  •