SRL Archive - MSI Suggestions

Obj Finding 'Smart' Algorithms


Sir R. M8gic1an

2010-07-11 12:23:40

ok so i've read about the common problem of hovering trees that aren't "cuttable".

First thing that came to mind, was to "mark the box as bad and therefore not check it."

That idea is very simple.
- You are looking for yews
- You find an Oak
- You mark the Oak TBox as a NotBox
- Next time you run the algo it won't check the NotBox
- Once the object is found, the NotBox Array is cleared.

A slight downside to this: Text checking is 100% necessary.

Then again, I thought: Any 'Smart' algorithm needs to somehow check the results, to be able to learn.

If we implement the text checking it means we'll cut down a layer, (in which I don't see harm), but we'll be able to use smart algorithms. And that, my friends, is a huge advantage.

And to push in this direction, I wrote some code.


Boxes, NotBoxes: TBoxArray;

{Bad Boxes}
if not BadPoint then
if Length(NotBoxes) > 0 then
begin
TMP := High(NotBoxes);

for II := 0 to TMP do
if PointInBox(TPA[i], NotBoxes[II])) then
begin
MSI_Debug('MSI_FindObjectsTPA', 'Point in bad Box', DEBUG_SMALL_DETAILS);
BadPoint := True;
break;
end;
end;

{ Text Checking }
if not BadPoint then
if CheckText then
begin

end;

{ Valid point! }
If (Not BadPoint) Then
Begin
SetLength(Objs, Length(Objs) + 1);
Objs[High(Objs)] := TPA[I];

{ Avoid it Next time}
End Else Begin
TMP := High(NotBoxes);
SetLength(NotBoxes, TMP + 1);
CopyBox( Boxes[I], NotBoxes[TMP]);
End;


embedded in the rest:

Procedure CopyBox(Origin, var BoxTo: TBox);
begin
BoxTo := IntToBox(Origin.X1, Origin.Y1, Origin.X2, Origin.Y2);
end;

{******************************************************************************}
{ Function MSI_FindObjectsTPA( ... ): Boolean; }
{ By: marpis }
{ Date: 25 June 2010 }
{ Description: Finds objects in mainscreen, saves co-ords in TPA }
{******************************************************************************}
Function MSI_FindObjectsTPA(Var Objs: TPointArray; ObjInfo: TMSObject; SearchBox: TBox; CheckText: Boolean): Boolean;
Var
TPA, TempTPA: TPointArray;
ATPA: T2DPointArray;
I, II, CTS, TMP, H: Integer;
SelfBox: TBox;
Boxes, NotBoxes: TBoxArray;
Animating2: TBooleanArray;
BadPoint: Boolean;
Begin
If (Not LoggedIn) Then Exit;

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ObjInfo.Hue, ObjInfo.Sat);
SelfBox := 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.Tol);

ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

{ Check if some of the colors was not on MS. }
If ObjInfo.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 ObjInfo.Anim Then
Animating2 := AnimatingMulti(Boxes, 100, 1);

For I := 0 To High(TPA) Do
Begin
BadPoint := False;
//DrawBox(Boxes[I], 200);

{Bad Boxes}
if not BadPoint then
if Length(NotBoxes) > 0 then
begin
TMP := High(NotBoxes);

for II := 0 to TMP do
if PointInBox(TPA[i], NotBoxes[II])) then
begin
MSI_Debug('MSI_FindObjectsTPA', 'Point in bad Box', DEBUG_SMALL_DETAILS);
BadPoint := True;
break;
end;
end;

{ 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], SelfBox) 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(ObjInfo.BadColors[II]), DEBUG_SMALL_DETAILS);
If FindColorSpiralTolerance(TMP, TMP, ObjInfo.BadColors[II], TPA[I].X - (ObjInfo.W / 2), TPA[I].Y - (ObjInfo.H / 2), TPA[I].X + (ObjInfo.W / 2), TPA[I].Y + (ObjInfo.H / 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 - (ObjInfo.W / 2), TPA[I].Y - (ObjInfo.H / 2), TPA[I].X + (ObjInfo.W / 2), TPA[I].Y + (ObjInfo.H / 2)));
If (Length(TempTPA) < 1) Then
Begin
MSI_Debug('MSI_FindObjectsTPA', 'All colors weren''t found!', DEBUG_SMALL_DETAILS);
BadPoint := True;
Break;
End;
End;

{ Text Checking }
if not BadPoint then
if CheckText then
begin

end;

{ Valid point! }
If (Not BadPoint) Then
Begin
SetLength(Objs, Length(Objs) + 1);
Objs[High(Objs)] := TPA[I];

{ Avoid it Next time}
End Else Begin
TMP := High(NotBoxes);
SetLength(NotBoxes, TMP + 1);
CopyBox( Boxes[I], NotBoxes[TMP]);
End;
End;

Result := (Length(Objs) > 0);
End;



The only thing missing is the actual text finding. Didn't get around to the that.


And just in case this post didn't ring any bells yet.. this direction means we can embed things such as SmartColors and MatchTPA and so on into MSI.

~RM

Coh3n

2010-07-11 12:42:18

I like it. :D

I don't really see any negatives to this, other than the text checking, but that's not really something you can avoid when all the tree colours are basically exactly the same.

Dan Cardin

2010-07-11 20:11:28

do they all have the same trunk colors?

Coh3n

2010-07-11 23:02:03

From: Dan Cardin
do they all have the same trunk colors?

No idea, but I would assume they are similar. Then again, maybe they're like the logs. Would make sense anyway.

Cigue

2010-07-11 23:06:20

So how does one use these?

marpis

2010-07-12 05:17:46

From: Cigue
So how does one use these?


This won't change the way you use MSI_FindObject.
–
But remember to clear the box array after every successfull search, because when the character moves the boxes aren't on the same trees anymore.

Sir R. M8gic1an

2010-07-12 08:07:36

