Results 1 to 13 of 13

Thread: Makecompassreflection

  1. #1
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Makecompassreflection

    SCAR Code:
    Function Makecompassreflection(Direction:string;Accuracy:integer): Boolean;
    {*******************************************************************
    Function Makecompassreflection(Direction:string;Accuracy:integer): Boolean;
    By: Waddo
    Description: Rotates the camera using reflection
    ********************************************************************}

    var
      clientAngle,DirDeg,mark: integer;
      left:boolean;
    begin
      case LowerCase(Direction) of
          'n': DirDeg := 0;
          'w': DirDeg := 90;
          's': DirDeg := 180;
          'e': DirDeg := 270;
      end else
      DirDeg := StrToInt(Direction);
      ClientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
      ClientAngle:=ClientAngle * 180 / 1024;
      if ClientAngle=dirdeg then exit;
        if (ClientAngle-DirDeg)>180 then
        begin
          left:=false;
          keydown(vk_right);
        end else
        begin
          left:=true;
          keydown(vk_left);
        end;
      wait(1);
      MarkTime(Mark);
      repeat
        clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
        clientangle:=clientAngle * 180 / 1024;
        If left then
          if clientangle>DirDeg then break;
        if not left then
          if clientangle<DirDeg then break;
        If clientangle=dirDeg then break;
        Wait(1);
      until (TimeFromMark(Mark) > 14000) or ( ((clientangle>dirDeg-Accuracy) or (clientangle>dirDeg-Accuracy+360)) and (clientangle<dirDeg+Accuracy));
      if left then
        Keyup(vk_left)
      else
      keyup(vk_right);
      if clientangle<>dirdeg then
      Makecompassreflection(direction,0);
      result:=clientangle=dirDeg;
    end;
    Blank!

  2. #2
    Join Date
    Jun 2007
    Location
    south park
    Posts
    1,160
    Mentioned
    0 Post(s)
    Quoted
    62 Post(s)

    Default

    waddo do u ever stop lol!
    http://www.youtube.com/user/YoHoJoSRL
    Good scripting guides on youtube
    Formerly known as (djcheater)

  3. #3
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    LOL yea. You have been here half the time I have. Produced more scripts, more function/procedure then I will ever, and your an SRL member lol. This reflection stuff is amazing!

    noidea
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  4. #4
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you.
    I find scripting addicting =]
    Blank!

  5. #5
    Join Date
    May 2008
    Posts
    266
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Line 16: [Error] (16:5): Identifier expected in script C:\Program Files\SCAR 3.15\includes\SRL\SRL\Misc\Reflection.Scar


    how do i fix

  6. #6
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you have to have the reflection include it is posted around a bit copy and paste it and save in includs ans reflection.scar
    Blank!

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

    Default

    SCAR Code:
    function PerfectCompass(Direction: string): Boolean;
    {*******************************************************************
    function PerfectCompass(Direction: string): Boolean;
    By: SRL and jukka
    Description: Perfect compass using SMART and reflection
    ********************************************************************}

    var
      StartAngle, Angle, DirectionDeg, i: Extended;
      Left: Boolean;
      Mark: Integer;
    begin
      Result := False;
      StartAngle := (GetMinimapAngleDeg);
      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;
        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:= GetMinimapAngleDeg;
        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;

    this one is better

    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!

  8. #8
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok. . .Ok i know i cant impress any of you, you should be happy that i atleast try XD
    Blank!

  9. #9
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Waddo View Post
    SCAR Code:
    Function Makecompassreflection(Direction:string;Accuracy:integer): Boolean;
    {*******************************************************************
    Function Makecompassreflection(Direction:string;Accuracy:integer): Boolean;
    By: Waddo
    Description: Rotates the camera using reflection
    ********************************************************************}

    var
      clientAngle,DirDeg,mark: integer;
      left:boolean;
    begin
      case LowerCase(Direction) of
          'n': DirDeg := 0;
          'w': DirDeg := 90;
          's': DirDeg := 180;
          'e': DirDeg := 270;
      end else
      DirDeg := StrToInt(Direction);
      ClientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
      ClientAngle:=ClientAngle * 180 / 1024;
      if ClientAngle=dirdeg then exit;
        if (ClientAngle-DirDeg)>180 then
        begin
          left:=false;
          keydown(vk_right);
        end else
        begin
          left:=true;
          keydown(vk_left);
        end;
      wait(1);
      MarkTime(Mark);
      repeat
        clientAngle:= (SmartGetFieldInt(0,CompassAngle) + SmartGetFieldInt(0,MapOffsetAngle)) mod 2048;
        clientangle:=clientAngle * 180 / 1024;
        If left then
          if clientangle>DirDeg then break;
        if not left then
          if clientangle<DirDeg then break;
        If clientangle=dirDeg then break;
        Wait(1);
      until (TimeFromMark(Mark) > 14000) or ( ((clientangle>dirDeg-Accuracy) or (clientangle>dirDeg-Accuracy+360)) and (clientangle<dirDeg+Accuracy));
      if left then
        Keyup(vk_left)
      else
      keyup(vk_right);
      if clientangle<>dirdeg then
      Makecompassreflection(direction,0);
      result:=clientangle=dirDeg;
    end;
    If accuracy was set to perfect, and north, it would be a never ending loop, the correct for north is -1...

    How do I know? I made one!

  10. #10
    Join Date
    Mar 2007
    Posts
    57
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    so why was KYAB shot down so much?

  11. #11
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Timer its how i have made it the accuracy is how close to the 90 degrees you put 6 and it gets with in 6 degrees then it auto fixes overshot
    Blank!

  12. #12
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Meh, ok... Sorry though, its not going in reflection.scar...
    I made one like jukkas last night... SRLs edited for reflection...

    sorry.

  13. #13
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Np im making something better =] im just not very good at it =p
    Blank!

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
  •