SRL Archive - SRL Bugs

FightMode (rev 33) doesn't work


marpis

2009-06-01 17:08:50


writeln('FightMode = '+inttostr(m+1));
SetFightMode(m+1);

In the debug i get:

FightMode = 1

but it won't change fightmode, just moves the mouse to the upper left corner
-_-'

ShowerThoughts

2009-06-01 17:11:41

Drag the crosshair on the client.
Restart scar, if you use smart, restart smart.

marpis

2009-06-01 17:25:20

From: Hermen
Drag the crosshair on the client.
Restart scar, if you use smart, restart smart.


ehm, yes i did that a hundred times and it doesnt work.
SetFightMode('attack') works correctly.

was this even tested with integers?

Floor66

2009-06-01 17:25:56

Ive had trouble with it too since #33

ZephyrsFury

2009-06-01 17:46:47

Oh ok my bad. I guess I should have tested before commiting. Anyway fix is up in the Dev SVN. Or here's the fixed procedure:


{*******************************************************************************
function SetFightMode(oFightMode: Integer): Boolean;
By: Nielsie95, Quickmarch, Timer, and Nava2
Description: Sets fight mode. Returns false if failed to set desired mode.
*******************************************************************************}

function SetFightMode(oFightMode: Variant): Boolean;
var
i, x, y, r: Integer;
b: TBox;
cmbBoxes: array of TBox;
strs: array of array of String;
begin
Result := False;
if not(Loggedin)then Exit;
GameTab(1);
Wait(200 + Random(777));

cmbBoxes := [IntToBox(575, 255, 630, 290), IntToBox(660, 255, 710, 290), IntToBox(575, 310, 630, 345), IntToBox(660, 310, 710, 345)];
strs := [TStringArray(['attack', 'att']), TStringArray(['strength', 'str']), TStringArray(['controlled', 'control', 'ctrl', 'multi']), TStringArray(['defence', 'def', 'defense'])];
case VarType(oFightMode) of
3: begin b := cmbBoxes[Integer(oFightMode) - 1]; r := oFightMode; end;
256: for x := 0 to 3 do
begin
i := High(strs[x]);
for y := 0 to i do
if Lowercase(oFightMode) = strs[x][y] then
begin
b := cmbBoxes[x];
r := x + 1;
Break;
end;
if b.x1 <> 0 then Break;
end;
end;
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;
if (not Result) and (r = 4) then
SetFightMode(3);
end;

Narcle

2009-06-02 01:51:24

Only problem I don't like with that function is it uses high trust that all weapons have that setup (att, str, con, def) when they don't. Good thing its Boolean now tho.

ZephyrsFury

2009-06-02 05:46:06

From: Narcle
Only problem I don't like with that function is it uses high trust that all weapons have that setup (att, str, con, def) when they don't. Good thing its Boolean now tho.


You can always go back to using integers if strings don't suit its purpose.

Nava2

2009-06-02 05:49:39

Hmm, I think I might just remove this..

All it should do is just pick the color, a variant is useless and inaccurate.

We ahve SetCombatType for this..

Redundant, yes?

noidea

2009-06-02 06:15:09

The old one had a fail safe for Range, and weapons with only 3 options.

Nava2

2009-06-02 06:19:35

From: noidea
The old one had a fail safe for Range, and weapons with only 3 options.


I think I'm going to revert tbh.

Narcle

2009-06-02 06:53:56

Well I'm going to figure something out for this. I know I had a nice one that u put in SRL I've heard some problems with it but maybe thats just me. I want to get a fool proof one somehow.

Da 0wner

2009-06-02 07:55:25

Can you not use the the I made Nava2?

Nava2

2009-06-02 16:25:16

From: Narcle
Well I'm going to figure something out for this. I know I had a nice one that u put in SRL I've heard some problems with it but maybe thats just me. I want to get a fool proof one somehow.


We should create a function that will I identify the layout, then just use that to create the boxes.

Narcle

2009-06-03 02:47:24

From: Nava2
We should create a function that will I identify the layout, then just use that to create the boxes.


That's what I was thinking. I haven't logged into RS in awhile but once I do I'll look and maybe figure it out.