From: marpis
This won't change the way you use MSI_FindObject.
–
But remember to clear the box array after every successfull search, because when the character moves the boxes aren't on the same trees anymore.


ATM the NotBoxes are a local variable, so it'll be cleared anyway. But I think there's a lot we can add onto here.

~RM

marpis

2010-07-13 01:18:28

From: Rasta Magician
ATM the NotBoxes are a local variable, so it'll be cleared anyway. But I think there's a lot we can add onto here.

~RM


Except that it can't be a local variable :( For example when waiting for Yews to appear, it will go
FindObject -> False
Antiban, reset boxes
FindObject -> False, hovering same boxes as above
…
E: I mean, it can't be local on FindObject, but ofcourse it can in Mainloop etc..

Sir R. M8gic1an

2010-07-13 05:50:54

From: marpis
Except that it can't be a local variable :( For example when waiting for Yews to appear, it will go
FindObject -> False
Antiban, reset boxes
FindObject -> False, hovering same boxes as above
…
E: I mean, it can't be local on FindObject, but ofcourse it can in Mainloop etc..


Probably best to have it global ;)

~RM

Coh3n

2010-09-23 18:17:39

Anything more been done with this? :)

Sir R. M8gic1an

2010-09-23 23:38:22

Not by me, although I did check it out. There's lots of changes that would be necessary for this.

~RM

Coh3n

2010-09-25 16:23:38

From: Sir R. Magician
Not by me, although I did check it out. There's lots of changes that would be necessary for this.

~RM
Significant changes? Is it worth pursuing right now, or should we postpone for a while?

Sir R. M8gic1an

2010-09-25 16:27:14

I'd say postpone as our object finding is pretty good atm anyway.

~RM

Coh3n

2011-01-14 14:53:29

I'm thinking about working on this a little when I have some spare time. I was watching RM Yews go for a while, and it does repeatedly hover the one Normal Tree when all the Yews are cut down. I came up with a solution only to realize it was exactly the same as the first post. :p

Sooo, the mouse would hover over the Normal Tree once, and remember that those are bad boxes and therefore won't repeatedly hover until a Yew spawned. Shouldn't be too hard at all. :)

As a note:
From: marpis

But remember to clear the box array after every successfull search, because when the character moves the boxes aren't on the same trees anymore.


And RM, mind elaborating on this? I'm not sure how having this means we can have SmartColors/MatchTPA (what's this from?) in MSI.
From: Sir R. Magician
And just in case this post didn't ring any bells yet.. this direction means we can embed things such as SmartColors and MatchTPA and so on into MSI.

noidea

2011-01-14 15:03:37

Admittedly I havent read this thread through, but wouldnt you have to make a new NoBox everytime your character moves?

This is how I imagine it:
You hover over the tree and get the text. If it doesnt match, use MStoMM and mark the position of that tree relative to the road or something else in a static position.

When searching later on, check the MStoMM position and make sure the point your checking isnt near a NoPosition.

Coh3n

2011-01-14 15:05:58

From: noidea
Admittedly I havent read this thread through, but wouldnt you have to make a new NoBox everytime your character moves?

This is how I imagine it:
You hover over the tree and get the text. If it doesnt match, use MStoMM and mark the position of that tree relative to the road or something else in a static position.

When searching later on, check the MStoMM position and make sure the point your checking isnt near a NoPosition.

Interesting idea. Would be very tough though determining where that tree is on the minimap when your player moves around a lot. Especially when the same object finding algorithms are used everywhere we have scripts.

NCDS

2011-01-14 15:19:38

From: noidea
Admittedly I havent read this thread through, but wouldnt you have to make a new NoBox everytime your character moves?

This is how I imagine it:
You hover over the tree and get the text. If it doesnt match, use MStoMM and mark the position of that tree relative to the road or something else in a static position.

When searching later on, check the MStoMM position and make sure the point your checking isnt near a NoPosition.


From: Coh3n
Interesting idea. Would be very tough though determining where that tree is on the minimap when your player moves around a lot. Especially when the same object finding algorithms are used everywhere we have scripts.


Seems like marpis' (or maybe it was the one Boreas was working on?) would be useful for this. :rolleyes:

**BANNED The Man

2011-01-14 15:32:25

From: NCDS
Seems like marpis' (or maybe it was the one Boreas was working on?) would be useful for this. :rolleyes:


Use Marpis' Colour TileToMM or whatever, therefore you just need to store the tile it is on.

-Boom

Coh3n

2011-01-14 15:37:54

From: Dynamite
Use Marpis' Colour TileToMM or whatever, therefore you just need to store the tile it is on.

-Boom

Uhm what? If there's a color tile system, it could change pretty much everything..

n3ss3s

2011-01-14 15:43:14

From: Coh3n
Uhm what? If there's a color tile system, it could change pretty much everything..


I don't think he meant a colour walker / positioning system, although afaik one is being worked on…

marpis

2011-01-14 15:47:17

From: NCDS
Seems like marpis' (or maybe it was the one Boreas was working on?) would be useful for this. :rolleyes:


From: Dynamite
Use Marpis' Colour TileToMM or whatever, therefore you just need to store the tile it is on.

-Boom


It will be just GetMyPos in color :)

Sir R. M8gic1an

2011-01-14 16:12:03

@Coh3n:
SmartColors would be quite a long stretch to implement here because of the way we search for stuff already, and I don't quite know where MatchTPA is, but I'll find it.

The only thing is that the boxes need a smart algorithm too :p

~RM

**BANNED The Man

2011-01-14 17:40:23

From: marpis
It will be just GetMyPos in color :)


But surely if you can do GetMyPos, you can work out what tile the tree is which is right next to you with some math.

-Boom

Boreas

2011-01-14 17:52:37

From: Dynamite
But surely if you can do GetMyPos, you can work out what tile the tree is which is right next to you with some math.

-Boom


On MS with an estimated height, yes.

nickrules

