Jump to content
Angelo

Dofus bot

Recommended Posts

Hi, janilabo make this script for dofus bot to gather resources, its working but there is just a problem, the old version of dofus required 2 clicks, one to "select" the resource and one to give the order for "recollect", the new version just needs a simple click to gather the resources but i can't modify the code because i don't understand the code, someone can help?

 

code:

---------------------------------------------------------------------------------------------------------------------------------------------------

 

const

Resource1 = 0; // Color de tu Recurso - Pega el color del recurso Nº1

Resource2 = 0; // Color de tu Recurso - Pega el color del recurso Nº2

Resource3 = 0; // Color de tu Recurso - Pega el color del recurso Nº3

CollectTime = 0; // Tiempo en recolectar - Tiempo de recoleccion (11000 = 11 Segundos)

 

var

x, y, lvlx, lvly: Integer;

 

function TargetResource1: Boolean;

begin

Result := FindColor(x, y, Resource1, 0, 0, 800, 600);

end;

 

function TargetResource2: Boolean;

begin

Result := FindColor(x, y, Resource1, 0, 0, 800, 600);

end;

 

function TargetResource3: Boolean;

begin

Result := FindColor(x, y, Resource3, 0, 0, 800, 600);

end;

 

function NextResource1: Boolean;

begin

Result := FindColor(x, y, Resource1, 0, 0, 800, 600);

end;

 

function NextResource2: Boolean;

begin

Result := FindColor(x, y, Resource2, 0, 0, 800, 600);

end;

 

function NextResource3: Boolean;

begin

Result := FindColor(x, y, Resource3, 0, 0, 800, 600);

end;

 

procedure Collect;

begin

if (TargetResource1 or TargetResource2 or TargetResource3) then

begin

MoveMouse(x, y);

Wait(100 + Random(200));

MouseBtnDown(x, y, mbLeft);

Wait(20 + Random(50));

MouseBtnUp(x, y, mbLeft);

Wait(100 + Random(200));

MoveMouse((x + 25), (y + 25));

Wait(100 + Random(200));

MouseBtnDown((x + 25), (y + 25), mbLeft);

Wait(20 + Random(50));

MouseBtnUp((x + 25), (y + 25), mbLeft);

Wait(3000 + Random(500));

Wait(CollectTime);

end;

end;

 

function NoResource: Boolean;

begin

Result := not FindColor(x, y, 1683891, 0, 0, 800, 600);

end;

 

function FindLevel: Boolean;

begin

Result := FindColor(lvlx, lvly, 25087, 0, 0, 500, 500);

end;

 

procedure LevelUp;

begin

if FindLevel then

begin

MoveMouse(lvlx, (lvly + 2));

Wait(100 + Random(100));

ClickMouse(lvlx, (lvly + 2), mbLeft);

Wait(100 + Random(100));

end;

end;

 

begin

Collect;

repeat

if NoResource then

Collect;

if (NextResource1 or NextResource2 or NextResource3) then

Collect;

if FindLevel then

LevelUp;

until False;

end.

Link to comment
Share on other sites

Is it either one of these (test both):

 

const
 Resource1 = 0; // Color de tu Recurso - Pega el color del recurso Nº1
 Resource2 = 0; // Color de tu Recurso - Pega el color del recurso Nº2
 Resource3 = 0; // Color de tu Recurso - Pega el color del recurso Nº3
 CollectTime = 0; // Tiempo en recolectar - Tiempo de recoleccion (11000 = 11 Segundos)

var
 x, y, lvlx, lvly: Integer;

function TargetResource1: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function TargetResource2: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function TargetResource3: Boolean;
begin
 Result := FindColor(x, y, Resource3, 0, 0, 800, 600);
end;

function NextResource1: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function NextResource2: Boolean;
begin
 Result := FindColor(x, y, Resource2, 0, 0, 800, 600);
end;

function NextResource3: Boolean;
begin
 Result := FindColor(x, y, Resource3, 0, 0, 800, 600);
end;

procedure Collect;
begin
 if (TargetResource1 or TargetResource2 or TargetResource3) then
 begin
   MoveMouse(x, y);
   Wait(100 + Random(200));
   MouseBtnDown(x, y, mbLeft);
   Wait(20 + Random(50));
   MouseBtnUp(x, y, mbLeft);
   Wait(3000 + Random(500));
   Wait(CollectTime);   
 end;
end;

function NoResource: Boolean;
begin 
 Result := not FindColor(x, y, 1683891, 0, 0, 800, 600);
end;

function FindLevel: Boolean;
begin
 Result := FindColor(lvlx, lvly, 25087, 0, 0, 500, 500);
end;

procedure LevelUp;
begin
 if FindLevel then
 begin
   MoveMouse(lvlx, (lvly + 2));
   Wait(100 + Random(100));
   ClickMouse(lvlx, (lvly + 2), mbLeft);
   Wait(100 + Random(100)); 
 end;
end;

begin
 Collect;
 repeat
   if NoResource then
     Collect;
   if (NextResource1 or NextResource2 or NextResource3) then
     Collect;
   if FindLevel then
     LevelUp;  
 until False;
end.

 

..or...

 

const
 Resource1 = 0; // Color de tu Recurso - Pega el color del recurso Nº1
 Resource2 = 0; // Color de tu Recurso - Pega el color del recurso Nº2
 Resource3 = 0; // Color de tu Recurso - Pega el color del recurso Nº3
 CollectTime = 0; // Tiempo en recolectar - Tiempo de recoleccion (11000 = 11 Segundos)

var
 x, y, lvlx, lvly: Integer;

function TargetResource1: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function TargetResource2: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function TargetResource3: Boolean;
begin
 Result := FindColor(x, y, Resource3, 0, 0, 800, 600);
end;

function NextResource1: Boolean;
begin
 Result := FindColor(x, y, Resource1, 0, 0, 800, 600);
end;

function NextResource2: Boolean;
begin
 Result := FindColor(x, y, Resource2, 0, 0, 800, 600);
end;

function NextResource3: Boolean;
begin
 Result := FindColor(x, y, Resource3, 0, 0, 800, 600);
end;

procedure Collect;
begin
 if (TargetResource1 or TargetResource2 or TargetResource3) then
 begin
   MoveMouse((x + 25), (y + 25));
   Wait(100 + Random(200));
   MouseBtnDown((x + 25), (y + 25), mbLeft);
   Wait(20 + Random(50));
   MouseBtnUp((x + 25), (y + 25), mbLeft);
   Wait(3000 + Random(500));
   Wait(CollectTime);   
 end;
end;

function NoResource: Boolean;
begin 
 Result := not FindColor(x, y, 1683891, 0, 0, 800, 600);
end;

function FindLevel: Boolean;
begin
 Result := FindColor(lvlx, lvly, 25087, 0, 0, 500, 500);
end;

procedure LevelUp;
begin
 if FindLevel then
 begin
   MoveMouse(lvlx, (lvly + 2));
   Wait(100 + Random(100));
   ClickMouse(lvlx, (lvly + 2), mbLeft);
   Wait(100 + Random(100)); 
 end;
end;

begin
 Collect;
 repeat
   if NoResource then
     Collect;
   if (NextResource1 or NextResource2 or NextResource3) then
     Collect;
   if FindLevel then
     LevelUp;  
 until False;
end.

 

-Jani

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...