Results 1 to 14 of 14

Thread: Changing Camera Angle LEFT / RIGHT Help :S

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Changing Camera Angle LEFT / RIGHT Help :S

    so yeah, im trying to write a function that if the monster isnt found, it will press the left or right button for 3 seconds to surch for monsters but i keep getting an error :S (i put the error at the line it comes in on the script)

    SCAR Code:
    procedure FindMonster;
    var
      t : Integer;
    begin
      if not Attack then
      begin
        t := GetSystemTime;
        case Random(2) of
        0: begin
             KeyDown(VK_RIGHT);
             while GetSystemTime - t < 3000 do
                 KeyDown(VK_RIGHT);
             end;
           end;
        1: begin // Line 274: [Error] (17292:1): Identifier expected in script
             while GetSystemTime - t < 3000 do
                 KeyDown(VK_RIGHT);
             end;
           end;
        end;
      end;
    end;
    Lance. Da. Pants.

  2. #2
    Join Date
    Jan 2008
    Location
    Alberta
    Posts
    727
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    On the while do's you do not have begins, yet you have end;'s.

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

    Default

    You have an extra end.

    Edit: Ninja'd.

    Oh well here you go
    SCAR Code:
    procedure FindMonster;
    begin
      if not Attack then
      begin
        case Random(2) of
          0: begin
               KeyDown(VK_RIGHT);
               Wait(2700 + random(1000));
               KeyUp(VK_RIGHT);
             end;
          1: begin
               KeyDown(VK_LEFT);
               Wait(2700 + random(1000));
               KeyUp(VK_LEFT);
             end;
          end;
      end;
    end;
    Last edited by Da 0wner; 06-04-2009 at 09:25 AM.

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Iron Man View Post
    On the while do's you do not have begins, yet you have end;'s.
    Quote Originally Posted by Da 0wner View Post
    You have an extra end.
    I'm glad we made iron mans post a little more clear...
    “Ignorance, the root and the stem of every evil.”

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

    Default

    A piece of advice, use make compass, it will probably help you out more. You can use integers Just think how you could use that
    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

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

    Default

    MakeCompass uses angle so you can make it whatever angle you want .
    SCAR Code:
    MakeCompass(Random(361));
    XD

  7. #7
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes i was origionaly useing MakeCompass(); but the problem is i want to be able to do a full 180 turn around.. and i wasnt able to find any function that gets the current Compass degrees.. so if i just do something like MakeCompass(Random(360)); then it could move just a tiney little bit and not realy change the screen or it could do almost a full loop and change the screen to much :P

    so then i considered just holding down the keys for a period of time.

    btw just to make this clear:
    SCAR Code:
    while blah do
      blah
      blah
    end;
    is WRONG

    and

    SCAR Code:
    while blah do
    begin
      blah
      blah
    end;
    is RIGHT?

    lol cause i thought you didnt need that begin and the while itself would act like a begin... well guess you learn something new every day xP
    Lance. Da. Pants.

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

    Default

    SCAR Code:
    function rs_GetCompassAngleDegrees : Extended;
    function rs_GetCompassAngleRadians : Extended;

    And yea you need an extra begin, it is not like a case.

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

    Default

    You can always go to a degree then go to another then you will turn 180 degrees
    ~Hermen

  10. #10
    Join Date
    Nov 2008
    Location
    Melbourne, Australia
    Posts
    2,240
    Mentioned
    3 Post(s)
    Quoted
    11 Post(s)

    Default

    You would want to use

    SCAR Code:
    rs_GetCompassAngleDegrees;

    As it returns it in degrees, Declare something like "I" as an integer then make it

    SCAR Code:
    I:=rs_GetCompassAngleDegrees;
    MakeCompass(I+random(360));

    Or what ever you want to set the randomness to.
    What you have there currently works, but yes When you use a While statement, you must put a begin on the next line or else it won't work
    Click here to find out how to get full screen without members! | Click here to check out my Ultimate Bitmap Tutorial! Edited to work with Simba! |

  11. #11
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh thanks so much guys thats very helpful
    Lance. Da. Pants.

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

    Default

    it will work Mark. Only if you do not have an end. And I have already said that...

  13. #13
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    This bit is from Nautilus. It looks for the dots on screen and finds the closest one to u and moves the camera to it. There is a couple booleans that are in script and not explained in it. Its a bit more complex but its way faster then randomly searching.

    SCAR Code:
    function MobTPAs: TPointArray;
    var
      TPA: TPointArray;
    begin
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, 195836, MMCX - 35, MMCY - 35, MMCX + 35, MMCY + 35, 0);
      if Length(TPA) < 1 then
        Exit;
      RAaSTPA(TPA, 4);
      SortTPAFrom(TPA, IntToPoint(MMCX, MMCY));
      result := TPA;
    end;

    function MobsOnScreen: integer;
    var
      i: integer;
      mTPA: TPointArray;
    begin
      mTPA := MobTPAs;
      for i := 0 to High(mTPA) do
        if InAbstractBox(590, 63, 656, 63, 646, 100, 600, 100, mTPA[i].x, mTPA[i].y) then
          result := result + 1;
    end;

    function MobFinder: boolean;
    var
      mTPA: TPointArray;
      mAng: Integer;
    begin
      mTPA := MobTPAs;
      if Length(mTPA) < 1 then
      begin
        result := false;
        Exit;
      end;
      if (Distance(mTPA[0].x, mTPA[0].y, MMCX, MMCY) > 17) then
      begin
        if ClickToMobMM then
        begin
          Mouse(mTPA[0].x - 2, mTPA[0].y - 2, 5, 5, true);
          FFlag(1);
        end
        else
        begin
          result := false;
          exit;
        end;
      end
      else
      begin//Calculates the angle to the NPC - important bit
        mAng := Round(Degrees(ArcTan2(mTPA[0].Y - MMCY, mTPA[0].X - MMCX)) + 90 + rs_GetCompassAngleDegrees);
        if (mAng < 0) then
          mAng := mAng + 360;
        if (mAng > 360) then
          mAng := mAng - 360;
        mAng := RandomRange(mAng - 20, mAng + 20);
        MakeCompass(inttostr(mAng));
      end;
      if (MobsOnScreen > 0) then
        result := true;
    end;
    Last edited by Narcle; 06-04-2009 at 04:06 PM.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  14. #14
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    wow thanks narcle, your the king of autofighters haha
    Lance. Da. Pants.

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
  •