2011-01-18 17:47:04

Why not just store tree tiles? I'm almost positive there is a function that grabs an objects tile, and if not, just use math. Of course, this is reflection only…

Maybe the use of BMPs + tileToMM?

Coh3n

2011-01-19 01:57:31

Shouldn't really need to use reflection; although it obviously wouldn't hurt.

nickrules

2011-01-19 18:35:07

Of course we don't need it. But it would be useful. Perhaps MM based location logging?

Sir R. M8gic1an

2011-01-19 19:27:29

From: nickrules
Of course we don't need it. But it would be useful. Perhaps MM based location logging?


What..? are you saying to find objects (rocks & etc) through the MM with reflection?

~RM

Coh3n

2011-02-01 23:11:39

Okay so I did a little work on this and realized that the way you have it, RM, it will move the mouse and check the text of every box before moving the mouse to the right one. Unless I did the text checking part wrong, I think the not boxes need to be set in MSI_FindObjectsIn.

Function MSI_FindObjectsTPA(Var Objs: TPointArray; ObjID: integer; SearchBox: TBox; CheckText: Boolean): Boolean;
Var
TPA, TempTPA: TPointArray;
ATPA: T2DPointArray;
I, II, CTS, TMP, H: Integer;
Box: TBox;
Boxes, NotBoxes: TBoxArray;
Animating2: TBooleanArray;
BadPoint: Boolean;
Begin
If (Not LoggedIn) Then
Exit;

MSI_AddHeader('MSI_FindObjectsTPA');

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[objID].Hue, MSI_Objects[objID].Sat);
Box := IntToBox(249, 146, 276, 187); // Box around player

H := High(MSI_Objects[objID].Colors);
SetLength(ATPA, H + 1);

For I := 0 To H Do
FindColorsSpiralTolerance(MSCX, MSCY, ATPA[I], MSI_Objects[objID].Colors[I], SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, MSI_Objects[objID].Tol);

ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

{ Check if some of the colors was not on MS. }
If MSI_Objects[objID].FindAllColors Then
For I := 0 To H Do
If (Length(ATPA) < 1) Then
Begin
MSI_Debug('All colors weren''t found!');
MSI_CloseHeader('MSI_FindObjectsTPA: '+BoolToStr(Result));
Objs := [];
Exit;
End;

{ Check if we have enough pixels on MS. }
TPA := MergeATPA(ATPA);

If (Length(TPA) < MSI_Objects[objID].Accuracy) Then
Begin
MSI_Debug('No colors found!');
Wait(RandomRange(300, 600));
MSI_CloseHeader('MSI_FindObjectsTPA: '+BoolToStr(Result));
Objs := [];
Exit;
End;

ATPA := TPAtoATPAEx(TPA, MSI_Objects[objID].W, MSI_Objects[objID].H);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
H := High(ATPA);
SetLength(TPA, H + 1);

if MSI_SetupVars[SETUP_DEBUG_SMART] then
DrawDotsMulti(true, ATPA);

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 - (MSI_Objects[objID].W / 2);
Boxes[I].Y1 := TPA[I].Y - (MSI_Objects[objID].H / 2);
Boxes[I].X2 := TPA[I].X + (MSI_Objects[objID].W / 2);
Boxes[I].Y2 := TPA[I].Y + (MSI_Objects[objID].H / 2);
End;

If MSI_Objects[objID].Anim Then
Animating2 := AnimatingMulti(Boxes, 100, 1);

For I := 0 To H Do
Begin
BadPoint := False;

{ Bad Boxes }
if not BadPoint then
if Length(NotBoxes) > 0 then
begin
TMP := High(NotBoxes);

for II := 0 to TMP do
if PointInBox(TPA[i], NotBoxes[II]) then
begin
MSI_Debug('Point in bad box');
BadPoint := True;
Break;
end;
end;

{ Animation }
If (Not BadPoint) Then
If MSI_Objects[objID].Anim Then
If (Not Animating2[I]) Then
Begin
MSI_Debug('Not animating!');
BadPoint := True;
End;

{ Exclude own character }
If (Not BadPoint) Then
If MSI_Objects[objID].ExcludeSelf Then
If PointInBox(TPA[I], Box) Then
Begin
MSI_Debug('Own character!');
BadPoint := True;
End;

{ Invalid point }
If (Not BadPoint) Then
If ((TPA[I].X + TPA[I].Y) < 1) Then
Begin
MSI_Debug('Invalid point!');
BadPoint := True;
End;

{ Accuracy }
If (Not BadPoint) Then
If (Length(ATPA[I]) < MSI_Objects[objID].Accuracy) Then
Begin
MSI_Debug('Not enough points!');
BadPoint := True;
End;

{ Bad colors }
If (Not BadPoint) Then
For II := 0 To High(MSI_Objects[objID].BadColors) Do
Begin
MSI_Debug('Looking for bad color: '+IntToStr(MSI_Objects[objID].BadColors[II]));
If FindColorSpiralTolerance(TMP, TMP, MSI_Objects[objID].BadColors[II], TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2), MSI_Objects[objID].BadColorTolerance) Then
Begin
MSI_Debug('Bad color found!');
BadPoint := True;
Break;
End;
End;

{ FindAllColors }
If (Not BadPoint) Then
If MSI_Objects[objID].FindAllColors Then
For II := 0 To H Do
Begin
TempTPA := MSI_ReturnPointsInBox(ATPA[II], IntToBox(TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2)));
If (Length(TempTPA) < 1) Then
Begin
MSI_Debug('All colors weren''t found!');
BadPoint := True;
Break;
End;
End;

{ Text Checking }
if not BadPoint then
if CheckText then
begin
MMouse(TPA[I].X, TPA[I].Y, 3, 3);
BadPoint := (not WaitUpText(MSI_Objects[objID].Uptext, 250));
end;

