SRL Archive - Research & Development Lounge

Nmz resource chest


Fitta

2014-12-07 16:06:23

const
REWARD_RESOURCES = 0;
REWARD_UPGRADES = 1;
REWARD_BENEFITS = 2;



function isRewardOpen: boolean;
begin
Result := findTextTPA(2070783, 4, toBox(260, 35, 307, 48), 'Reward', 'UpChars07', -1);
end;

function getRewardTab: integer;
var
I, X, Y: Integer;
begin
If Not isRewardOpen then
Exit(-1);

For I:=0 to 2 do
If FindColorTolerance(X, Y, 1974407, 27+(I*90), 60, 109+(I*90), 79, 5)then
Exit(I);

end;

function rewardTab(I: Integer): boolean;
var
Tries: Integer;
begin
If (Not isRewardOpen)or(Not isLoggedIn) then
Exit(False);

repeat
If (getRewardTab = I)then
Exit(True)
else
mouseBox(IntToBox(27+(I*90), 60, 109+(I*90), 79), Mouse_Left);

Wait(500+Random(600));
Inc(Tries);

until(Tries > 3);
end;

function exitReward: boolean;
var
Tries: Integer;
begin
If Not isRewardOpen then
Exit(True);

repeat
If not isRewardOpen then
Exit(True)
else
mouseBox(IntToBox(477, 32, 494, 49), Mouse_Left);

Wait(500+Random(500));

until(Tries > 3);
end;

Was going to include the chest in my script rewrite, never did though.
If someone finds it useful, enjoy.

Hoodz

2014-12-07 16:12:43


If (Not isRewardOpen)or(Not isLoggedIn)or(Failed) then

what is failed?

@Fitta;

Fitta

2014-12-07 16:28:04

From: hoodz

If (Not isRewardOpen)or(Not isLoggedIn)or(Failed) then

what is failed?

@Fitta;


Fixed, sorry about that..

It's a variable I keep for all my scripts in case something went wrong :)

Hoodz

2014-12-07 17:19:18

From: Fitta
Fixed, sorry about that..

It's a variable I keep for all my scripts in case something went wrong :)


dont have to be sorry, just wanted to know since i couldnt find anything about it in the snippet