PDA

View Full Version : Will not wait for progressScreen to be gone



GetHyper
07-05-2015, 11:17 AM
Hey guys, in need of a little help.

My fletcher works flawlessly in the way of my current issue, I just can't seem to get the script to wait whilst the progress screen is open in my house.

I'm trying to make tabs, this is based on Ashamans (I did try to modify that one but was still buggy so decided to try my own).
I have got it to find the butler, get him to fetch me clay, wait for the clay, use the altar and start production but then it will not wait for the tabs and tries banking again.

Any ideas would be appreciated, it's probably staring me in the face.


program HyperTabs;

{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i sps/lib/sps-rs3.simba}
{$i srl-6/lib/misc/srlplayerform.simba}

Const
NB_COLOR := 2039571;
NB_TOL := 1;
NB_HUE := 0.00;
NB_SAT := 1.00;

var
i, x, y, xc, yc, TO_MAKE, PRODSCREEN, CLAYSLOT, WORLD, tabsMade, loads,
notedClayDTM, clayDTM : integer;
TPA: TPointArray;
ATPA: T2DPointArray;
PS, BT, BP : TTimeMarker;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'HyperTabs';
scriptHelpThread := ' ';
editBoxLabels := ['Number to make', 'Production Screen Number', 'Clay Inv Number', 'World'];
editBoxDefaults := ['1000', '1', '1', '24'];
end;
end;

procedure declarePlayers();
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
TO_MAKE := strToInt(playerForm.players[i].settings[0]);
PRODSCREEN := strToInt(playerForm.players[i].settings[1]);
CLAYSLOT := strToInt(playerForm.players[i].settings[1]);
WORLD := strToInt(playerForm.players[i].settings[3]);
players[currentPlayer].world := World;
end;
end;

function antiban: Boolean;
begin
case random(120) of
1..5: mousemovingobject;
10..12: hoverSkill(SKILL_MAGIC);
11: wait(randomRange(1000, 2500));
25..65: mouseOffClient(OFF_CLIENT_RANDOM);
66..68: pickUpMouse();
69: wait(RandomRange(250, 1500));
70: mouseOffClient(4);
77: randomRClickItem();
99: wait(randomRange(3000, 4500));
end;
end;

procedure setDTM();
begin
notedClayDTM := DTMFromString('mQwAAAHicY2ZgYMhiYmAoAeIUIH4C5L8F4j dAHGLLw7B6dhHDnN4MBn4gH4YZkTAQAABS9Qgf');
clayDTM := DTMFromString('mggAAAHicY2NgYGBlQABOIBYEYnYoZgFiHi DmQ1IXYsvD4GvBzRDvyssQ4cDDYKPNwWCny8nABZTDhhlxYAgA ABXfA/4=');
end;

procedure ifreeDTMs;
begin
freeDTM(notedClayDTM);
freeDTM(clayDTM);
end;

function findButler: Boolean;
begin
BT.start;

repeat
findColorsTolerance(TPA, NB_COLOR, mainScreen.getBounds(), NB_TOL, colorSetting(2, NB_HUE, NB_SAT));