{ Valid point! }
If (Not BadPoint) Then
Begin
SetLength(Objs, Length(Objs) + 1);
Objs[High(Objs)] := TPA[I];

{ Set NotBox so point can be avoided next time }
End Else Begin
SetLength(NotBoxes, Length(NotBoxes) + 1);
NotBoxes[High(NotBoxes)] := Boxes[I];
End;
End;

Result := (Length(Objs) > 0);

MSI_CloseHeader('MSI_FindObjectsTPA: '+BoolToStr(Result));
End;

E: I've actually figured this out, and from what I've tested, it's working great. We'll see how it goes. Here's the diff if anyone's interested.

Index: C:/Simba/Includes/MSI/ACA/TREE_NORMAL_7DEC2010.aca
===================================================================
--- C:/Simba/Includes/MSI/ACA/TREE_NORMAL_7DEC2010.aca (revision 514)
+++ C:/Simba/Includes/MSI/ACA/TREE_NORMAL_7DEC2010.aca (revision 515)
@@ -1,5 +0,0 @@
-4553582
-5211769
-5938062
-5936263
-7188383
Index: C:/Simba/Includes/MSI/ACA/TREE_OAK_9DEC2010.aca
===================================================================
--- C:/Simba/Includes/MSI/ACA/TREE_OAK_9DEC2010.aca (revision 514)
+++ C:/Simba/Includes/MSI/ACA/TREE_OAK_9DEC2010.aca (revision 515)
@@ -1,11 +0,0 @@
-4619633
-4618349
-6330764
-5343099
-4223847
-6398099
-5211769
-5344896
-4487019
-6133129
-4750962
Index: C:/Simba/Includes/MSI/ACA/TREE_NORMAL_9DEC2010.aca
===================================================================
--- C:/Simba/Includes/MSI/ACA/TREE_NORMAL_9DEC2010.aca (revision 0)
+++ C:/Simba/Includes/MSI/ACA/TREE_NORMAL_9DEC2010.aca (revision 515)
@@ -0,0 +1,4 @@
+1391665
+2973010
+3038802
+2379588
Index: C:/Simba/Includes/MSI/ACA/TREE_OAK_01FEB2011.aca
===================================================================
--- C:/Simba/Includes/MSI/ACA/TREE_OAK_01FEB2011.aca (revision 0)
+++ C:/Simba/Includes/MSI/ACA/TREE_OAK_01FEB2011.aca (revision 515)
@@ -0,0 +1,12 @@
+6330764
+5343099
+6398099
+5211769
+5344896
+6133129
+6527886
+4816755
+4814700
+6464148
+4024157
+5542276
Index: C:/Simba/Includes/MSI/MSI/Skills/Woodcutting.simba
===================================================================
--- C:/Simba/Includes/MSI/MSI/Skills/Woodcutting.simba (revision 514)
+++ C:/Simba/Includes/MSI/MSI/Skills/Woodcutting.simba (revision 515)
@@ -12,7 +12,7 @@
\ _____________________________________________________________________________}

const
- TREE_MAX_DIST = 100; // Maximum pixel distance from tracking box to player
+ TREE_MAX_DIST = 75; // Maximum pixel distance from tracking box to player

{******************************************************************************}
{ function MSI_SetupWoodcutting(): Boolean; }
@@ -100,17 +100,12 @@
TPA: TPointArray;
Objs: TIntegerArray;
B: TBox;
- TreeExists, Magic: Boolean;
+ TreeExists, Debug: Boolean;
Begin
MSI_AddHeader('MSI_WaitWhileChopping');

- try
- Objs := MSI_Players[CurrentPlayer].Scripts[CurrentScript].Trees;
- except
- end;
+ Objs := MSI_Players[CurrentPlayer].Scripts[CurrentScript].Trees;

- Magic := InIntArray(Objs, TREE_MAGIC);
-
CTS := GetColorToleranceSpeed;
SetColorSpeed2Modifiers(MSI_Objects[TreeID].Hue, MSI_Objects[TreeID].Sat);

@@ -119,42 +114,55 @@
B := IntToBox(MSI_Objects[TreeID].X - HalfWidth, MSI_Objects[TreeID].Y - HalfHeight,
MSI_Objects[TreeID].X + HalfWidth, MSI_Objects[TreeID].Y + HalfHeight);

- if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
- SMART_DrawBoxEx(False, B, clRed);
-
L := Length(MSI_Objects[TreeID].Colors);
SetLength(ATPA, L);
Dec(L);
+
OldInvCount := InvCount;
- T := (GetSystemTime + ((Integer(Magic) + 2) * 20000) + Random(5000));
- TotalChopTime := (GetSystemTime + (4 * 60000)); //(GetSystemTime - (GetSystemTime + ((Integer(Magic) + 2) * 20000) + Random(5000)) div 2);
+ T := (GetSystemTime + MSI_Objects[TreeID].MaxTime + Random(5000));
+ TotalChopTime := (GetSystemTime + (4 * 60000));

- MSI_AddHeader('Entering loop');
Repeat
- MSI_FindRandoms;
+ Debug := (Random(10) < 3);

- if (not IsMoving) then
- MSI_Debug('We are not moving!');
-
If InvFull Then
Break;

+ MSI_FindRandoms;
MSI_AntiBan(RandomRange(0, 5000), ANTI_BAN_CHANCE);

{ Check if the tree Exists }
- MSI_Debug('Looking for tree');
+ if (Debug) then
+ MSI_Debug('Looking for tree');
+
For I := 0 To L Do
FindColorsTolerance(ATPA[I], MSI_Objects[TreeID].Colors[I],
B.X1, B.Y1, B.X2, B.Y2, MSI_Objects[TreeID].Tol);
TPA := MergeATPA(ATPA);
- //WriteLn(Length(TPA));
+ SortTPAFrom(TPA, Point(MSCX, MSCY));

