Results 1 to 4 of 4

Thread: N1ke!'s Function corner!

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

    N1ke!'s Functions!

    Welcome to N1ke!'s Function corner!
    Here i will post all my functions useless or not they all be here!.

    SafeRadial

    SCAR Code:
    {*************************************************************************************************
    Function SafeRadial(Color: Integer; MaxStartRadial, MaxEndRadial: Integer; Radius: Integer): Boolean;
    By: N1ke!
    Description: Starts searching between MaxStartRadial & MaxEndRadial then
    adds a 5 every time it fails until its more then MaxStartRadial & MaxEndRadial.
    *************************************************************************************************}

    Function SafeRadial(Color: Integer; MaxStartRadial, MaxEndRadial: Integer; Radius: Integer): Boolean;
    Var
      MSR, MER: Integer;
    begin
      If(Not(LoggedIn))Then Exit;
      MSR := MaxStartRadial + MaxEndRadial / 2;
      MER := MSR - 1;
      Repeat
       If RadialWalk(Color, MSR, MER, Radius, 0, 0)then Result := True;
        If Result = True then
        Begin
          Writeln('Found Color with :');
          Writeln('StartRadial = ' + IntToStr(MSR));
          Writeln('EndRadial = ' + IntToStr(MER));
          Exit;
        end;
       MSR := MSR - 5;
       MER := MER + 5;
      Until(MSR < MaxStartRadial)or(MER > MaxEndRadial);
     Writeln('SafeRadial failed!');
     Result := false;
    End;

    Can be used like this
    SCAR Code:
    SafeRadial(FindRoadColor, 90, 270, 60)

    __________________________________________________ __________________________________________________ __________________________________________________ _
    GetAngle

    SCAR Code:
    {*************************************************************************************************
    Function GetAngle(GetAngleFrom : Boolean): Integer;
    By: N1ke!
    Description: Gets the minimap angle. True = Clockwise , False = Not Clockwise
    *************************************************************************************************}

    Function GetAngle(GetAngleFrom : boolean): Integer;
    Var Angle : extended;
    Begin
      If(Not(LoggedIn))Then Exit;
       Angle := (rs_GetCompassAngleDegrees);
        If GetAngleFrom = True then Angle := 360 - Angle;
         Result := Round(Angle);
    End;
    Can be used like this
    SCAR Code:
    GetAngle(True)
    __________________________________________________ __________________________________________________ __________________________________________________ _

    SafeAngleRadial

    Needs GetAngle!
    SCAR Code:
    {*************************************************************************************************
    Function SafeAngleRadial(Color: Integer; MaxStartRadial, MaxEndRadial: Integer; Radius: Integer): Boolean;
    By: N1ke!
    Description: Starts searching between MaxStartRadial & MaxEndRadial then
    adds a 5 every time it fails until its more then MaxStartRadial & MaxEndRadial.
    Will work if your minimap is South, west, east etc..
    *************************************************************************************************}

    Function SafeAngleRadial(Color: Integer; MaxStartRadial, MaxEndRadial: Integer; Radius: Integer): Boolean;
    Var
      MSR, MER, Angle: Integer;
    begin
      If(Not(LoggedIn))Then Exit;
       Angle := GetAngle(True);
       MSR := MaxStartRadial + MaxEndRadial / 2 - Angle;
       MER := MSR - 1 - Angle;
       If MSR < 0 then
       begin
         MSR := MSR + 360;
         MER := MER + 360;
       end;
       If MSR > 360 then
       begin
         MaxStartRadial := MaxStartRadial + 360;
         MaxEndRadial := MaxEndRadial + 360;
       End;
       Repeat
        If RadialWalk(Color, MSR, MER, Radius, 0, 0)then Result := True;
         If Result = True then
         Begin
           Writeln('Found Color with :');
           Writeln('StartRadial = ' + IntToStr(MSR));
           Writeln('EndRadial = ' + IntToStr(MER));
           Writeln('Angle = ' + IntToStr(Angle));
           Exit;
         end;
        MSR := MSR - 5;
        MER := MER + 5;
       Until(MSR < MaxStartRadial)or(MER > MaxEndRadial);
      Writeln('SafeRadial failed!');
      Result := False;
    End;

    How to use SafeAngleRadial
    Lets say you made a walking script, Edgeville to fallador.
    When using Radialwalk your minimap needs to be North most of the time. With SafeAngleRadial you can walk without even care if the minimap is east or west etc.. Let me show you!

    SCAR Code:
    If SafeAngleRadial(RoadColor, 20, 90, 60) then Blabla
    I made that when my minimap was set to North.
    Then my minimap goes east for some reason.
    SafeAngleRadial will still walk to the right location!.





    More to come!

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

    Default

    Reserved.

  3. #3
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice function, really creative. Keep them coming!

    (By the way, you should just edit more functions into first post of this thread instead of reserving posts.)

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

    Default

    2 new function added!

    GetAngle & SafeAngleRadial

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Script clicking in top right corner
    By rwj4real in forum OSR Help
    Replies: 4
    Last Post: 02-15-2009, 05:00 AM
  2. Mouse sticks to top right corner...
    By royboyjoytoy2 in forum OSR Help
    Replies: 13
    Last Post: 10-25-2008, 03:39 PM
  3. ~Scripts Corner~
    By P1nky in forum Misc. Links and Programs
    Replies: 18
    Last Post: 01-23-2008, 04:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •