SRL Archive - Research & Development Lounge

Need people with members accounts.


Richard

2009-05-16 13:31:20

If there is anyone out there that can test this to see how reliable it would be, it would be greatly appreciated. All it is is a special attack feature that presses the button when the green bar is filled to the amount you desire(in %).

{*******************************************************************************
Procedure SpecialAttack(MinPercent: Integer);
By: Richard
Description: Use the special attack button if it is present, and presses it if
the percent of the bar filled is >= MinPercent
*******************************************************************************}

Procedure SpecialAttack(MinPercent: Integer);
Var
g : Integer;
c : Extended;
Begin
GameTab(1);
If (GetColor(623,424) = 65535) then
Begin
WriteLN('Special attack is already active');
Exit;
end;
If (GetColor(623,424) <> 1048576) then
Begin
WriteLN('Current weapon doesn'#39't have a special attack');
Exit;
end;
g := (CountColorTolerance(3700023, 572, 417, 713, 428, 120));
c := ((g/1634)*100);
g := Round(c);
If (MinPercent <= g) then
MouseBox(570, 413, 714, 431, 1);
end;

Its very simple to call, just do SpecialAttack(100); if you want to bar 100% full.

Thanks

XabdullahX

2009-05-16 14:20:54

[StupidQuestion]How am i supposed to test this?[/StupidQuestion]

I tried including srl and setupsrl;

then i wrote at the end of file:

begin
SpecialAttack(100)
end;

Richard

2009-05-16 14:27:55

Just start with a player logged in, then paste that function in, like so:

{.include SRL\SRL.scar}

{*******************************************************************************
Procedure SpecialAttack(MinPercent: Integer);
By: Richard
Description: Use the special attack button if it is present, and presses it if
the percent of the bar filled is >= MinPercent
*******************************************************************************}

Procedure SpecialAttack(MinPercent: Integer);
Var
g : Integer;
c : Extended;
Begin
GameTab(1);
If (GetColor(623,424) = 65535) then
Begin
WriteLN('Special attack is already active');
Exit;
end;
If (GetColor(623,424) <> 1048576) then
Begin
WriteLN('Current weapon doesn'#39't have a special attack');
Exit;
end;
g := (CountColorTolerance(3700023, 572, 417, 713, 428, 120));
c := ((g/1634)*100);
g := Round(c);
If (MinPercent <= g) then
MouseBox(570, 413, 714, 431, 1);
end;

Begin
SetupSRL;
ActivateClient;
Wait(1000);
SpecialAttack(100);
end.

Make sure to capture the client,

Griff

2009-05-16 21:37:25

Works.

Dynamite

2009-05-16 21:38:33

Yeh just tried and works :)

T~M

ritchmister

2009-05-17 01:06:02

Same here :) seems to work good

Richard

2009-05-17 01:15:42

Good :), just checking as the colour changes as it goes across, so that I got the right tolerance, so the percentages work and all that.

Naum

2009-05-17 13:57:57

Maybe you could change all those variables into a line:

If MinPercent <= Round((((CountColorTolerance(3700023, 572, 417, 713, 428, 120))/1634)*100)) then

Nice, though :)

Richard

2009-05-17 16:38:31

From: NaumanAkhlaQ
Maybe you could change all those variables into a line:

If MinPercent <= Round((((CountColorTolerance(3700023, 572, 417, 713, 428, 120))/1634)*100)) then

Nice, though :)


Thanks, that actually shortened the whole procedure by 6 lines. Rep+

Thanks everyone for the testing.

DeSnob

2009-05-18 03:47:24

Works! This should be added to Srl as it is helpful when making an autofighter. :) Nice function!
~Des

Richard

2009-05-18 03:52:17

I'm making a few functions for fighting.scar, including changing weapon style (including spells for mage), auto retaliate on/off. Just a few small things to make it easier for newer scripters.