- MiddleTPAEx(TPA, x, y);
- tDist := Distance(x, y, MSCX, MSCY);
- MSI_Debug('Track box distance: '+IntToStr(tDist));
+ if (Length(TPA) > 0) then
+ begin
+ if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
+ SMART_DrawDotsEx(True, TPA, clYellow);
+
+ // Gets distance from closest point to player
+ tDist := Distance(TPA[0].x, TPA[0].y, MSCX, MSCY);
+
+ // Resets the tracking box to a box the size of the tree located around the closest point
+ B := MSI_MakeBox(Point(TPA[0].x, TPA[0].y), MSI_Objects[TreeID].W, MSI_Objects[TreeID].H);
+
+ if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
+ SMART_DrawBoxEx(False, B, clBlue);
+ end;
+
+ if (Debug) then
+ MSI_Debug('Track box distance: '+IntToStr(tDist));
+
if (tDist > TREE_MAX_DIST) then
begin
- MSI_Debug('Tracking box is over the maximum distance');
+ if (Debug) then
+ MSI_Debug('Tracking box is over the maximum distance');
Break;
end;

@@ -169,32 +177,41 @@
Break;

{ InvCount check }
- MSI_Debug('Checking inventory count');
+ if (Debug) then
+ MSI_Debug('Checking inventory count');
+
NewInvCount := InvCount;
If (NewInvCount > OldInvCount) Then
Begin
- MSI_SubDebug('New count > old count');
+ if (Debug) then
+ MSI_SubDebug('New count > old count');
+
OldInvCount := NewInvCount;
- T := (GetSystemTime + ((Integer(Magic) + 2) * 20000) + Random(5000));
+ T := (GetSystemTime + MSI_Objects[TreeID].MaxTime + Random(5000));
End;

{ Prevent logout }
If ((TotalChopTime - GetSystemTime) < 60000) Then
Begin
- MSI_Debug('Preventing logout');
+ if (Debug) then
+ MSI_Debug('Preventing logout');
+
CT := GetCurrentTab;
Repeat
R := RandomRange(Tab_Combat, Tab_Notes);
Until(R <> CT);
GameTab(R);
- MSI_SubDebug('Clicking game tab: ' + IntToStr(R));
+
+ if (Debug) then
+ MSI_SubDebug('Clicking game tab: ' + IntToStr(R));
Wait(RandomRange(500, 1000));
End;

if (GetCurrentTab <> tab_Inv) then
MouseBox(646, 177, 662, 195, 1);
+
Until(Not TreeExists) Or (GetSystemTime > T) Or (Not LoggedIn);
- MSI_CloseHeader('Out of loop');
+
MSI_CloseHeader('MSI_WaitWhileChopping: Finished');
End;

Index: C:/Simba/Includes/MSI/MSI/Core/Objects.simba
===================================================================
--- C:/Simba/Includes/MSI/MSI/Core/Objects.simba (revision 514)
+++ C:/Simba/Includes/MSI/MSI/Core/Objects.simba (revision 515)
@@ -20,6 +20,9 @@
const
DIST_PIXEL_MOVE = 15; // MSI_TrackObject

+ var
+ NotBoxes: TBoxArray; // Used to track bad TPA points and avoid hovering wrong objects
+
{******************************************************************************}
{ function MSI_LoadObject(whichObject: Integer): Boolean; }
{ By: The MSI Team }
@@ -35,22 +38,23 @@
TREE_NORMAL:
with MSI_Objects[whichObject] do
begin
- Name := 'Normal tree';
- UpText := 'Tree';
+ Name := 'Normal Tree';
+ UpText := 'ree';
Option := 'own Tree';
- Colors := [5740425];
- Tol := 10;
- Hue := 0.04;
- Sat := 0.26;
+ Colors := [2117186];
+ Tol := 6;
+ Hue := 0.09;
+ Sat := 1.26;
FindAllColors := False;
- W := 40;
- H := 40;
- Accuracy := 20;
+ W := 35;
+ H := 35;
+ Accuracy := 10;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
+ MaxTime := 10000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_NORMAL];
@@ -59,13 +63,13 @@
TREE_OAK:
with MSI_Objects[whichObject] do
begin
- Name := 'Oak tree';
- UpText := 'wn Oak';
- Option := 'Chop down Oak';
- Colors := [5343613];
- Tol := 8;
- Hue := 0.05;
- Sat := 0.36;
+ Name := 'Oak Tree';
+ UpText := 'own Oak';
+ Option := 'own Oak';
+ Colors := [6330764, 6398099, 6133129, 6527886, 6464148];
+ Tol := 10;
+ Hue := 0.07;
+ Sat := 0.64;
FindAllColors := False;
W := 50;
H := 50;
@@ -75,6 +79,7 @@
Tries := 5;
Anim := False;
WaitToMove := True;
+ MaxTime := 20000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_OAK];
@@ -99,6 +104,7 @@
Tries := 5;
Anim := False;
WaitToMove := True;
+ MaxTime := 30000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_WILLOW];
@@ -123,6 +129,7 @@
Tries := 5;
Anim := False;
WaitToMove := True;
+ MaxTime := 35000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_MAPLE];
@@ -131,22 +138,23 @@
TREE_YEW:
with MSI_Objects[whichObject] do
begin
- Name := 'Yew tree';
- UpText := 'wn Yew';
+ Name := 'Yew Tree';
+ UpText := 'own Yew';
Option := 'Chop down Yew';
- Colors := [5409662];
- Tol := 13;
- Hue := 0.04;
- Sat := 0.29;
+ Colors := [2314052];
+ Tol := 9;
+ Hue := 0.06;
+ Sat := 0.59;
FindAllColors := False;
- W := 35;
- H := 35;
- Accuracy := 10;
+ W := 50;
+ H := 50;
+ Accuracy := 15;
ExcludeSelf := True;
RightClickOnly := False;
Tries := 5;
Anim := False;
WaitToMove := True;
+ MaxTime := 60000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_YEW];
@@ -171,6 +179,7 @@
Tries := 20;
Anim := False;
WaitToMove := True;
+ MaxTime := 60000;
BadColors := [];
BadColorTolerance := 10;
AssociatedItems := [LOGS_MAGIC];
@@ -1006,7 +1015,7 @@
{******************************************************************************}
{ Function MSI_FindObjectsTPA( ... ): Boolean; }
{ By: marpis }
-{ Date: 25 June 2010 }
+{ Date: Updated 01 February 2011 by Coh3n }
{ Description: Finds objects in mainscreen, saves co-ords in TPA }
{******************************************************************************}
Function MSI_FindObjectsTPA(Var Objs: TPointArray; ObjID: integer; SearchBox: TBox): Boolean;
@@ -1019,12 +1028,13 @@
Animating2: TBooleanArray;
BadPoint: Boolean;
Begin
- If (Not LoggedIn) Then Exit;
+ If (Not LoggedIn) Then
+ Exit;

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[objID].Hue, MSI_Objects[objID].Sat);
- Box := IntToBox(228, 150, 275, 200);
+ Box := IntToBox(249, 146, 276, 187); // Box around player

