Wizkid
2011-07-29 13:43:22
2 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
A guy at RSBuddy
What is your general programming knowledge?
Delphi
Are you a member of any other communities?
RsBuddy
Powerbot
Tell us about yourself…
From: Wizkid
Back again!
I took a week straight working on this, and a shitload of diet coke. I have to say color is way more complicated then Reflection, and it took a hell off a lot more time.
I did my very best on this script, really tried to cover every aspect..
Any questions are welcomed!
I would recommend not using this script, as all the bugs are not solved. However I'm sick of working on it after 5 hours straight today so it'll have to do for now :(
Please show us one (or multiple) of your scripts.
[simba]
program New;
{.include SRL/SRL/Misc/SMART.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Fighting.scar}
{.include SRL/SRL/Skill/Magic.scar}
Type
Monster = Record
Colors: TIntegerArray;
Tolerance: TIntegerArray;
UpTexts: TStringArray;
end;
PickUp = Record
Colors: TIntegerArray;
Tolerance: TIntegerArray;
Names: TStringArray;
end;
Progress = Record
PickUped: Integer;
Attacks: Integer;
Slept: Integer;
end;
var
Monsters: Array of Monster;
PickUps: Array of PickUp;
ProgressPlayer: Array of Progress;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
SetArrayLength(Monsters, HowManyPlayers);
SetArrayLength(PickUps, HowManyPlayers);
Players[0].Name := 'rockzsoxz';
Players[0].Pass := 'brownies';
Players[0].Nick := 'kil';
Players[0].Active := True;
Players[0].Integers[0] := 60; {% when it will try to eat.}
//Players[0].Integers[4] // Arrows / Main runes left
Players[0].Strings[0] := 'strength'; {attack, strength, defence, magic, range}
Players[0].Strings[1] := '';
Players[0].Strings[2] := 's'; // run dir
Players[0].Booleans[0] := True; // Change fightmode?
Players[0].Booleans[1] := False; // Use Special attack?
Monsters[0].Colors := [4540232];
Monsters[0].Tolerance := [4];
Monsters[0].UpTexts := ['Giant rat'];
PickUps[0].Colors := [4540232];
PickUps[0].Tolerance := [4];
PickUps[0].Names := ['Raw rat meat'];
SetArrayLength(ProgressPlayer, HowManyPlayers);
end;
Const
Server = 50;
Members = True;
Signed = True;
DebugLevel = 0; {0 = None | 1 = Small | 2 = Medium | 3 = Big}
Vers = '0.1';
Var
BlackBox: TBoxArray;
C_PickUp: PickUp;
ArrowCol, ReportTime, BreakTime, CheckTime: Integer;
C_Supply: Boolean;
Inv_BlackList: TBooleanArray;
Procedure NDebug(S: String; Lvl_Warn: Integer);
begin
If DebugLevel >= Lvl_Warn then
Writeln(S);
end;
Procedure CorrectStrings;
var
I, II: Integer;
begin
NDebug('CorrectStrings @ Start', 2);
For I:=0 to HowManyPlayers-1 do
begin
If Not InStrArr(Players[CurrentPlayer].Strings[0],
['attack', 'strength', 'defence', 'range', 'magic'], False)then
begin
Writeln('WARNING* - Please setup your players correctly.');
TerminateScript;
end;
For II:=0 to High(Monsters[I].UpTexts)do
Monsters[I].UpTexts[II] := 'tack ' + Monsters[I].UpTexts[II];
For II:=0 to High(PickUps[I].Names)do
PickUps[I].Names[II] := 'ake ' + PickUps[I].Names[II];
end;
end;
function ArrowAmount: Integer;
begin
GameTab(tab_Equip);
Wait(150+Random(100));
Result := GetAmount(673, 249);
end;
Function GetArrowColor: Integer;
begin
GameTab(Tab_Equip);
Wait(300+Random(200));
Result := GetColor(682, 271);
end;
Function SpellAmount: Integer;
begin
GameTab(Tab_Inv);
Wait(100+Random(200));
Result := GetAmount(572, 218);
end;
Procedure AmountLeft;
begin
Case LowerCase(Players[CurrentPlayer].Strings[0])of
'range':
begin
Players[CurrentPlayer].Integers[4] := ArrowAmount;
ArrowCol := GetArrowColor;
end;
'magic': Players[CurrentPlayer].Integers[4] := SpellAmount;
end;
end;
Procedure EquipArrows;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, H, InvSpot: Integer;
InvPoint: TPoint;
begin
GameTab(Tab_Inv);
Wait(160+Random(100));
FindColorsTolerance(TPA, ArrowCol, MIX1, MIY1, MIX2, MIY2, 0);
ATPA := TPAToATPAEx(TPA, 10, 10);
H := High(ATPA);
For I:=0 To H do
begin
InvPoint := MiddleTPA(ATPA[I]);
InvSpot := CoordsToItem(InvPoint.X, InvPoint.Y);
If Inv_BlackList[InvSpot-1] then Continue;
MMouseItem(InvSpot);
If WaitUpText('eld ' + Players[CurrentPlayer].Strings[1], 150+Random(100))then
begin
GetMousePos(InvPoint.X, InvPoint.Y);
Mouse(InvPoint.X, InvPoint.Y, 0, 0, True);
Exit;
end else Inv_BlackList[InvSpot-1] := True;
end;
end;
Function CountSpecial: Integer;
var
Spec : array [1..2] of TPoint;
i, x, y : Integer;
begin
If Not GameTab(1)Then Exit;
Spec[1] := Point(602, 417);
Spec[2] := Point(619, 426);
For i:=1 to 4 do
begin
If FindColorTolerance(x, y, 4294720, Spec[1].X, Spec[1].Y, Spec[2].X, Spec[2].Y, 10)then
begin
Result := Result + 25;
Spec[1] := Point(Spec[1].X + 28, Spec[1].Y);
Spec[2] := Point(Spec[2].X + 28, Spec[2].Y);
end else Exit;
end;
end;
Function UseSpecial(PowerNeed: Integer):Boolean;
begin
If Not Players[CurrentPlayer].Booleans[1] then
Exit;
If CountSpecial >= PowerNeed then
begin
MouseBox(574, 417, 710, 426, 1);
Result := True;
end;
end;
Function n_InFight(AreaSize: Integer): Boolean;
var
X, Y: Integer;
begin
Result := (FindColor(x, y, 10496, MSCX-12*AreaSize, MSCY-40*AreaSize, MSCX+12*AreaSize, MSCY))or
(FindColor(x, y, 198716, MSCX-12*AreaSize, MSCY-40*AreaSize, MSCX+12*AreaSize, MSCY));
end;
Procedure FightMode;
begin
If Not Players[CurrentPlayer].Booleans[0] then
Exit;
Case LowerCase(Players[CurrentPlayer].Strings[0]) of
'attack': SetFightMode(1);
'strength': SetFightMode(2);
'defence': SetFightMode(4);
'range': SetFightMode(2);
'magic': If Not Cast(Players[CurrentPlayer].Strings[1], True)then
begin
Writeln('** Failed setting up player ' + Players[CurrentPlayer].Name + ' **');
Logout;
Exit;
end;
end;
end;
function Randoms: Boolean;
begin
Result := FindNormalRandoms;
end;
Procedure AntiBan;
begin
Case Random(400)of
0: HoverSkill(Players[CurrentPlayer].Strings[0], False);
1: HoverSkill('defence', False);
2: HoverSkill('hp', False);
4: GameTab(RandomRange(tab_Combat, tab_Notes));
5..6: SleepAndMoveMouse(600+Random(2400));
7: SetAngle(True);
8..10: MakeCompass(Random(360));
9, 10, 13: RandomMovement;
14..15: Wait(2000+Random(4000));
16..21: UseSpecial(100);
end
end;
Function FindFreeMonsterMM(var x, y: Integer; Kind: String; Colors, Tol: TIntegerArray; UpText: TStringArray; Width, Height: Integer): boolean;
var
ATPA: T2DPointArray;
TPA, TPA2, TPA3: TPointArray;
I, II, H, HH, ArrC, lx, ly: Integer;
B: Boolean;
begin
Result := False;
SetLength(ATPA, Length(Colors));
H := High(Colors);
For I:= 0 to H do
FindColorsTolerance(ATPA[i], Colors[i], MSX1, MSY1, MSX2, MSY2, Tol[i]);
TPA := MergeATPA(ATPA);
ATPA := TPAToATPAEx(TPA, Width, Height);
SetLength(TPA, GetArrayLength(ATPA));
H := High(TPA)
for i:= 0 to H do
TPA[i] := MiddleTPA(ATPA[i]);
TPA2 := GetMiniMapDots(Kind);
H := High(TPA2);
For I:=0 to H do
TPA2[i] := MMToMS(TPA2[i]);
H := High(TPA);
HH := High(TPA2);
SetArrayLength(TPA3, GetArrayLength(TPA));
For I:=0 to H do
For II:=0 to HH do
If IntInBox(TPA[i].X, TPA[i].Y, IntToBox(TPA2[II].X-55, TPA2[II].Y-55, TPA2[II].X+55, TPA2[II].Y+55))then
begin
TPA3[ArrC] := TPA[i];
Inc(ArrC);
Break;
end;
SetArrayLength(TPA3, ArrC);
TPA := CombineTPA(TPA3, TPA);
HH := High(BlackBox);
For I:=0 to H do
begin
B := False;
If FindColor(lx, ly, 10496, TPA[I].X-15, TPA[I].Y-50, TPA[I].X+15, TPA[I].Y)or
FindColor(lx, ly, 198716, TPA[I].X-15, TPA[I].Y-50, TPA[I].X+15, TPA[I].Y) then Continue;
If (HH > 0) then
For II:=0 to HH do
begin
B := IntInBox(TPA[I].X, TPA[I].Y, BlackBox[II]);
If B then Break;
end;
If B then Continue;
MMouse(TPA[i].X, TPA[i].Y, 4, 4);
If WaitUptextMulti(UpText, 250+Random(100))then
begin
GetMousePos(X, Y);
Result := True;
Break;
end;
end;
SetArrayLength(BlackBox, H+1);
For I:=0 to H do
BlackBox[I] := IntToBox(TPA[I].X-5, TPA[I].Y-5, TPA[I].X+5, TPA[I].Y+5);
end;
Function FindMonsters: Boolean;
var
X, Y: Integer;
begin
Result := False;
If Not LoggedIn then Exit;
Result := FindFreeMonsterMM(x, y, 'npc', Monsters[CurrentPlayer].Colors,
Monsters[CurrentPlayer].Tolerance,
Monsters[CurrentPlayer].UpTexts,
10, 10);
If Not Result then
Exit;
Case Random(5)of
0:
Begin
Result := IsUpTextMultiCustom(Monsters[CurrentPlayer].UpTexts);
Mouse(X, Y, 0, 0, True);
end;
1..4:
begin
Mouse(X, Y, 0, 0, False);
Result := WaitOption('ttack', 120+Random(100));
end;
end;
If Result then
begin
Inc(ProgressPlayer[CurrentPlayer].Attacks);
Wait(400+Random(300));
Flag;
end;
end;
Function PickUpItem: Boolean;
var
iTime, X, Y: Integer;
begin
Result := False;
If Not LoggedIn then Exit;
iTime := GetSystemTime + 6000+Random(1500);
Repeat
Result := FindObjThroughMM(x, y, 'item', PickUps[CurrentPlayer].Colors,
PickUps[CurrentPlayer].Tolerance,
['Take'],
10, 10);
If Result then
begin
If IsUpTextMultiCustom(PickUps[CurrentPlayer].Names) then
Mouse(X, Y, 0, 0, True)
else
begin
Mouse(X, Y, 0, 0, False);
If Not ChooseOptionMulti(PickUps[CurrentPlayer].Names)then
Exit;
end;
Wait(500+Random(400));
Flag;
Wait(800+Random(400));
Inc(ProgressPlayer[CurrentPlayer].PickUped);
end;
AntiBan;
Until(Not Result)or(GetSystemTime > iTime);
end;
Function LowHP: Boolean;
begin
Result := (Players[CurrentPlayer].Integers[0] > HPPercent);
end;
Function EatFood: Boolean;
var
I, X, Y: Integer;
begin
Result := False;
If Not LoggedIn Then Exit;
For I:=1 to 28 do
If Not Inv_BlackList[I-1] then
If ExistsItem(I)then
begin
MMouseItem(I);
Result := WaitUpText('Eat', 120+Random(100));
If Result then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Wait(700+Random(500));
Exit;
end else
If IsUpText('eld ' + Players[CurrentPlayer].Strings[1])and
(LowerCase(Players[CurrentPlayer].Strings[1]) = 'range')then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, True);
Wait(300+Random(200));
end else
Inv_BlackList[I] := True;
end;
If LowHP then
begin
Writeln('** Player: ' + Players[CurrentPlayer].Name + ' - got no food % low HP **');
RunAway(Players[CurrentPlayer].Strings[1], True, 2, 3000+Random(2000));
LogOut;
Writeln('** Player: ' + Players[CurrentPlayer].Name + ' - Is now InActive. **');
end;
end;
Procedure FightWait;
var
iTime, AZ: Integer;
begin
Wait(400+Random(500));
AZ := 2;
iTime := GetSystemTime + 40000;
NDebug('Going inside Fightloop', 2);
Repeat
Wait(250+Random(150));
If GetSystemTime-(iTime-40000) > 4000 Then
Az := 1;
Antiban;
If LowHP then
EatFood;
Randoms;
Until(Not n_InFight(AZ))or(GetSystemTime > iTime);
NDebug('Outside fightloop', 2);
end;
Procedure Fighting;
var
iTime, T: Integer;
begin
If Not LoggedIn Then Exit;
iTime := GetSystemTime + 120000+Random(10000);
While not FindMonsters do
begin
Randoms;
AntiBan;
If GetSystemTime > iTime then
begin
Writeln('*Warning* No monster find in 120 secs, nextplayer.');
Logout;
Exit;
end;
Wait(1000+Random(1000));
If T > 4 then
begin
MakeCompass(Random(361));
T := 0;
end;
end;
Wait(1400+Random(1000));
FightWait;
Wait(100+Random(200));
PickUpItem;
end;
Procedure SetPickUps;
var
H: Integer;
Begin
C_PickUp := PickUps[CurrentPlayer];
If LowerCase(Players[CurrentPlayer].Strings[0]) = 'range' then
begin
H := High(C_PickUp.Colors);
SetArrayLength(C_PickUp.Colors, H+1);
SetArrayLength(C_PickUp.Tolerance, H+1);
C_PickUp.Colors[H] := GetArrowColor;
C_PickUp.Tolerance[H] := 1;
H := High(C_PickUp.Names);
SetArrayLength(C_PickUp.Names, H+1);
C_PickUp.Names[H] := 'ake ' + Players[0].Strings[1];
end;
end;
Procedure SetBreakTime;
begin
If PlayersActive > 1 then
BreakTime := 60000*RandomRange(25, 80)
else
BreakTime := 60000*RandomRange(45, 120);
Writeln('Will break in ' + MSToTime(BreakTime, 1));
BreakTime := GetSystemTime + BreakTime;
end;
Procedure NewPlayer;
Var
I: Integer;
begin
SetBreakTime;
C_Supply := (LowerCase(Players[CurrentPlayer].Strings[0]) = 'range')or
(LowerCase(Players[CurrentPlayer].Strings[0]) = 'magic');
For I:=0 to 27 do
Inv_BlackList[I] := False;
SetAngle(True);
Case Random(3)of
0: MakeCompass(Random(361));
end;
FightMode;
Retaliate(True);
SetPickUps;
AmountLeft;
end;
Procedure Report;
var
Total, I: Integer;
begin
Writeln('[-] -> [ GlobalEraser ] <- [-]');
Writeln('[ By Wizkid! ]');
Writeln('[--------------------------------------------]');
Writeln('[-] -> RunTime: ' + Padr(MSToTime(GetTimeRunning, 1) + ' ', 24) + '<- [-]');
For I:=0 to HowManyPlayers-1 do
IncEx(Total, ProgressPlayer[I].PickUped);
Writeln('[-] -> Total Pickups: ' + Padr(IntToStr(Total) + ' ', 18) + '<- [-]');
Total := 0;
For I:=0 to HowManyPlayers-1 do
IncEx(Total, ProgressPlayer[I].Attacks);
Writeln('[-] -> Total Attacks: ' + Padr(IntToStr(Total) + ' ', 18) + '<- [-]');
end;
Procedure TimeForBreak;
var
BreakFor, H, M, S, T: Integer;
begin
If GetSystemTime > BreakTime then
If PlayersActive = 1 then
begin
BreakFor := RandomRange(0 * 60000, 25 * 60000)+Random(4000);
ConvertTime(BreakFor, H, M, S);
Report;
Logout;
Writeln('Break for: '+inttostr(M)+ 'm:' +inttostr(S)+ 's');
MarkTime(T);
Repeat
ConvertTime(BreakFor - TimeFromMark(T), H, M, S)
Disguise(inttostr(M)+ 'm:' +inttostr(S)+ 's Break');
wait(1000);
until (BreakFor < TimeFromMark(T))
NextPlayer(True);
NewPlayer;
SetBreakTime;
end else
If PlayersActive > 1 then
begin
NextPlayer(True);
NewPlayer;
SetBreakTime;
end;
end;
Procedure Checks;
begin
If Not LoggedIn then
Exit;
Case Random(3)of
0:
begin
FindNormalRandoms;
If Lowercase(Players[CurrentPlayer].Strings[0]) = 'range' then
EquipArrows;
end;
end;
If GetSystemTime > CheckTime then
If C_Supply then
begin
AmountLeft;
If Players[CurrentPlayer].Integers[4] < 100 then
begin
Logout;
Writeln('Player: ' + Players[CurrentPlayer].Name + ' | Logged. Reason: Low supply of runes/arrows');
Exit;
end;
CheckTime := GetSystemTime + Round((Players[CurrentPlayer].Integers[4] div 1000 )*60000);
end;
If GetSystemTime > ReportTime then
begin
Report;
ReportTime := GetSystemTime + 60000*2;
end;
TimeForBreak;
end;
begin
{$IFDEF SRL_SMART}
Smart_Server := Server;
Smart_Members := Members;
Smart_Signed := Signed;
Smart_SuperDetail := False;
{$ENDIF}
ClearDebug;
ClearReport;
SetupSRL;
SetArrayLength(Inv_BlackList, 28);
ReportTime := GetSystemTime + 60000*2;
DeclarePlayers;
CorrectStrings;
LoginPlayer;
NewPlayer;
Repeat
If Not LoggedIn then
begin
NextPlayer(False);
NewPlayer;
end;
Checks;
Fighting;
Until(AllPlayersInActive);
end.