Results 1 to 22 of 22

Thread: Player Owned Ports Navigation

  1. #1
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default Player Owned Ports Navigation

    Been working on a script and have this snippet. Feel free to improve etc. But it works for me




    Simba Code:
    (*
    Dockbutton
    ~~~~~~~~~~

    .. code-block:: pascal

        function Dockbutton(Button: Integer): Boolean;

    If the button is available to click, the function will click the button and return
    true or false.Passing 1-6 will use the ability in the coordinating area.

    .. note::

        by xtrapsp
        Last modified: March. 28th, 2013 by Xtrapsp

    Example:

    .. code-block:: pascal


        if Dockbutton(3) then
          WriteLn('Clicked the Dockbutton{3} which is shipyard');
    *)

    function Dockbutton(Button: Integer): Boolean;
    var
      X, Y: Integer;
    begin
      Result := False;
      case (Button) of
        1:
          begin
            Writeln('Clicking Voyages Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
        2:
          begin
            Writeln('Clicking Crew Roster Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
        3:
          begin
            Writeln('Clicking Shipyard Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
        4:
          begin
            Writeln('Clicking Upgrades Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
        5:
          begin
            Writeln('Clicking Port Management Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
        6:
          begin
            Writeln('Clicking Upgrades Button');
            HumanMMouse(207,73-50,4,4);
            Result := True;
            exit;
          end;
      end;
    end;
    Last edited by xtrapsp; 03-28-2013 at 11:51 AM.

  2. #2
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    what does it do?
    you title says player owned ports but I don't know what it does exact please tell us ali baba!

  3. #3
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Runehack123 View Post
    what does it do?
    you title says player owned ports but I don't know what it does exact please tell us ali baba!
    Simba Code:
    {  function Dockbutton(Button: Integer): Boolean;

    If the button is available to click, the function will click the button and return
    true or false.Passing 1-6 will use the ability in the coordinating area.}

  4. #4
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    I still don't understand hahahaha !!!!

    please explain more I don't understand your explanation

    e,g, youy say function will return true or false but when does it return true and when does it return false and what is this 1tosix abt!?

  5. #5
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Runehack123 View Post
    I still don't understand hahahaha !!!!

    please explain more I don't understand your explanation
    it clicks the buttons in the menu. I added a picture above

  6. #6
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    it clicks the buttons in the menu. I added a picture above
    oh thank so much
    that really helpd me understand

    why does it return true or fals and when does it dio> that??

  7. #7
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Runehack123 View Post
    oh thank so much
    that really helpd me understand

    why does it return true or fals and when does it dio> that??
    Well, if you want it to return true or false you can check if it has or has not clicked it. I don't know if it will fail or not so I'm pretty much writing it off the bat while learning the minigame

    Depends on how people want to expand on it really

  8. #8
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    right now it's not clicking any button thoguh because all is just moving mouse you should make it so it clicks mouse because you said it do in your descript I can change that for you and make it better?

  9. #9
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Yeah I believe you're missing a couple things here bud. From the looks of it this function will always move the mouse to coordinate (207,23) with 4 X/Y randomness. Also, it never actually clicks, just mouse movement.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  10. #10
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Yeah I believe you're missing a couple things here bud. From the looks of it this function will always move the mouse to coordinate (207,23) with 4 X/Y randomness. Also, it never actually clicks, just mouse movement.
    yes this like I already say only random mouse movement
    I can complete this if you want ClickMouse2(True);
    sec...
    Simba Code:
    (*
    Dockbutton
    ~~~~~~~~~~

    .. code-block:: pascal

        function Dockbutton(Button: Integer): Boolean;

    If the button is available to click, the function will click the button and return
    true or false.Passing 1-6 will use the ability in the coordinating area.

    .. note::

        by xtrapsp
        Last modified: March. 28th, 2013 by Xtrapsp

    Example:

    .. code-block:: pascal


        if Dockbutton(3) then
          WriteLn('Clicked the Dockbutton{3} which is shipyard');
    *)

    function Dockbutton(Button: Integer): Boolean;
    var
      X, Y: Integer;
    begin
      Result := False;
      case (Button) of
        1:
          begin
            Writeln('Clicking Voyages Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
        2:
          begin
            Writeln('Clicking Crew Roster Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
        3:
          begin
            Writeln('Clicking Shipyard Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
        4:
          begin
            Writeln('Clicking Upgrades Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
        5:
          begin
            Writeln('Clicking Port Management Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
        6:
          begin
            Writeln('Clicking Upgrades Button');
            HumanMMouse(207,73-50,4,4);
            ClickMouse2(True);
            Result := True;
            exit;
          end;
      end;
    end;
    [/QUOTE]
    THERE I FIX YOUR SNIPPET LIKE A DREAM BOSS IN YOUR BEST DREAM

  11. #11
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Yeah I believe you're missing a couple things here bud. From the looks of it this function will always move the mouse to coordinate (207,23) with 4 X/Y randomness. Also, it never actually clicks, just mouse movement.
    Think I should put a mouse box around the icons?

  12. #12
    Join Date
    Oct 2012
    Posts
    758
    Mentioned
    6 Post(s)
    Quoted
    282 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    Think I should put a mouse box around the icons?
    No I don't think it's needed 4,4 pixel change isnt much and still leaves you within the button so I dont think it's needed. But of course you can if you like it
    also homo sapiens player always clicks in middle of object so if you mousebox Iwouldnt do it around whole of the button otherwise it might look a little strange

  13. #13
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    How about this instead? (Keep in mind you'll want to adjust the X/Y coordinates)

    Simba Code:
    function Dockbutton(Button: Integer): Boolean;
    var
      bString: String;
      xCoord,yCoord: Integer;
    begin
      Result := InRange(Button, 1, 6);
      case (Button) of
        1:
          begin
            bString := 'Voyages';
            xCoord  := 207;
            yCoord  := 73;
          end;
        2:
          begin
            bString := 'Crew Roster';
            xCoord  := 207;
            yCoord  := 73;
          end;
        3:
          begin
            bString := 'Shipyard';
            xCoord  := 207;
            yCoord  := 73;
          end;
        4:
          begin
            bString := 'Upgrades';
            xCoord  := 207;
            yCoord  := 73;
          end;
        5:
          begin
            bString := 'Port Management';
            xCoord  := 207;
            yCoord  := 73;
          end;
        6:
          begin
            bString := 'Map';
            xCoord  := 207;
            yCoord  := 73;
          end;
      end;

      if Result then
      begin
        Writeln('Clicking '+bString+' Button');
        HumanMMouse(xCoord, yCoord-50, 4, 4);
        ClickMouse2(mouse_left);
      end;
    end;

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  14. #14
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    How about this instead? (Keep in mind you'll want to adjust the X/Y coordinates)

    Simba Code:
    function Dockbutton(Button: Integer): Boolean;
    var
      bString: String;
      xCoord,yCoord: Integer;
    begin
      Result := InRange(Button, 1, 6);
      case (Button) of
        1:
          begin
            bString := 'Voyages';
            xCoord  := 207;
            yCoord  := 73;
          end;
        2:
          begin
            bString := 'Crew Roster';
            xCoord  := 207;
            yCoord  := 73;
          end;
        3:
          begin
            bString := 'Shipyard';
            xCoord  := 207;
            yCoord  := 73;
          end;
        4:
          begin
            bString := 'Upgrades';
            xCoord  := 207;
            yCoord  := 73;
          end;
        5:
          begin
            bString := 'Port Management';
            xCoord  := 207;
            yCoord  := 73;
          end;
        6:
          begin
            bString := 'Map';
            xCoord  := 207;
            yCoord  := 73;
          end;
      end;

      if Result then
      begin
        Writeln('Clicking '+bString+' Button');
        HumanMMouse(xCoord, yCoord-50, 4, 4);
        ClickMouse2(mouse_left);
      end;
    end;
    Ahh, didn't think of formatting it like that, is there any difference in benefit for doing this way just out of curiosity. (Only because after reading it I can't see a reason as to why but it is easier to read and understand)

    Thanks

  15. #15
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    Ahh, didn't think of formatting it like that, is there any difference in benefit for doing this way just out of curiosity. (Only because after reading it I can't see a reason as to why but it is easier to read and understand)

    Thanks
    Ah nah mate, it's all just preference. I'm not sure if the block I posted above is less lines or not, it's just how I would go about doing that. In the end the same goal is accomplished, no?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  16. #16
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Ah nah mate, it's all just preference. I'm not sure if the block I posted above is less lines or not, it's just how I would go about doing that. In the end the same goal is accomplished, no?
    Yea ;P I think I like yours better haha. +REP

  17. #17
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Do you still need that SPS map?

  18. #18
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by RJJ95 View Post
    Do you still need that SPS map?
    if it's going, I'l use it for randoms.

    Thanks

  19. #19
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    if it's going, I'l use it for randoms.

    Thanks
    wait what if what is going?

  20. #20
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by RJJ95 View Post
    wait what if what is going?
    The chance of someone having time to make me the map ahaha

  21. #21
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    another way to do things..

    Simba Code:
    const
      DOCK_BUTTON_VOYAGES = 0;
      //etc...

    function clickDockButton(button: integer): boolean;
    var
      pnt: array [0..6] of TPoint;
    begin
      pnt := [point(207, 73), point(207, 73), point(207, 73), point(207, 73), point(207, 73), point(207, 73)];
      result := inRange(button, 0, 6);

      if (result) then
        mouse(pnts[button].x, pnt[button].y, 3, 3, MOUSE_LEFT)
      else
        writeln('Invaild button!');

    end;

    begin
      clickDockButton(DOCK_BUTTON_VOYAGES);
    end.

  22. #22
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Throw in some constants too, that helps

    Simba Code:
    procedure DockButton(Button: Integer);
    begin
      if (inRange(Button, 0, 5)) then
        Mouse(207 + (Button mod 3) * 53, 23 + (Button div 3) * 36, 15, 15, Mouse_Left);
    end;

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
  •