PDA

View Full Version : Detecting blast furnace gauge state



EZ41
03-24-2016, 02:28 AM
Hi,

I'm working on a blast furnace script and I'd like to find a way for my bots to detect how hot the furnace is.

For those not familiar you can check with a gauge thing that you have to click on then it opens up an interface thing. I'll try attach a pic for you.

27270


Here's what I've tried or looked at:
it doesnt seem like any reflection data changes as the needle moves, examine data, ID etc..

I don't know much about widgets but i got a widget viewer and heated it up and nothing seemed to change.

I guess this leaves something color-based? Checking manually should work fine with my script so I'm open to this.

However color and advanced TPA's really rnt my forte so some help or suggestions would be much appreciated, or if theres a better way let me know your ideas.

Thanks for your time.

rj
03-24-2016, 03:40 AM
Gonna have to see more pics to see if this works

function getFuranceHeat():extended;
var
handTPA:TPointArray;
t:TPoint;
begin
findColorsSpiralTolerance(t.x, t.y, handTPA, 1118484, 157, 21, 442, 308, 0);
if (length(handTPA) < 1) then
exit;
t := middleTPA(handTPA);
result := degrees(fixRad((ArcTan2(-(t.y - 281), t.x - 160) + Radians(90)) - Pi));
end;

Also the input numbers are based off the picture in the browser not the game

mocrosoft
03-24-2016, 03:37 PM
If you use reflection you could use the settings in the client to check wether your bars are done or not.


function isBarsReady() : boolean;
var
arraySettings : TIntegerArray;
begin
arraySettings := R_GetSettingArray;
writeLn(arraySettings[546]);
if (arraySettings[546] > 20) then
begin
Result := true;
end else
Result := false;
end;

EZ41
03-24-2016, 06:51 PM
Gonna have to see more pics to see if this works

function getFuranceHeat():extended;
var
handTPA:TPointArray;
t:TPoint;
begin
findColorsSpiralTolerance(t.x, t.y, handTPA, 1118484, 157, 21, 442, 308, 0);
if (length(handTPA) < 1) then
exit;
t := middleTPA(handTPA);
result := degrees(fixRad((ArcTan2(-(t.y - 281), t.x - 160) + Radians(90)) - Pi));
end;

Also the input numbers are based off the picture in the browser not the game

tyvm for that, I have taken some more pictures so you can get a better idea of the interface, I will test your code when hooks are back up.

http://imgur.com/a/gWroU

I believe the red 'warning' things that can be seen in 1 or 2 pics just signify broken cogs/belt.

EZ41
03-24-2016, 06:52 PM
If you use reflection you could use the settings in the client to check wether your bars are done or not.


function isBarsReady() : boolean;
var
arraySettings : TIntegerArray;
begin
arraySettings := R_GetSettingArray;
writeLn(arraySettings[546]);
if (arraySettings[546] > 20) then
begin
Result := true;
end else
Result := false;
end;

Thanks, thats a handy suggestion and while it might not solve this particular issue, I'll likely use it in my script.

EZ41
03-25-2016, 07:55 PM
Gonna have to see more pics to see if this works

function getFuranceHeat():extended;
var
handTPA:TPointArray;
t:TPoint;
begin
findColorsSpiralTolerance(t.x, t.y, handTPA, 1118484, 157, 21, 442, 308, 0);
if (length(handTPA) < 1) then
exit;
t := middleTPA(handTPA);
result := degrees(fixRad((ArcTan2(-(t.y - 281), t.x - 160) + Radians(90)) - Pi));
end;

Also the input numbers are based off the picture in the browser not the game

Hey, unfortunately it's not working for me, I tried changing the bounds to be tighter to the interface and I even tried making it check the whole screen when I realized the problem was the ATPA keeps coming back empty but it doesnt find anything.

findColorsSpiralTolerance(t.x, t.y, handTPA, 1118484, msx1, msy1, msx2, msy2, 0);

which is weird because I checked and your color looks right to me for the needle.

Update:

I used a DTM to find the needle and that seemed to be working, so now that I have a point to put into your result function. It's not working for me unfortunately, at about 3 o clock the needle returns like 300 and then it goes all over the place as i heat the furnace up

result := degrees(fixRad((ArcTan2(-(t.y - 281), t.x - 160) + Radians(90)) - Pi));

EZ41
03-26-2016, 08:03 AM
Edit: Problem is with my DTM, it stop getting reecognized when the needle goes past a certain point, so back to square 1

EZ41
03-26-2016, 12:34 PM
function GaugeTemperature(): Double;
var
ATPA:T2DPointArray;
TPA:TPointArray;
tip:TPoint;
const
center:TPoint = [254,170];
begin
FindColorsTolerance(TPA, 1118485, 170,84,340,255, 45);
FilterPointsDist(TPA, 70,80, center.x, center.y);
Assert(Length(TPA) > 0, 'Err, pointer not found!');

ATPA := ClusterTPA(TPA,2);
SortATPAFromSize(ATPA,0,False);
SortTPAFrom(ATPA[0], center);
tip := ATPA[0][high(ATPA[0])];

Result := Degrees( FixRad(ArcTan2(tip.y-center.y, tip.x-center.x) + (PI/2)) );
end;


Works on all your images. Coordinates has been adjusted to account for image offset, so it can simply be applied without any effort.
It increases clockwise, as I found that to make most sense here, so: starting at top = 0, right = 90, bottom = 180.. etc..

Slacky posted this on another thread which works beautifully for me, incase anyone needs this.

Tyvm everyone who posted.