PDA

View Full Version : Player Owned Ports Navigation



xtrapsp
03-28-2013, 11:47 AM
Been working on a script and have this snippet. Feel free to improve etc. But it works for me


http://img197.imageshack.us/img197/2895/63b35765461c4dffb87dc27.png


(*
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;

Runehack123
03-28-2013, 11:49 AM
what does it do? :)
you title says player owned ports but I don't know what it does exact please tell us ali baba!

xtrapsp
03-28-2013, 11:50 AM
what does it do? :)
you title says player owned ports but I don't know what it does exact please tell us ali baba!

{ 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.}

Runehack123
03-28-2013, 11:51 AM
I still don't understand hahahaha :o !!!!

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!?

xtrapsp
03-28-2013, 11:53 AM
I still don't understand hahahaha :o !!!!

please explain more I don't understand your explanation

it clicks the buttons in the menu. I added a picture above

Runehack123
03-28-2013, 11:54 AM
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??

xtrapsp
03-28-2013, 11:55 AM
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

Runehack123
03-28-2013, 12:02 PM
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? :)

Flight
03-28-2013, 12:47 PM
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.

Runehack123
03-28-2013, 12:52 PM
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...

(*
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

xtrapsp
03-28-2013, 01:00 PM
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?

Runehack123
03-28-2013, 01:02 PM
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

Flight
03-28-2013, 01:03 PM
How about this instead? (Keep in mind you'll want to adjust the X/Y coordinates)


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;

xtrapsp
03-28-2013, 01:07 PM
How about this instead? (Keep in mind you'll want to adjust the X/Y coordinates)


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 :)

Flight
03-28-2013, 01:10 PM
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?

xtrapsp
03-28-2013, 01:21 PM
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

rj
03-28-2013, 10:35 PM
Do you still need that SPS map?

xtrapsp
03-29-2013, 12:13 AM
Do you still need that SPS map?

if it's going, I'l use it for randoms.

Thanks

rj
03-29-2013, 12:15 AM
if it's going, I'l use it for randoms.

Thanks

wait what if what is going?

xtrapsp
03-29-2013, 05:15 PM
wait what if what is going?

The chance of someone having time to make me the map ahaha

Olly
03-29-2013, 07:08 PM
another way to do things..

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.

Le Jingle
03-29-2013, 08:18 PM
:) Throw in some constants too, that helps ;)


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;