H := High(MSI_Objects[objID].Colors);
SetLength(ATPA, H + 1);
@@ -1040,7 +1050,7 @@
For I := 0 To H Do
If (Length(ATPA) < 1) Then
Begin
- MSI_SubDebug('MSI_FindObjectsTPA: All colors weren''t found!');
+ MSI_SubDebug('All colors weren''t found!');
Objs := [];
Exit;
End;
@@ -1050,7 +1060,7 @@

If (Length(TPA) < MSI_Objects[objID].Accuracy) Then
Begin
- MSI_SubDebug('MSI_FindObjectsTPA: No colors found!');
+ MSI_SubDebug('No colors found!');
Wait(RandomRange(300, 600));
Objs := [];
Exit;
@@ -1071,87 +1081,104 @@
SetLength(Boxes, H + 1);

For I := 0 To H Do
- Begin
- Boxes[I].X1 := TPA[I].X - (MSI_Objects[objID].W / 2);
- Boxes[I].Y1 := TPA[I].Y - (MSI_Objects[objID].H / 2);
- Boxes[I].X2 := TPA[I].X + (MSI_Objects[objID].W / 2);
- Boxes[I].Y2 := TPA[I].Y + (MSI_Objects[objID].H / 2);
- End;
+ Boxes[I]:= MSI_MakeBox( Point(TPA[I].X, TPA[I].Y),
+ (MSI_Objects[objID].W / 2),
+ (MSI_Objects[objID].H / 2)
+ );

If MSI_Objects[objID].Anim Then
Animating2 := AnimatingMulti(Boxes, 100, 1);

- For I := 0 To High(TPA) Do
+ For I := 0 To H Do
Begin
BadPoint := False;
- //DrawBox(Boxes[I], 200);

+ { Bad Boxes }
+ if not BadPoint then
+ if Length(NotBoxes) > 0 then
+ begin
+ TMP := High(NotBoxes);
+
+ for II := 0 to TMP do
+ if PointInBox(TPA[i], NotBoxes[II]) then
+ begin
+ MSI_SubDebug('Point in bad box');
+ BadPoint := True;
+ Break;
+ end;
+ end;
+
{ Animation }
If (Not BadPoint) Then
- If MSI_Objects[objID].Anim Then
- If (Not Animating2[I]) Then
- Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Not animating!');
- BadPoint := True;
- End;
+ If MSI_Objects[objID].Anim Then
+ If (Not Animating2[I]) Then
+ Begin
+ MSI_SubDebug('Not animating!');
+ BadPoint := True;
+ End;

{ Exclude own character }
If (Not BadPoint) Then
- If MSI_Objects[objID].ExcludeSelf Then
- If PointInBox(TPA[I], Box) Then
+ If MSI_Objects[objID].ExcludeSelf Then
+ If PointInBox(TPA[I], Box) Then
+ Begin
+ MSI_SubDebug('Own character!');
+ BadPoint := True;
+ End;
+
+ { Invalid point }
+ If (Not BadPoint) Then
+ If ((TPA[I].X + TPA[I].Y) < 1) Then
Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Own character!');
+ MSI_SubDebug('Invalid point!');
BadPoint := True;
End;

- { Invalid point }
- If (Not BadPoint) Then
- If ((TPA[I].X + TPA[I].Y) < 1) Then
- Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Invalid point!');
- BadPoint := True;
- End;
-
{ Accuracy }
If (Not BadPoint) Then
- If (Length(ATPA[I]) < MSI_Objects[objID].Accuracy) Then
- Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Not enough points!');
- BadPoint := True;
- End;
-
- { Bad colors }
- If (Not BadPoint) Then
- For II := 0 To High(MSI_Objects[objID].BadColors) Do
- Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Looking for bad color: '+IntToStr(MSI_Objects[objID].BadColors[II]));
- If FindColorSpiralTolerance(TMP, TMP, MSI_Objects[objID].BadColors[II], TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2), MSI_Objects[objID].BadColorTolerance) Then
+ If (Length(ATPA[I]) < MSI_Objects[objID].Accuracy) Then
Begin
- MSI_SubDebug('MSI_FindObjectsTPA: Bad color found!');
+ MSI_SubDebug('Not enough points!');
BadPoint := True;
- Break;
End;
- End;

- { FindAllColors }
+ { Bad colors }
If (Not BadPoint) Then
- If MSI_Objects[objID].FindAllColors Then
- For II := 0 To H Do
+ For II := 0 To High(MSI_Objects[objID].BadColors) Do
Begin
- TempTPA := MSI_ReturnPointsInBox(ATPA[II], IntToBox(TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2)));
- If (Length(TempTPA) < 1) Then
+ MSI_SubDebug('Looking for bad color: '+IntToStr(MSI_Objects[objID].BadColors[II]));
+ If FindColorSpiralTolerance(TMP, TMP, MSI_Objects[objID].BadColors[II], TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2), MSI_Objects[objID].BadColorTolerance) Then
Begin
- MSI_SubDebug('MSI_FindObjectsTPA: All colors weren''t found!');
+ MSI_SubDebug('Bad color found!');
BadPoint := True;
Break;
End;
End;

