From: Hackingmyself
Yes about that, it was MIX1, MIY1, MIX2, MIY2 but that was causing errors, and this laptop is too slow to run the game, so until my processor for my desktop arrives that is just a placeholder.
While I was on my desktop I wrote something that clicked a factory opened it moved over to the right troops and set que.
program Factories;
{$Define Smart8}
Var
x, y:integer;
begin
MoveMouse(469, 434);
ClickMouse(470, 434, mouse_left);
Wait(900);
MoveMouse(251, 644);
ClickMouse(251, 644, mouse_left);
Wait(2500);
MoveMouse(900,344);
wait(600);
HoldMouse(900,344, mouse_left);
wait(600);
MoveMouse(251, 344);
wait(600);
ReleaseMouse(x, y, mouse_left);
wait(1500);
MoveMouse(900,344);
wait(600);
HoldMouse(900,344, mouse_left);
wait(600);
MoveMouse(251, 344);
wait(600);
ReleaseMouse(x, y, mouse_left);
wait(1000);
MoveMouse(586, 209);
ClickMouse(586, 209, mouse_left);
wait(500);
end
Can someone advise me, There will be up to 10 matching factories on the screen, I want to find the factory, then do similar to what I wrote (and tested working) above.
E:Yes I drag and target screen usually.
I doubt your laptop had rezolution over 2000…. so for testing reduce it. dtms should work, about finding other 9 factories: make array of tpoints out of dtm mahes. but since if you have any tolerance and other often dtm finds like 4 very similar dots like 127,250 and 128,249 so you need to filter it out. Because for example find dtms() gives you array of t points:[(125,250),(127,248),(240,35),(239,34)] they give like in this example 4 points to 2 places. I use this routine to filter it out:
program blalblalbl;
{$Define Smart8}
var
i:integer;
FactoryArray:array [0..9] of tpoint;
box: tbox; // used to check if it is already in the box if no then its other factor than the first //one because like said before finddtms gives few posibilities in 10 factories it will give like 40 //points so need to filter it out.
procedure FindFactories();
var
i,z: integer;
p: tpointarray;
begin
if FindDtms(factoryDTM,p,inttobox(0,0,1250,650)) then
begin
for i:=0 to length(p)-1 do //-1 because arrays counts from 0 being first member
begin
box:=[p[i].x-50,p[i].y-50,p[i].x+50,p[i].y+50]; //this would make area for each //factory at 100 by 100 pixels.
for z:=0 to length(factryarray)-1 do
begin
if not pointinbox(p[i],factoryarray[z]) then // checks if point is already used as //factory point
begin// actually alittle flaw here, gona give you better code as i work on similar game too wtih dtms arrays when ill be back from work.
factoryarray[z]:=p[i];
break; // necessary to stop it writing the same coordinates to whole array.
end;
end;
end;
end;
end;
procedure mousemovements();//your mouse events
var
x,y: integer;
begin
MoveMouse(469, 434);
ClickMouse(470, 434, mouse_left);
Wait(900);
MoveMouse(251, 644);
ClickMouse(251, 644, mouse_left);
Wait(2500);
MoveMouse(900,344);
wait(600);
HoldMouse(900,344, mouse_left);
wait(600);
MoveMouse(251, 344);
wait(600);
ReleaseMouse(x, y, mouse_left);
wait(1500);
MoveMouse(900,344);
wait(600);
HoldMouse(900,344, mouse_left);
wait(600);
MoveMouse(251, 344);
wait(600);
ReleaseMouse(x, y, mouse_left);
wait(1000);
MoveMouse(586, 209);
ClickMouse(586, 209, mouse_left);
wait(500);
end;
for i:=0 to 9 do
begin
if not factoryarray.x=0 then mousemovements();
end;
end;