if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(15, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ler', 'But', 'utl'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
wait(gaussRangeInt(300, 500));
end;
end;
until (BT.getTime > 30000) or (not isLoggedIn) or (conversationBox.areTalking);
end;

procedure useButler();
begin
if not tabBackpack.isSlotActivated(CLAYSLOT) then
begin
if (not findDTM(notedClayDTM,XC,YC,tabBackpack.getBounds)) then
begin
Writeln('No Clay found');
TerminateScript;
end;

mouse(XC, YC, gaussRangeInt(-5,5), gaussRangeInt(-5,5));
fastClick(Mouse_Left);
end

findColorsTolerance(TPA, NB_COLOR, mainScreen.getBounds(), NB_TOL, colorSetting(2, NB_HUE, NB_SAT));

if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(15, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['ler', 'But', 'utl'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
wait(gaussRangeInt(300, 500));
end;
end;

BT.start;
repeat
wait(randomRange(200, 400));
until (BT.getTime > 5000) or (conversationBox.selectOption(['soft'])) Or (ConversationBox.Continue(True,False, false));

if (conversationBox.continue(True,False, False)) Then
begin
conversationBox.continue(True, True);
conversationBox.selectOption(1);
wait(randomRange(1000, 2000));
useButler;
end;

BP.start;
repeat
wait(randomRange(1200, 1500));
antiban;
until (BP.getTime > 30000) or (tabBackpack.waitForShift(12000));
end;

procedure findAltar();
begin
if not isLoggedIn then
exit;

findColorsSpiralTolerance(x, y, TPA, 8819091, mainScreen.getBounds(), 9, colorSetting(2, 0.12, 0.21));

if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(15, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['tudy', 'Stu', 'tern', 'Lec'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
PS.start;
repeat
wait(random(200));
until (PS.getTime > 10000) or (productionScreen.isOpen);
end;
end;

procedure makeTabs();
begin
if not isLoggedIn then
exit;

begin
findColorsSpiralTolerance(x, y, TPA, 8819091, mainScreen.getBounds(), 9, colorSetting(2, 0.12, 0.21));

if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(15, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['tudy', 'Stu', 'tern', 'Lec'], 500) then
begin
fastClick(MOUSE_LEFT);
break;
end;
PS.start;
repeat
wait(random(200));
until (PS.getTime > 10000) or (productionScreen.isOpen);
end;
end;

begin
if productionscreen.isopen(10000) then
if productionScreen.selectBox(PRODSCREEN) then
if productionScreen._getSelectedBox(PRODSCREEN) then
productionScreen.clickStart;
wait(gaussRangeInt(500,1200));
if progressScreen.isOpen() then
repeat
wait(gaussRangeInt(1000,2250));
until (not progressScreen.isOpen) or (tabBackpack.CountDTM(ClayDTM) = 0) or (not isLoggedIn);
end;
end;

procedure progressReport();
begin

tabsMade := Loads * 20;

writeln('HyperTabs V1.0');
writeln('Time Running: ' + timeRunning());
writeln('Tabs Made: ' + intToStr(tabsMade));

end;

//Mainloop
begin
clearDebug();
smartEnableDrawing := true;
disableSRLDebug := true;
initPlayerForm();
runPlayerForm();
if not playerForm.isScriptReady then
exit;
declarePlayers();
setupSRL();
if not isLoggedIn() then
begin
players[currentPlayer].login();
exitTreasure();
minimap.clickCompass();
wait(gaussRangeInt(200, 400));
mainScreen.setAngle(MS_ANGLE_HIGH);
end;
setDTM;
if tabBackpack.countDTM(clayDTM) >= 1 then
begin
makeTabs;
end;
repeat
SMARTImage.clear;
useButler;
//findAltar;
makeTabs;
progressReport;
until (tabsMade >= TO_MAKE) or (not isLoggedIn);
ifreeDTMs;
end.


I don't know what it is but been at it for a few hours, need a break.

The Mayor
07-05-2015, 12:40 PM
Sounds like the progressScreen is not being recognised.

You could make some manually with this running in the background to debug:


program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

begin
setupSRL();

repeat
writeLn(progressScreen.isOpen());
until false;
end.

GetHyper
07-05-2015, 12:56 PM
I will try this later when I'm back on, thank you Mayor.

fady
07-05-2015, 12:58 PM
Are you sure the Clay DTM is functional, because that might trigger the end of the loop prematurely. But if the clay DTM is working properly then Try using progressScreen.isOpen(randomRange(1000,1500)) so that part of the until, will only stop the loop when the progress screen isn't detected (returns a false result) for 1-1.5 seconds straight. I suggest also moving that to the 2nd condition not the first so we don't have to wait the time, when we run out of clay.

eDiT: on my phone, expect capitalization errors lol

GetHyper
07-05-2015, 01:12 PM
Are you sure the Clay DTM is functional, because that might trigger the end of the loop prematurely. But if the clay DTM is working properly then Try using progressScreen.isOpen(randomRange(1000,1500)) so that part of the until, will only stop the loop when the production screen isn't detected for 1-1.5 seconds. I suggest also moving that to the 2nd condition not the first so we don't have to wait the time, when we run out of clay.

eDiT: on my phone, expect capitalization errors lol

I will relook at the DTM, hadn't even thought of that.

GetHyper
07-05-2015, 07:13 PM
Sounds like the progressScreen is not being recognised.

You could make some manually with this running in the background to debug:


program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

begin
setupSRL();

repeat
writeLn(progressScreen.isOpen());
until false;
end.


It is returning false, not sure how I am going to get around this other than waiting for a set time or until there are no clayDTM in my inventory.

Fady, the DTM was correct.

The Mayor
07-05-2015, 07:23 PM
It is returning false, not sure how I am going to get around this other than waiting for a set time or until there are no clayDTM in my inventory.

Fady, the DTM was correct.

Can you try another progress screen (i.e. while cooking or fletching) and see if it's the same? If it is still false can you give me a screenshot?

GetHyper
07-05-2015, 08:09 PM
Can you try another progress screen (i.e. while cooking or fletching) and see if it's the same? If it is still false can you give me a screenshot?

So fletching at Lumby chest comes back as True, so it's something to do with my POH.
Tried both normal and building mode, no change.

Sin
07-05-2015, 08:25 PM
You need to use productionMenu, not progressScreen.

GetHyper
07-05-2015, 08:34 PM
You need to use productionMenu, not progressScreen.

I can't see productionMenu anywhere, I'm guessing you mean Screen.

I can start making the tabs, it's when it moves to the progress screen that it fails.
I will try it anyway and see what comes up, thank you.

The Mayor
07-05-2015, 08:42 PM
I can't see productionMenu anywhere, I'm guessing you mean Screen.

I can start making the tabs, it's when it moves to the progress screen that it fails.
I will try it anyway and see what comes up, thank you.

Lol Shay productionMenu.

Look like your POH, can you get me a PNG screenshot of the progressSCreen?

GetHyper
07-05-2015, 08:45 PM
Lol Shay productionMenu.

Look like your POH, can you get me a PNG screenshot of the progressSCreen?

Not sure how much you need, lemme know if it's alright.

26309

The Mayor
07-05-2015, 09:29 PM
Not sure how much you need, lemme know if it's alright.



OK, the border colour at the very top was a little different. Wanna test this? Just copy and paste it into your script and see if it works. If it does, can you also test it while fletching:


function TRSProgressScreen.__find(): boolean; override;
const
BORDER_COLOR = 5327681;
BORDER_COLOR_BOTTOM = 5919042;
BORDER_LENGTH = 232;
var
tpa: TPointArray;
atpa: T2DPointArray;
i: integer;
b: TBox;
begin
if findColors(tpa, BORDER_COLOR, getClientBounds()) then
atpa := tpa.cluster(1);

if length(atpa) < 1 then exit(false);

for i := 0 to high(atpa) do
if (length(atpa[i]) = BORDER_LENGTH) then
begin
b := atpa[i].getBounds();

if (getColor(b.x1 - 39, b.y1 + 101) = BORDER_COLOR_BOTTOM) then
begin
self.setBounds([b.x1 - 54, b.y1 - 27, b.x2 + 56, b.y2 + 122]);
exit(true);
end;
end;
end;

GetHyper
07-05-2015, 09:34 PM
OK, the border colour at the very top was a little different. Wanna test this? Just copy and paste it into your script and see if it works. If it does, can you also test it while fletching:


function TRSProgressScreen.__find(): boolean; override;
const
BORDER_COLOR = 5327681;
BORDER_COLOR_BOTTOM = 5919042;
BORDER_LENGTH = 232;
var
tpa: TPointArray;
atpa: T2DPointArray;
i: integer;
b: TBox;
begin
if findColors(tpa, BORDER_COLOR, getClientBounds()) then
atpa := tpa.cluster(1);

if length(atpa) < 1 then exit(false);

for i := 0 to high(atpa) do
if (length(atpa[i]) = BORDER_LENGTH) then
begin
b := atpa[i].getBounds();

if (getColor(b.x1 - 39, b.y1 + 101) = BORDER_COLOR_BOTTOM) then
begin
self.setBounds([b.x1 - 54, b.y1 - 27, b.x2 + 56, b.y2 + 122]);
exit(true);
end;
end;
end;


Do you mean within my script, I put it near the top of the script and modified my script to use progress screen rather than countDTM and it still didn't see the screen.

I'm going to head to bed now, up early so will check on this tomorrow - sorry to have created a problem!

The Mayor
07-05-2015, 09:49 PM
Do you mean within my script, I put it near the top of the script and modified my script to use progress screen rather than countDTM and it still didn't see the screen.

I'm going to head to bed now, up early so will check on this tomorrow - sorry to have created a problem!

Yea just paste the whole thing in your script. Actually, you could just paste it in the test snippet:


program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

function TRSProgressScreen.__find(): boolean; override;
const
BORDER_COLOR = 5327681;
BORDER_COLOR_BOTTOM = 5919042;
BORDER_LENGTH = 232;
var
tpa: TPointArray;
atpa: T2DPointArray;
i, hh: integer;
b: TBox;
p: TPoint;
begin
if findColors(tpa, BORDER_COLOR, getClientBounds()) then
atpa := tpa.cluster(1);

if length(atpa) < 1 then exit(false);

for i := 0 to high(atpa) do
writeLn('[' + toStr(i) + '] length: ' + toStr(length(atpa[i])));

for i := 0 to high(atpa) do
if (length(atpa[i]) = BORDER_LENGTH) then
begin
b := atpa[i].getBounds();

writeLn(getColor(b.x1 - 39, b.y1 + 101));

if (getColor(b.x1 - 39, b.y1 + 101) = BORDER_COLOR_BOTTOM) then
begin
self.setBounds([b.x1 - 54, b.y1 - 27, b.x2 + 56, b.y2 + 122]);
exit(true);
end;
end;
end;

begin
setupSRL();

repeat
writeLn(progressScreen.isOpen());
until false;
end.

Sin
07-06-2015, 12:51 AM
Lol Shay productionMenu.

Look like your POH, can you get me a PNG screenshot of the progressSCreen?


Awks I didn't remember what it was called >_>

GetHyper
07-06-2015, 04:32 PM
Easier than mentioning sorry.
When I have the production screen is gives


[0] length: 4
[1] length: 4
[2] length: 232
1842722
False


When the progress screen is open it moves to


[0] length: 4
[1] length: 4
[2] length: 232
2300428
False

When I'm not doing anything it returns false.


It is no longer counting DTMs in my inventory but will count just the inventory (Just seen on github that its been updated today so I guess there is issues?).

The Mayor
07-06-2015, 05:47 PM
Easier than mentioning sorry.
When I have the production screen is gives


[0] length: 4
[1] length: 4
[2] length: 232
1842722
False


When the progress screen is open it moves to


[0] length: 4
[1] length: 4
[2] length: 232
2300428
False

When I'm not doing anything it returns false.


It is no longer counting DTMs in my inventory but will count just the inventory (Just seen on github that its been updated today so I guess there is issues?).

Hmm. Was that the progressScreen in your POH? Did you also test it while fletching?

GetHyper
07-06-2015, 05:56 PM
Ill go check fletching, will edit soon.

Edit: Fletching (not in POH) gives


[0] length: 226
[1] length: 1
[2] length: 232
5919042
True

The Mayor
07-06-2015, 06:04 PM
Ill go check fletching, will edit soon.

Edit: Fletching (not in POH) gives


[0] length: 226
[1] length: 1
[2] length: 232
5919042
True


OK sweet. 1 last test. Can you run this in POH and then again not in POH like before:


program new;
{$DEFINE SMART}
{$i srl-6/srl.simba}

function TRSProgressScreen.__find(): boolean; override;
const
BORDER_COLOR = 5327681;
BORDER_COLOR_BOTTOM = 5919042;
BORDER_LENGTH = 232;
var
tpa: TPointArray;
atpa: T2DPointArray;
i, hh: integer;
b: TBox;
p: TPoint;
begin
if findColors(tpa, BORDER_COLOR, getClientBounds()) then
atpa := tpa.cluster(1);

if length(atpa) < 1 then exit(false);

for i := 0 to high(atpa) do
writeLn('[' + toStr(i) + '] length: ' + toStr(length(atpa[i])));

for i := 0 to high(atpa) do
if (length(atpa[i]) = BORDER_LENGTH) then
begin
b := atpa[i].getBounds();

writeLn(toStr(getColor(b.x1 - 39, b.y1 + 101)) + ' | ' + toStr(getColor(b.x1 - 39, b.y1 + 102)));

if (getColor(b.x1 - 39, b.y1 + 101) = BORDER_COLOR_BOTTOM) or (getColor(b.x1 - 39, b.y1 + 102) = BORDER_COLOR_BOTTOM) then
begin
self.setBounds([b.x1 - 54, b.y1 - 27, b.x2 + 56, b.y2 + 122]);
exit(true);
end;
end;
end;

begin
setupSRL();

repeat
writeLn(progressScreen.isOpen());
until false;
end.

GetHyper
07-06-2015, 06:17 PM
Tell you what Mayor, you the man :)
Tried both POH and at bank, both returned True - better go and change my script back.



[0] length: 4
[1] length: 4
[2] length: 232
2300428 | 5919042
True


Has anyone else experience the issue of not counting DTMs in backpack?

I have to go now, playing footy.

The Mayor
07-06-2015, 06:20 PM
Tell you what Mayor, you the man :)
Tried both POH and at bank, both returned True - better go and change my script back.



[0] length: 4
[1] length: 4
[2] length: 232
2300428 | 5919042
True


Has anyone else experience the issue of not counting DTMs in backpack?

I have to go now, playing footy.

Not that I've heard, but I guess I could take a look.