Use
Its the same as Flag; but failsafe, and you can also change 0 to the amount of pixels you want to reach before doing something else.
To find your exact amount of coins you could do this:
SCAR Code:
coins := CoinAmount('inv');
For your Stay Logged In thing, you could mark time and make it do it every so often with a random amount added like this:
SCAR Code:
procedure StayLoggedIn;
begin
if(FindColorTolerance(x, y, InventoryMoney, mix1, miy1, mix2, miy2, 5)) then
if (TimeFromMark(MarkedTime) > 30000 + Random(10000)) then
begin
Mouse(x, y, 3, 3, true);
Mouse(x, y, 3, 3, true);
MarkTime(MarkedTime);
end;
end;
And making your loop this:
SCAR Code:
begin
SetUpSRL;
ClearDebug;
MarkTime(MarkedTime);
repeat
FindCoins;
StayLoggedIn;
if(CoinFound=1) then
begin
Writeln('We took money ' + IntToStr(coins) + ' time[s]!');
end;
until(false);
end.
And you missed some standards, fixed most of your standards here:
SCAR Code:
program MoneyCollector;
{.include srl/srl.scar}
var
x, y, coins, CoinFound, MarkedTime: Integer;
const
MoneyColour = 1479090; //coin colour
InventoryMoney = 1545912; //colour of coin from inventory
procedure FindCoins;
begin
if(FindColorTolerance(x,y,MoneyColour, msx1, msy1, msx2, msy2, 5)) then
begin
Mouse(x, y, 3, 3, false);
if(ChooseOption('ake')) then
begin
coins := coins + 1;
CoinFound:=1;
end;
FFlag(0);
Wait(5000+random(1000));
end else
CoinFound:=0;
end;
procedure StayLoggedIn;
begin
if(FindColorTolerance(x, y, InventoryMoney, mix1, miy1, mix2, miy2, 5)) then
if (TimeFromMark(MarkedTime) > 30000 + Random(10000)) then
begin
Mouse(x, y, 3, 3, true);
Mouse(x, y, 3, 3, true);
MarkTime(MarkedTime);
end;
end;
begin
SetUpSRL;
ClearDebug;
MarkTime(MarkedTime);
repeat
FindCoins;
StayLoggedIn;
if(CoinFound=1) then
begin
Writeln('We took money ' + IntToStr(coins) + ' time[s]!');
end;
until(false);
end.
For a update maybe you could make it log in? (Using DeclarePlayers and SRL's logging in).