bl3d3
11-07-2019, 01:38 PM
Hello guys, so i wanted to make a simple cooking script, using tutorials on this forum. I managed to make it loop 4-5 times, but since my scripting knowledge is very limited it would start clicking where it not supposted to.
The script cooks, withdraws and deposits, opens bank (poorly but eventualy does it). While walking to cooking range and while walking to bnak, after few runs it would start clicking on the main screen, while walking(it supposed to sleep, while player is moving).
Here is how the script looks like:
I've made some really long sleep/wait time, hoping it would fix the random clicking on main screen while walking.
Also i wasnt sure how to make it loop properly.
program new;
{$i AeroLib/AeroLib.Simba}
function IsCooking: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(560, 205, 734, 463);
if pixelShift(PBox, 2000) then
Result := true;
end;
function isRawFishInInv: boolean;
var
x,y : integer;
begin
if FindColorTolerance(x,y, 14271377, 555, 206, 729, 461, 15) then
result := true;
end;
procedure WalkToBank
var
pnt : TPoint
begin
if findSymbol(pnt, SYMBOL_Bank) then
humanMMouse(pnt,1,1);
wait(250);
fastClick(1);
sleep(2000);
while isPlayerWalking() do
wait(1000);
end;
procedure WalkToRange
var
color_White : TColEx;
foundPnt : TPoint;
begin
color_White.create(982782, 2, 0.00, 0.39);
if color_White.findIn(AREA_MM, foundPnt) then
humanMMouse(foundPnt,1,1);
wait(250);
fastClick(1);
wait(2000);
while isPlayerWalking() do
wait(1000);
end;
procedure Banking;
var
x,y : integer;
obj_Chest : TMSObject;
Pnts : TPointArray;
begin // Wooden color // Silver color
obj_Chest.create('Bank', ['Bank booth','booth'], [createCol(3618620, 16, 0.53, 2.97)], [createCol(3493981, 1, 0.27, 0.12)]);
if obj_Chest.findAll(10, MSCP, Pnts) then
findMSObjectSimple([3618620, 3493981], ['Bank booth','booth']);
fastClick(1);
Wait(500 + Random(500 + 1000));
mouseBox(387,295,407,310,1,1);
wait(800);
repeat
mouseBox(387,295,407,310,1,1);
until(isInvEmpty);
end;
procedure Withdraw;
begin
mouseBox(44,93,52,103,1,0);
wait(500);
waitOption('All', 500);
wait(500);
end;
procedure SelectFish;
var
x,y : integer;
begin
if FindColorTolerance(x,y,6907522, 7, 347, 511, 473, 15) then
MoveMouse(x,y);
wait(500);
fastClick(1);
end;
procedure LetsCook;
var
x,y : integer;
obj_Range : TMSObject;
Pnts : TPointArray;
begin // Wooden color // Silver color
obj_Range.create('Range', ['Ran','nge'], [createCol(1583821, 9, 0.55, 2.87)], [createCol(3618620, 12, 0.47, 3.13)]);
if obj_Range.findAll(10, MSCP, Pnts) then
findMSObjectSimple([1583821, 3618620], ['Range']);
fastClick(1);
Wait(500 + Random(500 + 1000));
end;
procedure DepositAndWithdraw;
begin
if (not(isRawFishInInv)) then
WalkToBank;
wait(1000);
Banking;
if (isInvEmpty) then
Withdraw;
end;
procedure WalkToRangeAndCook;
begin
if (isRawFishInInv) then
WalkToRange;
wait(1000);
LetsCook;
wait(500);
SelectFish;
while IsCooking do
wait(200);
end;
procedure loop;
begin
DepositAndWithdraw;
sleep(500);
WalkToRangeAndCook;
sleep(500);
end;
begin
initAL;
repeat
Loop;
until(false);
end.
The script cooks, withdraws and deposits, opens bank (poorly but eventualy does it). While walking to cooking range and while walking to bnak, after few runs it would start clicking on the main screen, while walking(it supposed to sleep, while player is moving).
Here is how the script looks like:
I've made some really long sleep/wait time, hoping it would fix the random clicking on main screen while walking.
Also i wasnt sure how to make it loop properly.
program new;
{$i AeroLib/AeroLib.Simba}
function IsCooking: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(560, 205, 734, 463);
if pixelShift(PBox, 2000) then
Result := true;
end;
function isRawFishInInv: boolean;
var
x,y : integer;
begin
if FindColorTolerance(x,y, 14271377, 555, 206, 729, 461, 15) then
result := true;
end;
procedure WalkToBank
var
pnt : TPoint
begin
if findSymbol(pnt, SYMBOL_Bank) then
humanMMouse(pnt,1,1);
wait(250);
fastClick(1);
sleep(2000);
while isPlayerWalking() do
wait(1000);
end;
procedure WalkToRange
var
color_White : TColEx;
foundPnt : TPoint;
begin
color_White.create(982782, 2, 0.00, 0.39);
if color_White.findIn(AREA_MM, foundPnt) then
humanMMouse(foundPnt,1,1);
wait(250);
fastClick(1);
wait(2000);
while isPlayerWalking() do
wait(1000);
end;
procedure Banking;
var
x,y : integer;
obj_Chest : TMSObject;
Pnts : TPointArray;
begin // Wooden color // Silver color
obj_Chest.create('Bank', ['Bank booth','booth'], [createCol(3618620, 16, 0.53, 2.97)], [createCol(3493981, 1, 0.27, 0.12)]);
if obj_Chest.findAll(10, MSCP, Pnts) then
findMSObjectSimple([3618620, 3493981], ['Bank booth','booth']);
fastClick(1);
Wait(500 + Random(500 + 1000));
mouseBox(387,295,407,310,1,1);
wait(800);
repeat
mouseBox(387,295,407,310,1,1);
until(isInvEmpty);
end;
procedure Withdraw;
begin
mouseBox(44,93,52,103,1,0);
wait(500);
waitOption('All', 500);
wait(500);
end;
procedure SelectFish;
var
x,y : integer;
begin
if FindColorTolerance(x,y,6907522, 7, 347, 511, 473, 15) then
MoveMouse(x,y);
wait(500);
fastClick(1);
end;
procedure LetsCook;
var
x,y : integer;
obj_Range : TMSObject;
Pnts : TPointArray;
begin // Wooden color // Silver color
obj_Range.create('Range', ['Ran','nge'], [createCol(1583821, 9, 0.55, 2.87)], [createCol(3618620, 12, 0.47, 3.13)]);
if obj_Range.findAll(10, MSCP, Pnts) then
findMSObjectSimple([1583821, 3618620], ['Range']);
fastClick(1);
Wait(500 + Random(500 + 1000));
end;
procedure DepositAndWithdraw;
begin
if (not(isRawFishInInv)) then
WalkToBank;
wait(1000);
Banking;
if (isInvEmpty) then
Withdraw;
end;
procedure WalkToRangeAndCook;
begin
if (isRawFishInInv) then
WalkToRange;
wait(1000);
LetsCook;
wait(500);
SelectFish;
while IsCooking do
wait(200);
end;
procedure loop;
begin
DepositAndWithdraw;
sleep(500);
WalkToRangeAndCook;
sleep(500);
end;
begin
initAL;
repeat
Loop;
until(false);
end.