SRL Archive - SRL Bugs

SetFightMode(4) chooses (3).


Harry

2011-02-28 07:05:42


Clicks the 3rd box (lunge) when I requested 4th (block). Don't know what the issue is or if it's a PEBKAC or a bug, but just thought I'd throw it out there..

Frement

2011-02-28 08:54:23

I fixed this long time ago, but I saw some discussion on some other thread, and someone "fixed" it again, maybe this is result of that?

Naum

2011-02-28 09:56:12

I modified it, then cohen went back to change the GetColor. I feel that the color isn't constant or anything, needs a permanent fix

EvilChicken!

2011-02-28 10:01:20

.. but Fre had already fixed it?
Why did someone modify it again?

Rich

2011-02-28 10:37:56

The colour in the edit I posted in Fawki's thread in Members was constant.
{function SetFightMode(oFightMode: Integer): Boolean;
By: Nielsie95 & Nava2, fixed by Quickmarch, fixed by Rich
Description: Sets fight mode. Returns false if failed to set desired mode.
*******************************************************************************}
function SetFightMode(oFightMode: Integer): Boolean;
var
i, x, y: Integer;
b: TBox;
cmbBoxes: TBoxArray;
begin
Result := False;
if not(Loggedin)then Exit;
GameTab(tab_Combat);
Wait(200 + Random(100));

cmbBoxes := [IntToBox(575, 255, 630, 290), IntToBox(660, 255, 710, 290),
IntToBox(575, 310, 630, 345), IntToBox(660, 310, 710, 345)];
b := cmbBoxes[oFightMode - 1];
if (not(GetColor(657, 345) = 5791325)) and (oFightMode = 4) then
b := cmbBoxes[2];
i := 0;
while (i < 4) do
begin
Result := FindColorTolerance(x, y, 1777020, b.x1, b.y1, b.x2, b.y2, 2);
if (Result) then Exit;
Mouse(RandomRange(b.x1, b.x2), RandomRange(b.y1, b.y2), 0, 0, True);
Wait(500 + Random(300));
Inc(i);
end;
end;

Naum

2011-02-28 10:41:09

From: Rich
The colour in the edit I posted in Fawki's thread in Members was constant.
{function SetFightMode(oFightMode: Integer): Boolean;
By: Nielsie95 & Nava2, fixed by Quickmarch, fixed by Rich
Description: Sets fight mode. Returns false if failed to set desired mode.
*******************************************************************************}
function SetFightMode(oFightMode: Integer): Boolean;
var
i, x, y: Integer;
b: TBox;
cmbBoxes: TBoxArray;
begin
Result := False;
if not(Loggedin)then Exit;
GameTab(tab_Combat);
Wait(200 + Random(100));

cmbBoxes := [IntToBox(575, 255, 630, 290), IntToBox(660, 255, 710, 290),
IntToBox(575, 310, 630, 345), IntToBox(660, 310, 710, 345)];
b := cmbBoxes[oFightMode - 1];
if (not(GetColor(657, 345) = 5791325)) and (oFightMode = 4) then
b := cmbBoxes[2];
i := 0;
while (i < 4) do
begin
Result := FindColorTolerance(x, y, 1777020, b.x1, b.y1, b.x2, b.y2, 2);
if (Result) then Exit;
Mouse(RandomRange(b.x1, b.x2), RandomRange(b.y1, b.y2), 0, 0, True);
Wait(500 + Random(300));
Inc(i);
end;
end;


Tell me if it works

Gu3st...

2011-02-28 13:09:56

Problem still occurs with R1ch's function for me

function SetFightMode(FightMode : Integer): Boolean;
var
Boxes : TBoxArray;
Box : TBox;
X, Y, I : Integer;
begin
Result := False;
if not LoggedIn then Exit;

GameTab(tab_Combat);
Boxes := [IntToBox(567, 250, 636, 295), IntToBox(651, 250, 818, 295),
IntToBox(567, 303, 636, 348), IntToBox(651, 303, 818, 348)];
Box := Boxes[FightMode-1];

if FightMode = 4 then
if GetColor(657, 345) <> 5791325 then
Box := Boxes[2];

for I := 0 to 3 do
begin
Result := FindColorTolerance(X, Y, 2106252, Box.X1, Box.Y1, Box.X2, Box.Y2, 10);
if Result then Break;
Mouse(RandomRange(Box.x1, Box.x2), RandomRange(Box.y1, Box.y2), 0, 0, True);
WriteLn(CountColorTolerance(2106252, Box.X1, Box.Y1, Box.X2, Box.Y2, 10));
Wait(500+Random(300));
end;
end;
Works for me

Coh3n

2011-03-02 13:53:08

^ That doesn't work for me. =\ Why is this part even in the function?

if (not(GetColor(662, 336) = 1974407)) and (oFightMode = 4) then
b := cmbBoxes[2];

Naum

2011-03-02 13:58:37

From: Coh3n
^ That doesn't work for me. =\ Why is this part even in the function?

if (not(GetColor(662, 336) = 1974407)) and (oFightMode = 4) then
b := cmbBoxes[2];


I think it's when a person chooses the 4th box and if there isn't one, it will resort to the third box.
I don't think its needed if it does indeed do that.

Coh3n

2011-03-02 14:01:08

From: Naum
I think it's when a person chooses the 4th box and if there isn't one, it will resort to the third box.
I don't think its needed if it does indeed do that.

Ah okay. I'll work on this now then, thanks. :)

E: Fixed. Instead of getting rid of that part, I have it check for the text color instead. Does anyone know if there's a weapon that doesn't have "Block" as the defence attack style? If there is, may have to change it to a FindColor rather than GetColor.

i luffs yeww

2011-03-02 15:19:39

From: Coh3n
Ah okay. I'll work on this now then, thanks. :)

E: Fixed. Instead of getting rid of that part, I have it check for the text color instead. Does anyone know if there's a weapon that doesn't have "Block" as the defence attack style? If there is, may have to change it to a FindColor rather than GetColor.


Every weapon has a defence training option, but some weapons (ranged weapons) don't say "Block," it's "Long range" or something (in case that matters).

Echo_

2011-03-02 15:35:45

From: i luffs yeww
Every weapon has a defence training option, but some weapons (ranged weapons) don't say "Block," it's "Long range" or something (in case that matters).


Ranged weapons only have 3 options though.

Coh3n

2011-03-02 15:40:39

From: Echo_
Ranged weapons only have 3 options though.

Yeah so for that instance it wouldn't matter. I did test with a range weapon, though, in case anyone was wondering.

Narcle

2011-03-02 19:03:38

I prefer findcolor, GetColor can easily break from a single pixel shift..

Coh3n

2011-03-02 19:21:30

From: Narcle
I prefer findcolor, GetColor can easily break from a single pixel shift..

Yeah, and in this situation there's no chance for false positives/negatives.