Smartzkid
2007-09-07 16:50:35
UseOnDTM(dtm1, dtm2: integer): boolean; //uses dtm 1 on dtm 2
UseOnBMP(bmp1, bmp2: integer): boolean; //uses bmp1 on bmp2
UseOnInvSlot(slot1, slot2: integer): boolean; //uses item in slot1 on item in slot2 <- not done yet.
All-Ex do the same thing, but with uptext.
I'll test them out in a couple minutes. That is, if you think they're worth keeping.
PS: Would it be possible to set up a repository for this? It'd make things a lot more organized and easier to work on…
UseOnBMP(bmp1, bmp2: integer): boolean; //uses bmp1 on bmp2
UseOnInvSlot(slot1, slot2: integer): boolean; //uses item in slot1 on item in slot2 <- not done yet.
All-Ex do the same thing, but with uptext.
function UseOnDTM(dtm1, dtm2: integer): boolean;
var
d1x, d1y, d2x, d2y: integer;
begin
result := false;
if(FindDTM(dtm1, d1x, d1y, MIX1, MIY1, MIX2, MIY2))then
if(FindDTM(dtm2, d2x, d2y, MIX1, MIY1, MIX2, MIY2))then
begin
MMouse(d1x, d1y, 4, 4);
GetMousePos(d1x, d1y);
if(IsUpText('Use'))then
begin
Mouse(d1x, d1y, 0, 0, true);
end else
begin
Mouse(d1x, d1y, 0, 0, false);
if(not(ChooseOption('Use')))then Exit;
end;
wait(70 + random(130));
Mouse(d2x, d2y, 4, 4, true);
result := true;
end;
end;
function UseOnDTMEx(dtm1, dtm2: integer; UpText1, UpText2: string): boolean;
var
d1x, d1y, d2x, d2y: integer;
begin
result := false;
if(FindDTM(dtm1, d1x, d1y, MIX1, MIY1, MIX2, MIY2))then
if(FindDTM(dtm2, d2x, d2y, MIX1, MIY1, MIX2, MIY2))then
begin
MMouse(d1x, d1y, 4, 4);
if(not(IsUpText(UpText1)))then Exit;
GetMousePos(d1x, d1y);
if(IsUpText('Use'))then
Mouse(d1x, d1y, 0, 0, true)
else begin
Mouse(d1x, d1y, 0, 0, false);
if(not(ChooseOption('Use')))then Exit;
end;
wait(70 + random(130));
MMouse(d2x, d2y, 4, 4);
if(not(IsUpText(UpText2)))then
begin
Mouse(d1x, d1y, 3, 3, true);
Exit;
end;
GetMousePos(d2x, d2y);
Mouse(d2x, d2y, 0, 0, true);
result := true;
end;
end;
function UseOnBMP(bmp1, bmp2: integer): boolean;
var
b1x, b1y, b2x, b2y: integer;
begin
result := false;
if(FindBitmapIn(bmp1, b1x, b1y, MIX1, MIY1, MIX2, MIY2))then
if(FindBitmapIn(bmp2, b2x, b2y, MIX1, MIY1, MIX2, MIY2))then
begin
MMouse(b1x, b1y, 4, 4);
GetMousePos(b1x, b1y);
if(IsUpText('Use'))then
begin
Mouse(b1x, b1y, 0, 0, true);
end else
begin
Mouse(b1x, b1y, 0, 0, false);
ChooseOption('Use');
end;
wait(70 + random(130));
Mouse(b2x, b2y, 4, 4, true);
result := true;
end;
end;
function UseOnBMPEx(bmp1, bmp2: integer; UpText1, UpText2: string): boolean;
var
b1x, b1y, b2x, b2y: integer;
begin
result := false;
if(FindBitmapIn(bmp1, b1x, b1y, MIX1, MIY1, MIX2, MIY2))then
if(FindBitmapIn(bmp2, b2x, b2y, MIX1, MIY1, MIX2, MIY2))then
begin
MMouse(b1x, b1y, 4, 4);
if(not(IsUpText(UpText1)))then Exit;
GetMousePos(b1x, b1y);
if(IsUpText('Use'))then
Mouse(b1x, b1y, 0, 0, true)
else begin
Mouse(b1x, b1y, 0, 0, false);
if(not(ChooseOption('Use')))then Exit;
end;
wait(70 + random(130));
MMouse(b2x, b2y, 4, 4);
if(not(IsUpText(UpText2)))then
begin
Mouse(b1x, b1y, 3, 3, true);
Exit;
end;
GetMousePos(b2x, b2y);
Mouse(b2x, b2y, 0, 0, true);
result := true;
end;
end;I'll test them out in a couple minutes. That is, if you think they're worth keeping.
PS: Would it be possible to set up a repository for this? It'd make things a lot more organized and easier to work on…