Ok my SRL/MSI/Reflection is acting wierd again, can't compile. Someone try if this compiles:- It used to sort from (MMCX, MMCY) but now from (MSCX, MSCY)
- A few other bugs
- MSI_FindObjectsTPA now takes these parameters
MSI_FindObjectsTPA(Var Objs: TPointArray; ObjInfo: TMSObject; SearchBox: TBox): Boolean;
Also all other object finders now take TBox instead of cordinates.Modified WC.scar to match the changes Next step: apply FindObjectRecord to MSI functions.Pfft, this will be a rather tough one. How should we proceed?
I've got an idea: Have all the MinH, MinS, MinL, MaxH, MaxS etc. properties in TMSObject. In the beginning of FindObjectsTPA, check if all these values are greater than 0. If so, use FindObjsRecord. Done, let's see if it works. Code below.
Objects.scar
{==============================================================================\
| MSI Group Scripting Include |
| Objects.scar |
|==============================================================================|
| Object and Item finding routines |
| |
| * function MSI_GetObject(): TMSObject; * by The MSI Team |
| * function MSI_GetObjects(): TMSObjectArray; * by marpis |
| * function MSI_ReturnPointsInBox(): TPointArray; * by marpis |
| * function MSI_FindObjectsTPA(): Boolean; * by marpis |
| * function MSI_FindObjectsIn(): Boolean; * by marpis |
| * function MSI_FindObjects(): Boolean; * by marpis |
| * function MSI_FindObjectIn(): Boolean; * by marpis |
| * function MSI_FindObject(): Boolean; * by marpis |
\_____________________________________________________________________________}
{******************************************************************************}
{ Function MSI_GetObject(Which: Integer): TMSObject; }
{ By: The MSI Team }
{ Date: 10 June 2010 }
{ Description: Load all the necessary object information }
{******************************************************************************}
Function MSI_GetObject(Which: Integer): TMSObject;
Begin
Case Which Of
OBJ_TREE_NORMAL: // marpis
With Result Do
Begin
Name := 'Normal tree';
UpText := 'Tree';
Option := 'Chop down';
Exp := 25;
Colors := [736046];
Tol := 5;
Hue := 1.54;
Sat := 5.00;
FindAllColors := False;
W := 25;
H := 25;
Accuracy := 5;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_TREE_OAK: // marpis
With Result Do
Begin
Name := 'Oak tree';
UpText := 'Oak';
Option := 'Chop down';
Colors := [736046];
Exp := 37.5;
Tol := 5;
Hue := 1.54;
Sat := 5.00;
FindAllColors := False;
W := 30;
H := 30;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_TREE_WILLOW: // Coh3n
With Result Do
Begin
Name := 'Willow tree';
UpText := 'llow';
Option := 'Chop down';
Colors := [4481105];
Exp := 67.5;
Tol := 14;
Hue := 0.18;
Sat := 0.28;
FindAllColors := False;
W := 30;
H := 30;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_TREE_MAPLE: // Coh3n
With Result Do
Begin
Name := 'Maple tree';
UpText := 'aple';
Option := 'Chop down';
Colors := [2440040];
Exp := 100;
Tol := 6;
Hue := 0.04;
Sat := 0.20;
FindAllColors := False;
W := 25;
H := 25;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_TREE_YEW: // Coh3n
With Result Do
Begin
Name := 'Yew tree';
UpText := 'ew';
Option := 'Chop down';
Colors := [4162165];
Exp := 175;
Tol := 14;
Hue := 0.01;
Sat := 0.76;
FindAllColors := False;
W := 35;
H := 35;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
{
OBJ_TREE_MAGIC: // Coh3n
With Result Do
Begin
Name := 'Magic tree';
UpText := 'agic';
Option := 'Chop down';
Colors := [11003627];
Exp := 250;
Tol := 11;
Hue := 0.03;
Sat := 2.39;
FindAllColors := False;
W := 30;
H := 30;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
}
OBJ_BANK_VE: // Coh3n
With Result Do
Begin
Name := 'Varrock east bank';
UpText := 'ooth';
Option := 'uick';
Colors := [2379871];
Tol := 5;
Hue := 0.06;
Sat := 1.61;
FindAllColors := False;
W := 40;
H := 40;
Accuracy := 50;
ExcludeSelf := True;
RightClickOnly := True;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_ROCK_IRON: // marpis
With Result Do
Begin
Name := 'Iron rock';
UpText := 'Mine';
Option := 'ine';
Colors := [2963025];
Tol := 3;
Hue := 0.17;
Sat := 1.16;
FindAllColors := False;
W := 5;
H := 5;
Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
End;
OBJ_ROCK_COPPER: // NCDS
with Result do
begin
Name := 'Copper';
UpText := 'ocks';
Option := 'ine';
Colors := [4088718];
Tol := 5;
Hue := 0.03;
Sat := 0.13;
FindAllColors := False;
W := 29;
H := 23;
Accuracy := 5;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
end;
OBJ_ROCK_TIN: // NCDS
with Result do
begin
Name := 'Tin';
UpText := 'ocks';
Option := 'ine';
Colors := [8882318];
Tol := 7;
Hue := 0.35;
Sat := 0.09;
FindAllColors := False;
W := 25;
H := 28;
Accuracy := 5;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
end;
OBJ_ROCK_IRON // NCDS
with Result do
begin
Name := 'Iron';
UpText := 'ocks';
Option := 'ine';
Colors := [2568006];
Tol := 5;
Hue := 0.07;
Sat := 0.18;
FindAllColors := False;
W := 30;
H := 23;
Accuracy := 5;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
BadColors := [];
BadColorTolerance := 10;
end;
End;
End;
{******************************************************************************}
{ Function MSI_GetObjects(Which: TIntegerArray): TMSObjectArray; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Load all object info for object in the array }
{******************************************************************************}
Function MSI_GetObjects(Which: TIntegerArray): TMSObjectArray;
Var
I, H: Integer;
Begin
H := High(Which);
SetLength(Result, H + 1);
For I := 0 To H Do
Result[I] := MSI_GetObject(Which[I]);
End;
{******************************************************************************}
{ Function ReturnPointsInBox(TPA: TPointArray; B: TBox): TPointArray; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Self explanatory }
{******************************************************************************}
Function MSI_ReturnPointsInBox(TPA: TPointArray; B: TBox): TPointArray;
Var
I, H, N: Integer;
Begin
H := High(TPA);
SetLength(Result, 1 shl 20);
For I := 0 To H Do
If PointInBox(TPA[I], B) Then
Begin
Result[N] := TPA[I];
Inc(N);
End;
SetLength(Result, N);
End;
{******************************************************************************}
{ Function MSI_FindObjectsTPA( ... ): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds objects in mainscreen, saves co-ords in TPA }
{******************************************************************************}
Function MSI_FindObjectsTPA(Var Objs: TPointArray; ObjInfo: TMSObject; SearchBox: TBox): Boolean;
Var
TPA, TempTPA: TPointArray;
ATPA: T2DPointArray;
I, II, CTS, TMP, H: Integer;
Box: TBox;
Boxes: TBoxArray;
Animating2: TBooleanArray;
BadPoint: Boolean;
tmp_ACI: TAutoColorInfo;
Begin
If (Not LoggedIn) Then Exit;
With ObjInfo Do
Begin
if MaxDist > 0 then
if (MinR + MaxR) > 0 then
if (MinG + MaxG) > 0 then
if (MinB + MaxB) > 0 then
if (MinX + MaxX) > 0 then
if (MinY + MaxY) > 0 then
if (MinZ + MaxZ) > 0 then
begin
tmp_ACI.MinR := MinR; tmp_ACI.MaxR := MaxR;
tmp_ACI.MinG := MinG; tmp_ACI.MaxG := MaxG;
tmp_ACI.MinB := MinB; tmp_ACI.MaxB := MaxB;
tmp_ACI.MinX := MinX; tmp_ACI.MaxX := MaxX;
tmp_ACI.MinY := MinY; tmp_ACI.MaxY := MaxY;
tmp_ACI.MinZ := MinZ; tmp_ACI.MaxZ := MaxZ;
tmp_ACI.MaxDist := MaxDist;
tmp_ACI.Color := Colors[0];
tmp_ACI.LumTol := Tol;
Result := FindAllObjsRecord(Objs, tmp_ACI, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, True, True);
Exit;
end;
End;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ObjInfo.Hue, ObjInfo.Sat);
Box := IntToBox(228, 150, 275, 200);
H := High(ObjInfo.Colors);
SetLength(ATPA, H + 1);
For I := 0 To H Do
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[I], ObjInfo.Colors[I], SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, ObjInfo.Tolerance);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
{ Check if some of the colors was not on MS. }
If FindAllColors Then
For I := 0 To H Do
If (Length(ATPA) < 1) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'All colors weren''t found!', DEBUG_SMALL_DETAILS);
Objs := [];
Exit;
End;
{ Check if we have enough pixels on MS. }
TPA := MergeATPA(ATPA);
//DrawDots(TPA, 1000);
If (Length(TPA) < ObjInfo.Accuracy) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'No colors found!', DEBUG_SMALL_DETAILS);
Objs := [];
Exit;
End;
ATPA := TPAtoATPAEx(TPA, ObjInfo.W, ObjInfo.H);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
H := High(ATPA);
SetLength(TPA, H + 1);
For I := 0 To H Do
TPA[I] := MiddleTPA(ATPA[I]);
H := High(TPA);
SetLength(Boxes, H + 1);
For I := 0 To H Do
Begin
Boxes[I].X1 := TPA[I].X - (ObjInfo.W / 2);
Boxes[I].Y1 := TPA[I].Y - (ObjInfo.H / 2);
Boxes[I].X2 := TPA[I].X + (ObjInfo.W / 2);
Boxes[I].Y2 := TPA[I].Y + (ObjInfo.H / 2);
End;
If CheckAnimation Then
Animating2 := AnimatingMulti(Boxes, 100, 1);
For I := 0 To High(TPA) Do
Begin
BadPoint := False;
//DrawBox(Boxes[I], 200);
{ Animation }
If (Not BadPoint) Then
If ObjInfo.Anim Then
If (Not Animating2[I]) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Not animating!', DEBUG_SMALL_DETAILS);
BadPoint := True;
End;
{ Exclude own character }
If (Not BadPoint) Then
If ObjInfo.ExcludeSelf Then
If PointInBox(TPA[I], Box) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Own character!', DEBUG_SMALL_DETAILS);
BadPoint := True;
End;
{ Invalid point }
If (Not BadPoint) Then
If ((TPA[I].X + TPA[I].Y) < 1) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Invalid point!', DEBUG_SMALL_DETAILS);
BadPoint := True;
End;
{ Accuracy }
If (Not BadPoint) Then
If (Length(ATPA[I]) < ObjInfo.Accuracy) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Not enough points!', DEBUG_SMALL_DETAILS);
BadPoint := True;
End;
{ Bad colors }
If (Not BadPoint) Then
For II := 0 To High(ObjInfo.BadColors) Do
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Looking for bad color: '+IntToStr(BadColors[II]), DEBUG_SMALL_DETAILS);
If FindColorSpiralTolerance(TMP, TMP, ObjInfo.BadColors[II], TPA[I].X - (Width / 2), TPA[I].Y - (Height / 2), TPA[I].X + (Width / 2), TPA[I].Y + (Height / 2), ObjInfo.BadColorTolerance) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'Bad color found!', DEBUG_SMALL_DETAILS);
BadPoint := True;
Break;
End;
End;
{ FindAllColors }
If (Not BadPoint) Then
If ObjInfo.FindAllColors Then
For II := 0 To H Do
Begin
TempTPA := MSI_ReturnPointsInBox(ATPA[II], IntToBox(TPA[I].X - (Width / 2), TPA[I].Y - (Height / 2), TPA[I].X + (Width / 2), TPA[I].Y + (Height / 2)));
If (Length(TempTPA) < 1) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'All colors weren''t found!', DEBUG_SMALL_DETAILS);
BadPoint := True;
Break;
End;
End;
{ Valid point! }
If (Not BadPoint) Then
Begin
SetLength(Objs, Length(Objs) + 1);
Objs[High(Objs)] := TPA[I];
End;
End;
Result := (Length(Objs) > 0);
End;
{******************************************************************************}
{ Function MSI_FindObjectsIn( ... ): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds objects in mainscreen }
{******************************************************************************}
Function MSI_FindObjectsIn(Objs: TMSObjectArray; Var IndexFound: Integer; SearchBox: TBox; Action: fnct_ActionOptions): Boolean;
Var
TPA: TPointArray;
TheOptions, UpTexts: TStringArray;
I, II, III, HH, HHH, Hi: Integer;
CheckUpText: Boolean;
Begin
Hi := High(Objs);
SetLength(TheOptions, Hi + 1);
SetLength(UpTexts, Hi + 1);
For I := 0 To Hi Do
Begin
UpTexts[I] := Objs[I].UpText;
TheOptions[I] := Objs[I].Option;
End;
For II := 0 To Hi Do
With Objs[II] Do
If MSI_FindObjectsTPA(TPA, Objs[II], SearchBox) Then
Begin
HH := Min((Objs[II].Tries - 1), High(TPA));
For I := 0 to HH Do
Begin
MSI_Debug('MSI_FindObjects', IntToStr(Length(TPA))+' objects found!', DEBUG_SMALL_DETAILS);
X := Objs[II].X;
Y := Objs[II].Y;
IndexFound := II;
If (Action = Nothing) Then
Begin
Result := True;
Exit;
End;
HHH := High(UpTexts);
CheckUpText := True;
For III := 0 To HHH Do
If (UpTexts[III] = '') Then
Begin
CheckUpText := False;
Break;
End;
MMouse(TPA[I].X, TPA[I].Y, 2, 2);
Wait(20 + Random(50));
If CheckUpText Then
Result := WaitUpTextMulti(UpTexts, 150 + Random(20))
Else
Result := True;
If (Action = Move) Then
Exit;
If Result Then
Begin
GetMousePos(X, Y);
If (Objs[II].RightClickOnly) Or InRange(Random(100), 0, 20) Or (Action = ClickRight) Then
Begin
Mouse(X, Y, 0, 0, False);
If (Action = ClickRight) or (Action = ClickLeft) Then
Result := WaitOptionMulti(TheOptions, 750 + Random(100))
Else
Result := True;
End Else
Begin
Mouse(X, Y, 0, 0, True);
Result := DidRedClick;
End;
If Objs[II].WaitToMove Then
If WaitFunc(@IsMoving, 15, 2000 + Random(200)) Then
While IsMoving Do
Wait(10 + Random(5));
Exit;
End Else
MSI_Debug('MSI_FindObjects', 'Uptext didn''t match!', DEBUG_SMALL_DETAILS);
End;
End;
MSI_Debug('MSI_FindObjects', 'Objects not found!', DEBUG_SMALL_DETAILS);
End;
{******************************************************************************}
{ Function MSI_FindObjects( ... ): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds multiple objects on the mainscreen }
{******************************************************************************}
Function MSI_FindObjects(Objs: TMSObjectArray; Var IndexFound: Integer; Action: fnct_ActionOptions): Boolean;
Begin
Result := MSI_FindObjectsIn(Objs, IndexFound, MSBox, Action);
End;
{******************************************************************************}
{ Function MSI_FindObjectIn( ... ): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds object in specified location }
{******************************************************************************}
Function MSI_FindObjectIn(Obj: TMSObject; SearchBox: TBox; Action: fnct_ActionOptions): Boolean;
Var
TMP: Integer;
Begin
Result := MSI_FindObjectsIn([Obj], TMP, SearchBox, Action);
End;
{******************************************************************************}
{ Function MSI_FindObject( ... ): Boolean; }
{ By: marpis }
{ Date: 10 June 2010 }
{ Description: Finds object on the mainscreen }
{******************************************************************************}
Function MSI_FindObject(Obj: TMSObject; Action: fnct_ActionOptions): Boolean;
Var
TMP: Integer;
Begin
Result := MSI_FindObjectsIn([Obj], TMP, MSBox, Action);
End;
Woodcutting.scar
{==============================================================================\
| MSI Group Scripting Include |
| WoodCutting.scar |
|==============================================================================|
| For all woodcutting routines. |
| |
| * procedure MSI_WaitWhileChopping(); * by marpis |
| * function MSI_ChopTree(): Boolean; * by marpis |
| * function MSI_ChopInvFull(): Boolean; * by marpis |
| * function MSI_PowerChop(): Boolean; * by marpis and Coh3n |
\ _____________________________________________________________________________}
{******************************************************************************}
{ Procedure WaitWhileChopping(TreeX, TreeY: Integer; TreeInfo: TMSObject); }
{ By: marpis }
{ Description: Wait while tree's been cut }
{******************************************************************************}
Procedure MSI_WaitWhileChopping(TreeX, TreeY: Integer; TreeInfo: TMSObject);
Var
CTS, HalfWidth, HalfHeight, L, I, T, OldInvCount, NewInvCount: Integer;
TotalChopTime, R, CT: Integer;
ATPA: T2DPointArray;
TPA: TPointArray;
B: TBox;
TreeExists: Boolean;
Begin
CTS := GetColorToleranceSpeed;
SetColorSpeed2Modifiers(TreeInfo.Hue, TreeInfo.Sat);
HalfWidth := (TreeInfo.W / 2);
HalfHeight := (TreeInfo.H / 2);
B := IntToBox(TreeX - HalfWidth, TreeY - HalfHeight, TreeX + HalfWidth, TreeY + HalfHeight);
L := Length(TreeInfo.Colors);
SetLength(ATPA, L);
Dec(L);
OldInvCount := InvCount;
T := GetSystemTime + 20000 + Random(5000);
TotalChopTime := GetSystemTime;
Repeat
If InvFull Then Break;
MSI_AntiBan(RandomRange(0, 10000), ANTI_BAN_CHANCE);
{ Check if the tree Exists }
For I := 0 To L Do
FindColorsTolerance(ATPA[I], TreeInfo.Colors[I], B.X1, B.Y1, B.X2, B.Y2, TreeInfo.Tol);
TPA := MergeATPA(ATPA);
//WriteLn(Length(TPA));
TreeExists := Length(TPA) >= TreeInfo.Accuracy;
If (TreeExists) Then
If (Random(4) <> 0) Then
Wait(200 + Random(50))
Else
SleepAndMoveMouse(200 + Random(50));
MSI_FindRandoms;
{ InvCount check }
NewInvCount := InvCount;
If (NewInvCount > OldInvCount) Then
Begin
OldInvCount := NewInvCount;
T := GetSystemTime + 20000 + Random(5000);
End;
{ Prevent logout }
If ((GetSystemTime - TotalChopTime) > 60000) Then
Begin
CT := GetCurrentTab;
Repeat
R := RandomRange(Tab_Combat, Tab_Notes);
Until(R <> CT);
GameTab(R);
End;
Until(Not TreeExists) Or (GetSystemTime > T) Or (Not LoggedIn);
End;
{******************************************************************************}
{ Function MSI_ChopTree(Which: TIntegerArray): Boolean; }
{ By: marpis }
{ Description: Chops tree }
{******************************************************************************}
Function MSI_ChopTree(Which: TIntegerArray): Boolean;
Var
X, Y, TreeIndex: Integer;
Trees: TMSObjectArray;
Begin
Trees := MSI_GetObjects(Which);
If MSI_FindObjects(Trees, TreeIndex, ClickLeft) Then
Begin
X := Trees[TreeIndex].X;
Y := Trees[TreeIndex].Y;
If MSI_FindObjectIn(Trees[TreeIndex], IntToBox(X - 20, Y - 20, X + 20, Y + 20), Nothing) Then
Begin
Result := True;
MSI_WaitWhileChopping(X, Y, Trees[TreeIndex]);
End;
End;
End;
{******************************************************************************}
{ Function MSI_ChopInvFull(Which: TIntegerArray): Boolean; }
{ By: marpis }
{ Description: Chops trees until inventory is full }
{******************************************************************************}
Function MSI_ChopInvFull(Which: TIntegerArray): Boolean;
Var
T: Integer;
Begin
T := GetSystemTime + 5*60000;
While (Not InvFull) And (LoggedIn) And (GetSystemTime < T) Do
Begin
If MSI_ChopTree(Which) Then
T := GetSystemTime + 5*60000;
Wait(RandomRange(300, 800));
End;
Result := InvFull;
End;
{******************************************************************************}
{ function MSI_PowerChop(WhichTrees, WhichLogs: TIntegerArray): Boolean; }
{ By: marpis and Coh3n }
{ Description: Chops trees until inventory is full, then drops. }
{ Time is in milliseconds. }
{******************************************************************************}
procedure MSI_CountItems; forward;
function MSI_PowerChop(WhichTrees, WhichLogs: TIntegerArray): Boolean;
Var
TT: Integer;
Begin
TT := GetSystemTime + 30*60000;
Repeat
If MSI_ChopInvFull(WhichTrees) Then
TT := GetSystemTime + 30*60000;
Until(InvFull) Or (Not LoggedIn) Or (GetSystemTime > TT);
MSI_CountItems; //Adds the logs/exp to the progress report
MSI_ClickItems(WhichLogs, ['Drop', 'rop', 'Dro', 'Dr']);
MSI_AddToProggy(-1, -1, ADD_LOADS);
Result := True; //To satisfy MSI_DoSkill
End;
Globals.scar
{==============================================================================\
| MSI Group Scripting Include |
| Globals.scar |
|==============================================================================|
| Used to store all necessary global types, consts and vars |
| |
\_____________________________________________________________________________}
const
MSI_VERSION_NUMBER = '1.0';
{
Abbreviations:
- FS: Fishing Spot
- GS: General Store
- GE: Grand Exchange
- VE: Varrock East
- VW: Varrock West
- FW: Falador West
- FE: Falador East
- CG: Castle Guards
- DW: Dark Wizards
- V: Volcan
- SO: Stronghold Of *
- AK: Al Kharid
- SW: Spinning Wheel
- LB: Lumby
- EV: EdgeVille
- BV: Barbarian Village
}
{ const Debug
Description: The several debugging levels, so the user receives as much
detail as he wishes to receive. }
const
DEBUG_FORCE = 10; // For MSI SLs to force it to be debuged, not for Script Users!
DEBUG_PROGGIE = 7; // Only debug proggie and more important things
DEBUG_PLAYER_ACTIONS = 5; // Only debug proggie, Player Actions and more important things
DEBUG_FUNCTIONS = 3; // Debug the at the start of each function, Player Actions, Proggie and +
DEBUG_SMALL_DETAILS = 1; // Debug small details and more important
DEBUG_EVERYTHING = 0; // For Script Users to have everything in debug box.
{ const Other
Description: Represents miscellaneous constants }
const
STATS_LINK = 'http://scriptmanager.freehostia.com/submit.php'; //for stats
WALK_TOL = 8; //the tolerance for a color point compared to a reflection point
ANTI_BAN_CHANCE = 10; //the chance (in %) of antiban
{ const Stats
Description: Represents all the custom variables to add to the stats }
const
STATS_LOGINS = 1;
STATS_BANKS = 2;
STATS_LOADS = 3;
STATS_RANDOMS = 4;
STATS_LEVELS = 5;
STATS_EXP = 6;
STATS_LOGS = 7;
STATS_ORES = 8;
{ const Players
Constants representing the different Players array records. }
const
// Integers
P_LOC = 0;
// Booleans
P_BANK = 0;
{ const Location Constants
Description: Constants used to represent player locations }
const
LOC_POWER_SKILL = 0;
LOC_LOST = 1;
LOC_VE_TREES = 2;
LOC_VE_BANK = 3;
LOC_IN_RANDOM = 4;
{ const AutoColor
Description: Constants used for autocoloring the minimap }
const
COLOR_ROAD_GENERAL = 6579821;
COLOR_ROAD_VARROCK = 8686729;
COLOR_ROAD_FALLY = 7831173;
COLOR_ROAD_LUMBY = 8225677;
COLOR_ROAD_DIRT = 1853272;
COLOR_BANKER = 1179390;
COLOR_WATER = 10850700;
COLOR_ROCK = 5789528;
COLOR_SAND = 0;
COLOR_TREE = 1532978;
{ const Walking
Description: Constants representing the color walking points }
const
WALK_WC_VE_TREE_1 = 0; // rock
WALK_WC_VE_TREE_2 = 1; // road
WALK_WC_VE_TREE_3 = 2; // path
WALK_WC_VE_TREE_4 = 3; // final
WALK_WC_VE_BANK_1 = 4; // rock
WALK_WC_VE_BANK_2 = 5; // path
WALK_WC_VE_BANK_3 = 6; // road
WALK_WC_VE_BANK_4 = 7; // final
{ const Banking
Description: Constants used in bank procedures }
const
BANK_SYMBOL_ACCURACY = 0.45; // The symbol accuracy of the bank
INC_TOL = 5; // How much to increase the tolerance by
MAX_TOL = 40; // The max tolerance reached before the object cannot be found.
{ const DDTM
Description: Constants representing the DDTM points }
const
DTM_TOLERANCE = 12;
DTM_POINT_1 = 0; //corresponds to the TPA returned in MSI_GetDTMPoints
DTM_POINT_2 = 1;
DTM_POINT_3 = 2;
DTM_POINT_4 = 3;
DTM_POINT_5 = 4;
{ const Hatchet/Pickaze requirements.
Constants representing the requirements to use each tool }
const
//hatchets and pickaxes
REQ_BRONZE = 1;
REQ_IRON = 1;
REQ_STEEL = 6;
REQ_MITHRIL = 21;
REQ_ADAMANT = 31;
REQ_RUNE = 41;
REQ_MAX_LEVEL = 99;
{ const Item Info
Description: Constants representing all the items used in MSI. }
const
MSI_ITEM_COUNT = 17; //change this to the number of items in ItemInfo.scar
{
PICKAXE_BRONZE = 0;
PICKAXE_IRON = 1;
PICKAXE_STEEL = 2;
PICKAXE_MITHRIL = 3;
PICKAXE_ADAMANT = 4;
PICKAXE_RUNE = 5;
}
HATCHET_BRONZE = 6;
HATCHET_IRON = 7;
HATCHET_STEEL = 8;
HATCHET_MITHRIL = 9;
HATCHET_ADAMANT = 10;
HATCHET_RUNE = 11;
LOGS_NORMAL = 12;
LOGS_OAK = 13;
LOGS_WILLOW = 14;
LOGS_MAPLE = 15;
LOGS_YEW = 16;
{ const Objects
Description: Constants representing all the main screen objects used in MSI }
const
OBJ_TREE_NORMAL = 0;
OBJ_TREE_OAK = 1;
OBJ_TREE_WILLOW = 2;
OBJ_TREE_MAPLE = 3;
OBJ_TREE_YEW = 4;
OBJ_TREE_MAGIC = 5;
OBJ_ROCK_CLAY = 6;
OBJ_ROCK_TIN = 7;
OBJ_ROCK_COPPER = 8;
OBJ_ROCK_IRON = 9;
OBJ_ROCK_SILVER = 10;
OBJ_BANK_VE = 9;
{ Type TMSObject
Description: To be used for finding on the MS. Stores all necessary
information. }
Type
TMSObject = Record
X, Y : Integer;
Name : String;
UpText : String;
Option : String;
Exp : Extended;
Colors : TIntegerArray;
FindAllColors : Boolean; // Result False if not ALL colors are found
Tol : Integer;
Hue : Extended;
Sat : Extended;
W, H : Integer;
Accuracy : Integer; // Min pixels to be found
ExcludeSelf : Boolean; // Exclude pixels in a box, the box might need revamping / making it dynamic
RightClickOnly : Boolean;
Tries : Integer;
Anim : Boolean; // Result False if not animating
WaitToMove : Boolean; // When ClickLeft, wait till we have stopped moving?
BadColors : TIntegerArray;
BadColorTolerance: Integer;
// TAutoColorInfo
MaxCount, MaxDist: Integer;
MinR, MaxR, MinG, MaxG, MinB, MaxB: Integer;
MinX, MaxX, MinY, MaxY, MinZ, MaxZ: Extended;
End;
TMSObjectArray = Array of TMSObject;
{ Type TItem
Description: To be used for handling Items in all situations. }
TItem = Record
Name : String;
UpText : TStringArray;
ItemP : TPoint;
Stackable : Boolean;
Colors : TIntegerArray;
Tol : Integer;
DTM : Integer;
BMP : Integer;
End;
//Used in Banking.Scar
Type MSI_TItemArray = Array Of TItem;
{ Type TMMLocation
Description: Stores all needed colorwalking information. }
TMMLocation = Record
Symbol : String;
DTM : Integer;
W, H : Integer;
Colors : TIntegerArray;
Tolerances : TIntegerArray;
Counts : TIntegerArray;
End;
{ Type TPlayerSkillInfo
Description: Stores information for one player for one skill. }
TPlayerSkillInfo = record
TotalTime : integer;
TotalObj : integer;
TotalLoads : integer;
Level : integer;
TotalEXP : integer;
ObjQuants : array of integer;
end;
{ Type TProggy
Description: Stores information all progress related information for one
player. }
TProggy = record
PlayerName : string;
PlayerStatus: boolean;
FalseReason : string;
PlayerRandom: string;
PlayerCity : string;
PlayerLoc : integer;
PlayerTime : integer;
SkillInfo : array of TPlayerSkillInfo;
end;
var
//To be used to store information for Players individually
ProgressReportArray: Array of TProggy;
//Used like CurrentPlayer, but for the skills in the player array
CurrentSkill: Integer;
//For script user to choose how much to debug
Debug_LevelToDebug: integer;
//Used in the DeclarePlayers arrays for skills and objects
PlayerSkills: Array of TVariantArray;
PlayerObjects: Array of Array of TVariantArray;
//Used for script setup (assinged to constatns in RunMe.scar)
BreakAfter, BreakTime: Integer;
//Used when loading items for MSI
MSI_Item: Array[0..(MSI_ITEM_COUNT - 1)] Of TItem;
IsItemLoaded: Array[0..(MSI_ITEM_COUNT - 1)] of Boolean;
//Used for saving the debug box
ScriptStart: String;
SaveDebug: Boolean;
//Used to determine whether the reflection hooks are outdated
ReflectionBroken: Boolean;
//Used in the stats system
Stats_UserID, Stats_Password, Stats_ScriptID: string;
Stats_LastTime: Integer;
Stats_CustomVars: array [1..20] of Integer;
statsID, statsPass: String; //For compiling issues