+ { FindAllColors }
+ If (Not BadPoint) Then
+ If MSI_Objects[objID].FindAllColors Then
+ For II := 0 To H Do
+ Begin
+ TempTPA := MSI_ReturnPointsInBox(ATPA[II], IntToBox(TPA[I].X - (MSI_Objects[objID].W / 2), TPA[I].Y - (MSI_Objects[objID].H / 2), TPA[I].X + (MSI_Objects[objID].W / 2), TPA[I].Y + (MSI_Objects[objID].H / 2)));
+ If (Length(TempTPA) < 1) Then
+ Begin
+ MSI_SubDebug('All colors weren''t found!');
+ BadPoint := True;
+ Break;
+ End;
+ End;
+
{ Valid point! }
If (Not BadPoint) Then
Begin
SetLength(Objs, Length(Objs) + 1);
Objs[High(Objs)] := TPA[I];
+
+ { Set NotBox so point can be avoided next time }
+ End Else Begin
+ SetLength(NotBoxes, Length(NotBoxes) + 1);
+ NotBoxes[High(NotBoxes)] := Boxes[I];
End;
End;

@@ -1162,7 +1189,7 @@
{******************************************************************************}
{ function MSI_TrackObject(var ObjInfo: TMSObject): boolean; }
{ By: marpis & Sir R. Magician }
-{ Date: 09 August 2010 }
+{ Date: Updated Feb. 1st 2011 by Coh3n }
{ Description: Follows object while moving (ObjInfo.X, ObjInfo.Y) }
{******************************************************************************}
function MSI_TrackObject(ObjID: integer): boolean;
@@ -1183,7 +1210,7 @@
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSI_Objects[ObjID].Hue, MSI_Objects[ObjID].Sat);

- //Preparing vars for loop
+ // Preparing vars for loop
DistMultiplier := Distance(MSCX, MSCY, MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y) / 40;
if DistMultiplier < 1.0 then DistMultiplier := 1.0;
BreakNext := false;
@@ -1192,9 +1219,15 @@

repeat
B := MSI_MakeBox(Point(MSI_Objects[ObjID].X, MSI_Objects[ObjID].Y),
- round(MSI_Objects[ObjID].W * DistMultiplier),
- round(MSI_Objects[ObjID].H * DistMultiplier));
+ round(MSI_Objects[ObjID].W * DistMultiplier),
+ round(MSI_Objects[ObjID].H * DistMultiplier));

+ // Sets the limits of the box (so it doesn't exceed the Mainscreen)
+ if (B.X1 < MSX1) then B.X1 := MSX1;
+ if (B.Y1 < MSY1) then B.Y1 := MSY1;
+ if (B.X2 > MSX2) then B.X2 := MSX2;
+ if (B.Y2 > MSY2) then B.Y2 := MSY2;
+
if (MSI_SetupVars[SETUP_DEBUG_SMART]) then
SMART_DrawBoxEx(True, B, clYellow);

@@ -1255,12 +1288,13 @@
Var
TPA, TmpTPA: TPointArray;
TheOptions, UpTexts: TStringArray;
- I, II, III, HH, HHH, Hi: Integer;
- CheckUpText: Boolean;
+ I, II, III, HH, HHH, Hi, J: Integer;
+ CheckUpText, inBadBox: Boolean;
Begin
MSI_AddHeader('MSI_FindObjectsIn ' + ToStr(Objs));

Hi := High(Objs);
+
SetLength(TheOptions, Hi + 1);
SetLength(UpTexts, Hi + 1);
For I := 0 To Hi Do
@@ -1271,88 +1305,113 @@

For II := 0 To Hi Do
With MSI_Objects[Objs[II]] Do
- If MSI_FindObjectsTPA(TmpTPA, Objs[II], SearchBox) Then
- Begin
- // If set to, the script will click the closest object (this negates Priority)
- if (MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript].Name].ClickClosest) then
- begin
- MSI_Debug('Clicking closest object to player');
- for i := 0 to High(Objs) do
- if (MSI_FindObjectsTPA(TmpTPA, Objs[i], SearchBox)) then
- begin
- //Writeln('Obj'+IntToStr(i));
- TPA := CombineTPA(TPA, TmpTPA);
- end;
+ If MSI_FindObjectsTPA(TmpTPA, Objs[II], SearchBox) Then
+ Begin
+ // If set to, the script will click the closest object (this negates Priority)
+ if (MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript].Name].ClickClosest) then
+ begin
+ MSI_Debug('Clicking closest object to player');
+
+ for i := 0 to High(Objs) do
+ if (MSI_FindObjectsTPA(TmpTPA, Objs[i], SearchBox)) then
+ begin
+ //Writeln('Obj'+IntToStr(i));
+ TPA := CombineTPA(TPA, TmpTPA);
+ end;
+
SortTPAFrom(TPA, Point(MSCX, MSCY));
- end else
- TPA := TmpTPA;
+ end else
+ TPA := TmpTPA;

- HH := Min((Tries - 1), High(TPA));
-
- For I := 0 to HH Do
- Begin
+ HH := Min((Tries - 1), High(TPA));
MSI_Debug(IntToStr(Length(TPA))+' objects found!');
- X := TPA[I].X;
- Y := TPA[I].Y;
- IndexFound := II;

- If (Action = Nothing) Then
+ For I := 0 to HH Do
Begin
- Result := True;
- MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
- Exit;
- End;
+ // Check to see if the point is in a bad box
+ if (Length(NotBoxes) > 0) then
+ for j := 0 to High(NotBoxes) do
+ if (PointInBox(TPA[i], NotBoxes[j])) then
+ begin
+ MSI_Debug('Point in bad box');
+ inBadBox := True;
+ Break;
+ end;

