SRL Archive - SRL Archives

Set Style / Fix Style


neG

2007-11-13 06:39:04

I know it has been done before in various fighter scripts, but I thought I would post mine here :)

Set Style =

procedure SetStyle(Style :string);
var tx,ty:Integer;
begin
if not LoggedIn then Exit;
if Style = 'att' then
begin
GameTab(1);
WriteLn('Setting style Accurate');
if not FindColor(tx,ty,1908609,576,259,627,285) then
Mouse(605,272,10,10,True);
end;
if Style = 'str' then
begin
GameTab(1);
WriteLn('Setting style Aggressive');
if not FindColor(tx,ty,1974408,661,261,710,284) then
Mouse(686,272,10,10,True);
end;
if Style = 'def' then
begin
GameTab(1);
WriteLn('Setting style Defensive');
if not FindColor(tx,ty,2106257,660,313,708,337) then
Mouse(686,326,10,10,True);
end;
end;


Now you can make it automatic by setting TargetLevels constants in your script.

procedure FixStyle;
var CAtt,CStr,CDef:Integer;
begin
if not LoggedIn then Exit;
begin
CAtt := GetSkillLevel('attack');
CStr := GetSkillLevel('strength');
CDef := GetSkillLevel('defence');
if TargetAttack > CAtt then
begin
WriteLn('Attack below target level.');
SetStyle('att');
Exit;
end;
if TargetStrength > CStr then
begin
WriteLn('Strength below target level.');
SetStyle('str');
Exit;
end;
if TargetDefence > CDef then
begin
WriteLn('Defence below target level.');
SetStyle('def');
Exit;
end;
end;
end;

For proper use..

program New;
{.include SRL/SRL.scar}
const
TargetAttack = 60;
TargetStrength = 99;
TargetDefence = 10;

procedure SetStyle(Style :string);
var tx,ty:Integer;
begin
if not LoggedIn then Exit;
if Style = 'att' then
begin
GameTab(1);
WriteLn('Setting style Accurate');
if not FindColor(tx,ty,1908609,576,259,627,285) then
Mouse(605,272,10,10,True);
end;
if Style = 'str' then
begin
GameTab(1);
WriteLn('Setting style Aggressive');
if not FindColor(tx,ty,1974408,661,261,710,284) then
Mouse(686,272,10,10,True);
end;
if Style = 'def' then
begin
GameTab(1);
WriteLn('Setting style Defensive');
if not FindColor(tx,ty,2106257,660,313,708,337) then
Mouse(686,326,10,10,True);
end;
end;

procedure FixStyle;
var CAtt,CStr,CDef:Integer;
begin
if not LoggedIn then Exit;
begin
CAtt := GetSkillLevel('attack');
CStr := GetSkillLevel('strength');
CDef := GetSkillLevel('defence');
if TargetAttack > CAtt then
begin
WriteLn('Attack below target level.');
SetStyle('att');
Exit;
end;
if TargetStrength > CStr then
begin
WriteLn('Strength below target level.');
SetStyle('str');
Exit;
end;
if TargetDefence > CDef then
begin
WriteLn('Defence below target level.');
SetStyle('def');
Exit;
end;
end;
end;


begin
SetupSRL;
ActivateClient
begin
FixStyle;
end;
end.

Special Ed

2007-11-14 16:09:15

The only thing is that it will always train your attack first until it gets to what you set it to rather than training the others. Maybe you should make it so that it trains the one that needs the most attention, meaning that it is the farthest away from you "Target", or you could make it user set.

Also If you want (I personally would) use a "case" statement rather than having if..then…if…then.

Other than that its good, I don't think it will miss but I guess I'll test it out for you, shouldn't take long XD.

EDIT: I realized you should probably only have GameTab(1) just right before the if…then's and at the bottom of the procedure or somewhere have if(Style = '')then Writeln('Choose a Style!'); or something. I tested it and it worked good though, I put 'atk' instead of 'att' thats why I thought of having a writeln.

Santa_Clause

2007-11-15 03:13:13

procedure SetStyle(Style :string);
var tx,ty:Integer;
begin
if not LoggedIn then Exit;
if (Style <> 'att') and (Style <> 'str') and (Style <> 'def') then
begin
WriteLn('Invalid Style');
Exit;
end;
if Style = 'att' then
begin
GameTab(1);
WriteLn('Setting style Accurate');
if not FindColor(tx,ty,1908609,576,259,627,285) then
Mouse(605,272,10,10,True);
end;
if Style = 'str' then
begin
GameTab(1);
WriteLn('Setting style Aggressive');
if not FindColor(tx,ty,1974408,661,261,710,284) then
Mouse(686,272,10,10,True);
end;
if Style = 'def' then
begin
GameTab(1);
WriteLn('Setting style Defensive');
if not FindColor(tx,ty,2106257,660,313,708,337) then
Mouse(686,326,10,10,True);
end;
end;

R0b0t1

2007-11-16 17:05:49

Multiple If's == Case;