SCAR Code:
program New;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/fighting.scar}
{.include srl/srl/misc/users.scar}
{
What this script does is fights EITHER goblins , OR minatours in the first floor
of stronghold of security. This script is all color and has a very sexy form.
Theres only 1 spot where you can both fight goblins and minatours
If you want to use multiplayer make sure you check SLEEP. Or else it will never do
nextplayer(true);
Credits:
TARAJUNKY for the idea of the smart color array thing and Snippets of his code.
Method for help when i was stuck.
}
const
Version = '.9';
//////////////////////////DONT TOUCH////////////////////////////////////////////
MinatourColor = 10924722;
MinatourColor1 = 10990515;
MinatourColor2 = 11450553;
GoblinColor = 8753040;
var
frmDesign : TForm;
Label1 : TLabel;
Label2 : TLabel;
Label3 : TLabel;
Label4 : TLabel;
Label5 : TLabel;
Label6 : TLabel;
Label7 : TLabel;
Label8 : TLabel;
MSpeed : TEdit;
CheckBox1 : TCheckBox;
CheckBox2 : TCheckBox;
CheckBox3 : TCheckBox;
HP : TEdit;
CheckBox4 : TCheckBox;
CheckBox5 : TCheckBox;
Edit1 : TEdit;
Edit2 : TEdit;
Button1 : TButton;
Var
Minatours, Goblins, attack,strength,defence : Boolean;
Var
PlayerStart,Start:Integer;
H,M,S:integer;
PH,PM,PS:integer;
var lol:integer;
var
Slept,startxp,killz:integer;
Acolors: Array of Integer;
procedure antibannage;
begin
if not loggedin then exit;
Case random(60) of
0..3: SleepAndMoveMouse(7000);
4..7: MMouse(Random(500),Random(500),0,0);
8..11:GameTab(1+random(12));
12: SetRun(true);
13:RandomRClick;
14:begin
setangle(false);
wait(400+random(400));
setangle(true);
end;
end;
end;
procedure switchp(stay:boolean);
begin
case stay of
true: begin
nextplayer(true);
marktime(playerstart);
end;
false:begin
nextplayer(false);
marktime(playerstart);
end;
end;
end;
Procedure SetPlayers(sender: TObject);
begin
Writeln('Setting players up!');
frmDesign.ModalResult:= mrOk;
SRLPlayerForm(True,[],[],['Bank pin','Combat Style[Att,Str,Def](Doesnt use this if you selected preset styles before)'],[]);
end;
Procedure Showstuff(sender: TObject);
begin
Writeln('Changed HP!');
If HP.Visible = false then
begin
Hp.Visible := true;
If Label4.Visible = false then
Label4.Visible := true;
exit;
end;
If Hp.visible = true then
begin
hp.visible := false;
if label4.visible = true then
label4.visible :=false;
end;
end;
Procedure showstuff1(sender:tobject);
var b,c:boolean;
begin
Writeln('Changed Sleeps!');
b:=false;
c:=false;
If edit2.Visible = false then
begin
edit2.Visible := true;
If Label8.Visible = false then
Label8.Visible := true;
b := true;
end;
if not b then
begin
If edit2.visible = true then
begin
edit2.visible := false;
if label8.visible = true then
label8.visible :=false;
end;
end;
If edit1.Visible = false then
begin
edit1.Visible := true;
If Label7.Visible = false then
Label7.Visible := true;
c:=true;
end;
if not c then
begin
If edit1.visible = true then
begin
edit1.visible := false;
if label7.visible = true then
label7.visible :=false;
end;
end;
end;
Procedure InItForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 1038;
frmDesign.Top := 254;
frmDesign.Width := 220;
frmDesign.Height := 307;
frmDesign.Caption := 'Cnr sport';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 72;
Label1.Top := 16;
Label1.Width := 68;
Label1.Height := 13;
Label1.Caption := 'Kill Minatours?';
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 72;
Label2.Top := 48;
Label2.Width := 57;
Label2.Height := 13;
Label2.Caption := 'Kill Goblins?';
Label3 := TLabel.Create(frmDesign);
Label3.Parent := frmDesign;
Label3.Left := 72;
Label3.Top := 80;
Label3.Width := 115;
Label3.Height := 13;
Label3.Caption := 'Log out When Low HP?';
Label4 := TLabel.Create(frmDesign);
Label4.Parent := frmDesign;
Label4.Left := 72;
Label4.Top := 104;
Label4.Width := 84;
Label4.Height := 13;
Label4.Caption := 'HP Percent To log out at?';
Label4.Visible := False;
Label5 := TLabel.Create(frmDesign);
Label5.Parent := frmDesign;
Label5.Left := 72;
Label5.Top := 128;
Label5.Width := 106;
Label5.Height := 13;
Label5.Caption := 'Preset Combat Styles?';
Label6 := TLabel.Create(frmDesign);
Label6.Parent := frmDesign;
Label6.Left := 72;
Label6.Top := 152;
Label6.Width := 66;
Label6.Height := 13;
Label6.Caption := 'Take Sleeps?';
Label7 := TLabel.Create(frmDesign);
Label7.Parent := frmDesign;
Label7.Left := 88;
Label7.Top := 176;
Label7.Width := 81;
Label7.Height := 13;
Label7.Caption := 'How often[Min]';
Label7.Visible := False;
Label8 := TLabel.Create(frmDesign);
Label8.Parent := frmDesign;
Label8.Left := 88;
Label8.Top := 208;
Label8.Width := 72;
Label8.Height := 13;
Label8.Caption := 'How Long[Min]';
Label8.Visible := False;
MSpeed := TEdit.Create(frmDesign);
MSpeed.Parent := frmDesign;
MSpeed.Left := 8;
MSpeed.Top := 240;
MSpeed.Width := 81;
MSpeed.Height := 21;
MSpeed.TabOrder := 8;
MSpeed.Text := 'Mouse Speed';
CheckBox1 := TCheckBox.Create(frmDesign);
CheckBox1.Parent := frmDesign;
CheckBox1.Left := 40;
CheckBox1.Top := 16;
CheckBox1.Width := 17;
CheckBox1.Height := 17;
CheckBox1.Caption := 'CheckBox1';
CheckBox1.TabOrder := 9;
CheckBox2 := TCheckBox.Create(frmDesign);
CheckBox2.Parent := frmDesign;
CheckBox2.Left := 40;
CheckBox2.Top := 48;
CheckBox2.Width := 17;
CheckBox2.Height := 17;
CheckBox2.Caption := 'CheckBox2';
CheckBox2.TabOrder := 10;
CheckBox3 := TCheckBox.Create(frmDesign);
CheckBox3.Parent := frmDesign;
CheckBox3.Left := 40;
CheckBox3.Top := 80;
CheckBox3.Width := 17;
CheckBox3.Height := 17;
CheckBox3.Caption := 'CheckBox3';
CheckBox3.TabOrder := 11;
Checkbox3.OnClick := @Showstuff;
HP := TEdit.Create(frmDesign);
HP.Parent := frmDesign;
HP.Left := 40;
HP.Top := 104;
HP.Width := 25;
HP.Height := 21;
HP.TabOrder := 12;
HP.Text := 'HP';
HP.Visible := False;
CheckBox4 := TCheckBox.Create(frmDesign);
CheckBox4.Parent := frmDesign;
CheckBox4.Left := 40;
CheckBox4.Top := 128;
CheckBox4.Width := 17;
CheckBox4.Height := 17;
CheckBox4.Caption := 'CheckBox4';
CheckBox4.TabOrder := 13;
CheckBox5 := TCheckBox.Create(frmDesign);
CheckBox5.Parent := frmDesign;
CheckBox5.Left := 40;
CheckBox5.Top := 152;
CheckBox5.Width := 17;
CheckBox5.Height := 17;
CheckBox5.Caption := 'CheckBox5';
CheckBox5.TabOrder := 14;
Checkbox5.OnClick := @showstuff1;
Edit1 := TEdit.Create(frmDesign);
Edit1.Parent := frmDesign;
Edit1.Left := 40;
Edit1.Top := 176;
Edit1.Width := 41;
Edit1.Height := 21;
Edit1.TabOrder := 15;
Edit1.Text := '20';
Edit1.Visible := False;
Edit2 := TEdit.Create(frmDesign);
Edit2.Parent := frmDesign;
Edit2.Left := 40;
Edit2.Top := 208;
Edit2.Width := 41;
Edit2.Height := 21;
Edit2.TabOrder := 16;
Edit2.Text := '11';
Edit2.Visible := False;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 104;
Button1.Top := 240;
Button1.Width := 81;
Button1.Height := 25;
Button1.Caption := 'Set up Players';
Button1.TabOrder := 17;
Button1.OnClick := @setPlayers;
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(v, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(v, 0);
ThreadSafeCall('ShowFormModal', v);
end;
function eat:boolean; forward;
procedure Check;
var i:integer;
begin
findnormalrandoms;
if checkbox3.checked then
begin
i := strtoint(hp.text);
if hpPercent < i + 1 then
begin
If not eat then
begin
writeln('low hp , logging');
logout;
//nextplayer(false);
end;
end;
end;
end;
function GetXps(skill: string): Integer;
var
p: TPoint;
i, tx, ty, x, y: Integer;
begin
Result := -1;
if (not LoggedIn) or (not TabExists(2)) then Exit;
GameTab(2);
if (GetCurrentTab <> 2) then Exit;
p := SkillToCoords(True,Skill);
if (p.x < 1) then Exit;
MMouse(p.x, p.y +5, 12, 4);
while (not FindColor(x, y, 10551295, MIX1, MIY1, MIX2, MIY2)) and (i < 50) do
begin
Wait(100);
Inc(i);
end;
Wait(200 + Random(150));
if (not FindColor(x, y, 10551295, MIX1, MIY1, MIX2, MIY2)) then Exit;
if IsTextInAreaEx(x, y, x + 60, y + 60, tx, ty, 'urrent', 0, SmallChars, False, False, 0, 1, 0) then
Result := StrToIntDef(GetNumbers(GetTextAtEx(tx, ty, 0, SmallChars, False, True, 0, 1, 0, 50, False, tr_AllChars)), -1);
wait(1222+random(1222));
end;
Procedure GetTime;
begin
ConvertTime(GetTimeRunning,H,M,S);
//Writeln('H:'+inttostr(H)+' M:'+Inttostr(m)+' S:'+inttostr(s)+'');
ConvertTime(Playerstart,PH,PM,PS);
//Writeln('PH:'+inttostr(pH)+' PM:'+Inttostr(pm)+' PS:'+inttostr(Ps)+'');
end;
Function GetNPCPlace(Box: TBox): Tpoint;
Var
//i: integer;
npcs: TpointArray;
splitnpcs: T2dPointArray;
begin
findColorsTolerance(npcs,62965,Box.x1,Box.y1,Box.x2,Box.y2,5);
if length(npcs) > 1 then
begin
Splitnpcs := TPAtoATPAEx(npcs,20,20);
SortATPAsize(SplitNpcs,true);
result := MiddleTPA(SplitNpcs[0]);
writeln('length npc '+inttostr(length(npcs))+'');
end;
end;
Function Calibrate: Boolean;
var tb: tbox;
tp , mp: tpoint;
begin
if not loggedin then exit;
writeln('attempted calibrated');
tb.x1 := mmx1;
tb.x2 := mmx2;
tb.y1 := mmy1;
tb.y2 := mmy2;
tp := GetNPCPLace(tb);
if not(findcolor(mp.x,mp.y,235,tp.x - 6,tp.y - 6,tp.x + 6,tp.y + 6)) then
begin
if not(Distance(tp.x,tp.y,mmcx,mmcy) > 25) then
begin
mouse(tp.x,tp.y,3,3,true);
flag;
writeln('calibrated using npc');
result:=true;
exit;
end;
end;
end;
procedure proggy; forward;
Function SleepNSwitch:Boolean;
var I,t,k:integer;
Switch:boolean;
begin
GetTime;
if not loggedin then exit;
proggy;
I := StrToInt(Edit1.Text);
If I < 60 then
begin
if (M > PM + I) then
begin
switch := true;
end;
end;
If I > 59 then
begin
If H > PH then
begin
switch := true;
end;
end;
If Switch then
begin
Logout;
T := StrToInt(Edit2.Text);
K := (t * 60000 + random(180000))
writeln('Breaking - Logging in '+inttostr(k)+' MS');
Wait(t * 60000 + random(180000))
Switchp(True);
result:=true;
exit;
end;
//Writeln('Didnt Sleep');
Result:=false;
end;
procedure setupscript;
begin
Minatours := false;
goblins := false;
mousespeed := Strtoint(Mspeed.text) + random(3) - random(3);
writeln('Mouse speed chosen was '+mspeed.text+' but when randomized it was '+inttostr(mousespeed)+'');
If checkBox1.Checked then
minatours := true;
If checkbox2.Checked then
goblins := true;
If not minatours then
if not goblins then
begin
writeln('Please select either to kill goblins or minatours! Terminating Script');
terminatescript;
end;
If minatours then
AColors := [MinatourColor,MinatourColor1,MinatourColor2];
If goblins then
acolors := [goblincolor];
end;
procedure setupchar;
begin
If not loggedin then exit;
If not Checkbox4.Checked then
begin
case Players[CurrentPlayer].Strings[1] of
'Str','str':begin
setfightmode(2);
StartXP := GetXps('strength');
strength := true;
end;
'att','Att':begin
setfightmode(1);
startxp := Getxps('attack');
attack := true;
end;
'def','Def':begin
setfightmode(4);
startxp := getxps('defence');
defence := true;
end;
end;
end;
setrun(true);
end;
Function AttackMinatour: Boolean;
Var points: Tpointarray;
Minatour2d : T2DPointArray;
i,l,u,tol,a,newcolor,fs:integer;
tp:tpoint;
begin
IF GetarrayLength(AColors) = 1 then
Tol := 5;
If getarraylength(acolors) > 1 then
tol := 1;
u := (GetArrayLength(AColors));
for i:= 0 to (u-1) do
begin
FindColorsSpiralTolerance(Mscx,mscy,Points,AColors[i],MSx1,Msy1,Msx2,Msy2,Tol);
L:=GetArrayLength(Points);
if L < 1 then
begin
//writeln('Clearing Color array');
If Calibrate then
begin
writeln('We calibrated');
end;
If fs > 2 then
begin
writeln('Clearing Color array');
setarraylength(acolors, 1);
AColors := [MinatourColor2];
fs := 0;
end;
inc(fs);
result:=false;
exit;
end;
If L > 0 then
if l > 65 then
begin
writeln('Clearing Color array too many found');
setarraylength(acolors, 1);
AColors := [MinatourColor2];
result:=false;
exit;
end;
Minatour2D := TPAToATPAEx(Points, 10, 10);
for I := 0 to Length(Minatour2D)-1 do
begin
tp := MiddleTPA(Minatour2D[I]);
wait(10);
MMouse(tp.x- 2,tp.y + 5,2,2);
wait(randomrange(60,90)) ;
If Isuptext('inot') or
(isuptext('oblin')) then
begin
Mouse(tp.x,tp.y,0,0,true);
NewColor := GetColor(tp.x,tp.y);
//writeln('Attacked the fat goblin');
inc(killz);
result:=true;
fs := 0;
if u<5 then
begin
if u>0 then
begin
for a:= 0 to u-1 do
begin
if NewColor=AColors[a] then
begin
writeln('same color');
Exit;
end;
end;
If SimilarColors(NewColor, MinatourColor2, 9) then
begin
SetArrayLength(AColors,U+1);
AColors[u]:=NewColor;
writeln('Addded '+Inttostr(Newcolor)+' to the color array');
Writeln('length of our array is now = '+inttostr(u)+'');
end;
end;
if u > 7 then
begin
writeln('too many colors - cleared');
setarraylength(acolors, 1);
AColors := [Minatourcolor2];
end;
end;
exit;
end;
end;
end;
end;
Function AttackGoblin: Boolean;
Var points: Tpointarray;
Minatour2d : T2DPointArray;
i,l,u,tol,a,newcolor,fs:integer;
tp:tpoint;
begin
IF GetarrayLength(AColors) = 1 then
Tol := 4;
If getarraylength(acolors) > 1 then
tol := 1;
u := (GetArrayLength(AColors));
for i:= 0 to (u-1) do
begin
FindColorsSpiralTolerance(Mscx,mscy,Points,AColors[i],MSx1,Msy1,Msx2,Msy2,Tol);
L:=GetArrayLength(Points);
if L < 1 then
begin
//writeln('Clearing Color array');
If Calibrate then
begin
writeln('We calibrated');
end;
If fs > 2 then
begin
writeln('Clearing Color array');
setarraylength(acolors, 1);
AColors := [GoblinColor];
fs := 0;
end;
inc(fs);
result:=false;
exit;
end;
If L > 0 then
if l > 65 then
begin
writeln('Clearing Color array too many found');
setarraylength(acolors, 1);
AColors := [GoblinColor];
result:=false;
exit;
end;
Minatour2D := TPAToATPAEx(Points, 10, 10);
for I := 0 to Length(Minatour2D)-1 do
begin
tp := MiddleTPA(Minatour2D[I]);
wait(10);
MMouse(tp.x- 2,tp.y + 5,2,2);
wait(randomrange(70,100)) ;
If Isuptext('oblin') or
(isuptext('inot')) then
begin
Mouse(tp.x,tp.y,0,0,true);
NewColor := GetColor(tp.x,tp.y);
//writeln('Attacked the fat goblin');
inc(killz);
result:=true;
fs := 0;
if u<5 then
begin
if u>0 then
begin
for a:= 0 to u-1 do
begin
if NewColor=AColors[a] then
begin
writeln('same color');
Exit;
end;
end;
If SimilarColors(NewColor, GoblinColor, 9) then
begin
SetArrayLength(AColors,U+1);
AColors[u]:=NewColor;
writeln('Addded '+Inttostr(Newcolor)+' to the color array');
Writeln('length of our array is now = '+inttostr(u)+'');
end;
end;
if u > 7 then
begin
writeln('too many colors - cleared');
setarraylength(acolors, 1);
AColors := [GoblinColor];
end;
end;
exit;
end;
end;
end;
end;
function Eat:boolean;
var x,y,i:integer;
begin
if not loggedin then exit;
SRL_LoadBitmapRange(76,85);
for i:=0 to 27 do
begin
IF FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Meat), x, y) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Chicken), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Shrimps), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Anchovies), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Tuna), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Trout), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Pike), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Salmon), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Lobster), x, y)) Or
(FindBitmap(srl_GetBitmap(bmp_Food_Cooked_Swordfish), x, y)) then
begin
Mouse(x,y,1,1,true);
writeln('ate a food');
end;
If hpPercent > 75 then
begin
result:= true;
srl_freeBitmaps;
exit;
end;
end;
end;
Procedure proggy;
var a,b,c:integer;
begin
{if random(7) = 2 then
begin
if attack then
xpgained := getxps('attack');
if strength then
xpgained := getxps('strength');
if defence then
xpgained := getxps('defence');
end;
m := xpgained - startxp;
XPh := Round(((m) * 3600.0) / (GetTimeRunning / 1000.0));}
converttime(getsystemtime, a,b,c);
changereportwidth(475);
clearreport;
addtoreport('Minatour and Goblin Terminator version '+version+' by cnr sport');
addtoreport('-----------------------------------------------------------------------');
Addtoreport('The time is '+inttostr(a)+': '+inttostr(b)+'');
If goblins and minatours then
addtoreport('Monster type: Minatour and Goblins');
If Goblins then
addtoreport('Monster type: Goblins');
If minatours then
addtoreport('Monster type: Minatour');
addtoreport('Worked for '+TimeRunning+'');
addtoreport('Killed: '+Inttostr(Killz)+' monsters');
addtoreport('Slept / Switched players: '+inttostr(slept)+' times');
end;
var i:integer;
both:boolean;
begin
SafeInitForm;
SafeShowFormModal;
//freeform(frmdesign);
SmartSetupEx(125, False, False, False);
SetTargetDC(SmartGetDC);
SetupSRL;
SetupScript;
LoginPlayer;
setupchar;
PlayerStart := GetTimeRunning;
MarkTime(start);
if Minatours and goblins then both:=true;
Repeat
if not loggedin then SwitchP(false);
If SleepNSwitch then
begin
writeln('Slept!');
inc(slept);
end;
If Goblins then
begin
if attackgoblin then
begin
//writeln('Attacked gob, lets wait');
wait(4000+random(3000));
if both then
wait(4900+random(2000));
end;
end;
If Minatours then
begin
If AttackMinatour then
begin
//writeln('attacked , now waiting');
wait(5000+random(3000));
if both then
wait(4900+random(2000));
end;
end;
check
IF random(7) = 4 then antibannage;
inc(lol);
If Lol >( 8 + random(4)) then
begin
proggy;
Lol:=0;
writeln('Proggy');
For I := 0 to GetArrayLength(AColors) - 1 do
begin
writeln(Inttostr(Acolors[i]));
end;
end;
check;
until False
end.