- HHH := High(UpTexts);
- CheckUpText := True;
- For III := 0 To HHH Do
- If (UpTexts[III] = '') Then
+ if (inBadBox) then
+ Continue;
+
+ X := TPA[I].X;
+ Y := TPA[I].Y;
+ IndexFound := II;
+
+ If (Action = Nothing) Then
Begin
- CheckUpText := False;
- Break;
+ Result := True;
+ MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
+ NotBoxes := [];
+ Exit;
End;

- MMouse(TPA[I].X, TPA[I].Y, 2, 2);
- Wait(20 + Random(50));
+ HHH := High(UpTexts);
+ CheckUpText := True;
+ For III := 0 To HHH Do
+ If (UpTexts[III] = '') Then
+ Begin
+ CheckUpText := False;
+ Break;
+ End;

- If CheckUpText Then
- Result := WaitUpTextMulti(UpTexts, 150 + Random(20))
- Else
- Result := True;
+ MMouse(TPA[I].X, TPA[I].Y, 2, 2);
+ Wait(20 + Random(50));

- If (Action = Move) Then
- begin
- MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
- Exit;
- end;
+ If CheckUpText Then
+ if (WaitUpTextMulti(UpTexts, 150 + Random(20))) then
+ begin
+ MSI_Debug('Uptext found!');
+ Result := True;
+ end else begin
+ SetLength(notBoxes, Length(notBoxes) + 1);
+ notBoxes[High(notBoxes)] := MSI_MakeBox(Point(TPA[I].X, TPA[I].Y), (W / 2), (H / 2));
+ end
+ Else
+ Result := True;

- If Result Then
- Begin
- GetMousePos(X, Y);
- If (MSI_Objects[Objs[II]].RightClickOnly) Or InRange(Random(100), 0, 20) Or (Action = ClickRight) Then
+ If (Action = Move) Then
+ begin
+ MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
+ NotBoxes := [];
+ Exit;
+ end;
+
+ If Result Then
Begin
- Mouse(X, Y, 0, 0, False);
- If (Action = ClickRight) or (Action = ClickLeft) Then
- Result := WaitOptionMulti(TheOptions, 750 + Random(100))
- Else
+ GetMousePos(X, Y);
+
+ If (MSI_Objects[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 := True;
- End Else
- Begin
- Mouse(X, Y, 0, 0, True);
- Result := DidRedClick;
- End;
+ End;

- If MSI_Objects[Objs[II]].WaitToMove Then
- MSI_TrackObject(Objs[II]);
+ If MSI_Objects[Objs[II]].WaitToMove Then
+ MSI_TrackObject(Objs[II]);

- MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
- Exit;
- End Else Begin
- MSI_FindRandoms;
- MSI_Debug('Uptext didn''t match!');
+ MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
+ NotBoxes := [];
+ Exit;
+ End Else Begin
+ MSI_FindRandoms;
+ MSI_Debug('Uptext didn''t match!');
+ End;
End;
End;
- End;

MSI_CloseHeader('MSI_FindObjectsIn: ' + BoolToStr(Result));
MSI_FindRandoms;
Index: C:/Simba/Includes/MSI/MSI/Core/Locations.simba
===================================================================
--- C:/Simba/Includes/MSI/MSI/Core/Locations.simba (revision 514)
+++ C:/Simba/Includes/MSI/MSI/Core/Locations.simba (revision 515)
@@ -24,6 +24,7 @@
Name := 'Powerskilling';
Constant := LOC_POWER_SKILL;
AtBank := False;
+ RelocateDist := 30;
end;

LOC_LOST:
Index: C:/Simba/Includes/MSI/MSI/Core/Walking_Reflection.simba
===================================================================
--- C:/Simba/Includes/MSI/MSI/Core/Walking_Reflection.simba (revision 514)
+++ C:/Simba/Includes/MSI/MSI/Core/Walking_Reflection.simba (revision 515)
@@ -127,7 +127,6 @@
*)
function MSI_LoadTilePath(sLoc, eLoc: Integer): T2DPointArray;
var
- i, t: Integer;
Script: TScript;
begin
Script := MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript].Name];
Index: C:/Simba/Includes/MSI/MSI/Core/Globals.simba
===================================================================
--- C:/Simba/Includes/MSI/MSI/Core/Globals.simba (revision 514)
+++ C:/Simba/Includes/MSI/MSI/Core/Globals.simba (revision 515)
@@ -666,17 +666,18 @@
Option : string;
Exp : Extended;
Colors : TIntegerArray;
- FindAllColors : Boolean; // Result False if not ALL colors are found
+ FindAllColors : Boolean; // Set to true if each TPA needs to include every color in 'Colors'
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
+ Accuracy : Integer; // Min pixels to be found in each TPA
+ ExcludeSelf : Boolean; // Exclude pixels in a box around the player
RightClickOnly : Boolean;
Tries : Integer;
- Anim : Boolean; // Result False if not animating
+ Anim : Boolean; // Set to true if object is animating
WaitToMove : Boolean; // When ClickLeft, wait till we have stopped moving?
+ MaxTime : Integer; // Max time (in ms) to wait for the object to disappear
BadColors : TIntegerArray;
BadColorTolerance: Integer;
AssociatedItems : TIntegerArray;
There's also a few other updates in there. Check the SVN log for the specifics.

Home

2011-02-02 06:02:26

MMToMS Look in FindObjectThroughMM.


~Home


(OpenBankNPC)

Gu3st...

2011-02-02 06:07:07

OpenBankNPC works poorly imo

Home

2011-02-03 07:11:02

From: Zyt3x
OpenBankNPC works poorly imo


Point was not OpenBankNPC Function, point was that Naike created MMToMS Color version.


~Home