Guild Miner - The Works
Sir R. M8gic1an
2009-11-17 09:21:08
As SRL Members will know, I'm working on a new script. I've set myself the aim of being the best ever written script I have so far. This is in terms of look and functonality.
Yesterday, I started brainstorming. Today, I started writing.
It's a Guild Miner, and I'll be using a system that I have only ever seen 3 people use. For Color finding I'll be using an Artificial Intelligence (AI) system, which I learnt off / taught by Tarajunky, and that then I passed on to EvilChicken!, although we all made public threads about it. We then each developed it in different directions, although none of us ever got to finish a propper include to put in SRL.
Hopefully, this time around, 2 years later and with a lot more of experience, I'll be able to finish it and put it in SRL for everyone's use.
So anyway, here is the starts of my work:
[php]
// RM
// Guild Miner
const
//Rock indexes
ROCK_COAL = 0;
ROCK_MITH = 1;
//SmartColors Specifics
UNIQUE_COLOR_MAX = 20;
HALF_BOX_SIZE = 25;
//Clicking Style
CLICK_STYLE = 3;
LEFT_CLICK = 1;
RIGHT_CLICK = 2;
RANDOM_RL_CLICK = 3;
RANDOM_RL_CHANCE = 30; // x / 100 for R click
//Timing
UPTEXT_TIME = 300; // ms
RANDOM_WAIT = 50; // ms
type
{ Type TMSObj
Description: To be used for finding on the MS. Stores all necessary
information. }
TMSObj = record
Name : string;
ID : integer;
UpTexts : TStringArray;
Options : TStringArray;
Color : integer;
Tol : integer;
Hue : extended;
Sat : extended;
SCArray : TIntegerArray;
end;
{*******************************************************************************
Function AnalyseColor(Color: integer): integer;
By: Rasta Magician
Description: Scans MS for Color, returning the number of times it was found
*******************************************************************************}
Function AnalyseColor(Color: integer): integer;
var
CTS, Length : integer;
TPA : TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
FindColors(TPA, Color, MSX1, MSY1, MSX2, MSY2)
Length := Length(TPA);
//this will avoid a useless color returning a false positive
if Length = 0 then Length := MAX_UNIQUE_COLOR + 10;
Result := Length;
ColorToleranceSpeed(CTS);
end;
{*******************************************************************************
Function OrganizeColors(Colors, Lengths: TIntegerArray): TIntegerArray;
By: Rasta Magician
Description: Organizes Colors, rarest first, returns organized TIntegerArray
*******************************************************************************}
Function OrganizeColors(Colors, Lengths: TIntegerArray): TIntegerArray;
var
Ic, HighColors: integer;
begin
HighColors := High(Colors)
while (Ic <= HighColors) do
for Ic := 0 to HighColors do
if (Lengths[Ic + 1] < Lengths[Ic]) then
begin
swap(Lengths[Ic + 1], Lengths[Ic]);
swap(Colors[Ic + 1], Colors[Ic]);
break;
end;
Result := Colors;
end;
{*******************************************************************************
Function GatherColors(var Rock: TMSObj): boolean;
By: Rasta Magician
Description: Gathers Colors from a box with double side length of
HALF_BOX_SIZE which match the Color and Tol from TMSObj
with the Hue and Sat modifiers and CTS 2
Sets TMSObj.SCArray to the gathered colors
*******************************************************************************}
Function GatherColors(var Rock: TMSObj): boolean;
var
x, y, i, CTS, RockColorIndex, L: integer;
TPA: TPointArray;
ColorArray, LengthArray: TIntegerArray;
begin
if not LoggedIn then exit;
if not IsUpTextMultiCustom(Rock.UpTexts) then exit;
GetMousePos(x, y);
CTS := GetColorToleranceSpeed;
//scanning colors around in a 50x50 box
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Rock.Hue, Rock.Sat);
if not FindColorsTolerance(
TPA, Rock.Color,
x - HALF_BOX_SIZE, y - HALF_BOX_SIZE,
x + HALF_BOX_SIZE, y + HALF_BOX_SIZE,
Rock.Tol
)
then
exit;
ColorArray := GetColors(TPA);
ClearSameIntegers(ColorArray);
//analysing colors for uniqueness
L := Length(TIA);
SetLength(Rock.Colors, L);
SetLength(LengthArray, L);
for i:= 0 to High(ColorArray) do
begin
L := AnalyzeColor(ColorArray);
if L <= UNIQUE_COLOR_MAX then
begin
Rock.Colors[RockColorIndex] := ColorArray;
LengthArray := L;
Inc(RockColorIndex);
end;
end;
SetLength(Rock.Colors, RockColorIndex + 1);
Rock.Colors := OrganizeColors(Rocks.Colors, LengthArray);
end;
{*******************************************************************************
Function CheckAndClick(Pos: TPoint, Rock: TMSObj): boolean;
By: Rasta Magician
Description: Checks Pos for matches with Rock.UpTexts. Return true if
found and click according to CLICK_STYLE
*******************************************************************************}
Function CheckAndClick(Pos: TPoint, Rock: TMSObj): boolean;
var
x, y, ClickType: integer;
begin
MMouse(Pos.x, Pos.y, 2, 2);
if WaitUpTexts(Rock.UpTexts, UPTEXT_TIME) then
begin
wait(Random(RANDOM_WAIT));
Result := true;
GetMousPos(x, y);
if CLICK_STYLE = RANDOM_RL_CLICK then
if random(100) <= RANDOM_RL_CHANCE then
ClickType := RIGHT_CLICK;
case ClickType of
LEFT_CLICK:
Mouse(x, y, 0, 0, True);
RIGHT_CLICK:
begin
Mouse(x, y, 0, 0, false);
ChooseOptions(Rock.Options);
end;
end;
end;
[/php]
This AI system analyses colors and will then search for them with 0 tol, making it extremely fast, and it'll organize the colors in an array so that the ones that return the most positive results are the first ones to be searched for. This part is not yet written.
This is just the start of it, some of it will be rewritten. The use of constants is the same as it will be for SRL 5, so take a good notice of that ;)
~RM
Nava2
2009-11-17 10:47:56
CLICK_STYLE = 3;
LEFT_CLICK = 1;
RIGHT_CLICK = 2;
RANDOM_RL_CLICK = 3;
RANDOM_RL_CHANCE = 30
TMouseAction?
Shady?
2009-11-17 12:07:03
Sounds like you're putting a lot of effort on this, i hope you get the ai system done so it finally gets into SRL.
Good luck with the script too.
Gu3st...
2009-11-17 12:22:12
Wow, I never heard about an AI system for color finding before.. It looks like worth learning :)
Good luck RM
Wanted
2009-11-17 20:37:11
Would be a good idea to put small waits between MMouse/Uptext and Mouse(…False); / ChooseOption
Sir R. M8gic1an
2009-11-17 21:37:01
From: IceFire908
Would be a good idea to put small waits between MMouse/Uptext and Mouse(…False); / ChooseOption
No need for the wait for UpText as I am using WaitUpTexts, which cycles for UPTEXT_TIME until it finds it, but good suggestion for the chooseOption wait. :)
~RM
Brain
2009-11-17 21:47:49
if you need testers in the future, even if you just want to borrow accounts so you can watch it run, I can provide 5 or 6 for however long you'll need them, or I can run it and give my thoughts. I did tons of testing on
Shermanator's guild miner back in the day.
JPHamlett
2009-11-17 21:53:04
From: Brain
if you need testers in the future, even if you just want to borrow accounts so you can watch it run, I can provide 1 or 2 for however long you'll need them, or I can run it and give my thoughts.
smae for me
Daniel
2009-11-18 03:47:25
You're using a pretty slow sorting algorithm in OrganizeColoUrs (Bubble Sort algorithm) ;)
Looks overly alright.
Sir R. M8gic1an
2009-11-18 05:12:48
[QUOTE=Dan's The Man;656934]You're using a pretty slow sorting algorithm in OrganizeColoUrs (Bubble Sort algorithm) ;)
Looks overly alright.
Well the problem is i have to sort the two arrays together, and i didn't really look much into algorithms, i just did it :p
~RM
EvilChicken!
2009-11-18 06:48:16
QuickSort > BubbleSort.
Yeah, good luck with the SmartColors system.
As I said, tell me if there's anything.
I'd be glad to help.
Bionicle
2009-11-18 18:04:38
Tara used this in his chicken killer script rite? Hopefully your script will run for half a month too :p! Good luck!
WT-Fakawi
2009-11-18 18:44:55
Wouldnt it be more challenging to use AI for interaction: How many players are there in the field? Are there any players around me? What are they saying? Adapt your script according to the circumstances. If the mine is empty f.i. do a minefrenzy, but when it is crowded pay attention to legits. It is the only thing that gives a bot away imho. I remember the anger when stupid level-3 bots mined my precious autoed Coal ;)
Daniel
2009-11-19 05:51:57
From: EvilChicken!
QuickSort > BubbleSort.
Shell Sort > Quick Sort
From: WT-Fakawi
Wouldnt it be more challenging to use AI for interaction: How many players are there in the field? Are there any players around me? What are they saying? Adapt your script according to the circumstances. If the mine is empty f.i. do a minefrenzy, but when it is crowded pay attention to legits. It is the only thing that gives a bot away imho. I remember the anger when stupid level-3 bots mined my precious autoed Coal ;)
Well, with the
"minefrenzy" technique and how many players there are should be easy (except for ones in the same coordinates as another). Simply a FindColorsTolerance, FilterPointsPie and a SplitTPA :)
Sir R. M8gic1an
2009-11-19 13:52:10
From: WT-Fakawi
Wouldnt it be more challenging to use AI for interaction: How many players are there in the field? Are there any players around me? What are they saying? Adapt your script according to the circumstances. If the mine is empty f.i. do a minefrenzy, but when it is crowded pay attention to legits. It is the only thing that gives a bot away imho. I remember the anger when stupid level-3 bots mined my precious autoed Coal ;)
I don't consider that to be AI, just to be inteligent. AI means that it learns more as it is run; The color system does this, the longer it runs, the better it gets at finding the rocks.
However, these are, as usual, extremely good suggestions.
I might as a very big challenge attempt to make an AI autoresponder.
Edit: As for the sorting algorithm, this one takes 0.22 ms, so no matter what algorithm I use, it's going to be under 1 ms, meaning not much difference. However, i might use the Bublesort algorithm just for the kicks of implementing it.
EDIT 2: Btw, for the include, I'll make it so it is this easy to use:
begin
MyObj := MakeTMSObj('mithril', COLOR, TOL, HUE, SAT, [UPTEXTS],[OPTIONS]);
SmartColors(MyObj);
end;
or
begin
MyObj := MakeTMSObj('mithril', COLOR, TOL, HUE, SAT, [UPTEXTS],[OPTIONS]);
SmartColors('mithril');
end;
~RM
Nava2
2009-11-19 14:42:44
From: Rasta Magician
I don't consider that to be AI, just to be inteligent. AI means that it learns more as it is run; The color system does this, the longer it runs, the better it gets at finding the rocks.
However, these are, as usual, extremely good suggestions.
I might as a very big challenge attempt to make an AI autoresponder.
Edit: As for the sorting algorithm, this one takes 0.22 ms, so no matter what algorithm I use, it's going to be under 1 ms, meaning not much difference. However, i might use the Bublesort algorithm just for the kicks of implementing it.
EDIT 2: Btw, for the include, I'll make it so it is this easy to use:
begin
MyObj := MakeTMSObj('mithril', COLOR, TOL, HUE, SAT, [UPTEXTS],[OPTIONS]);
SmartColors(MyObj);
end;
or
begin
MyObj := MakeTMSObj('mithril', COLOR, TOL, HUE, SAT, [UPTEXTS],[OPTIONS]);
SmartColors('mithril');
end;
~RM
No Strings! Constants!
Also, I see you like the constructor ;)
Sir R. M8gic1an
2009-11-19 14:47:40
From: Nava2
No Strings! Constants!
Also, I see you like the constructor ;)
The use of the string will not be for my script personally, in the script i will use constants, but for ease of use I will make it a string when I put SmartColors in SRL.
And yes, I guess Java is indeed influencing my scripting style a bit :p
~RM
Nava2
2009-11-19 14:50:42
From: Rasta Magician
The use of the string will not be for my script personally, in the script i will use constants, but for ease of use I will make it a string when I put SmartColors in SRL.
And yes, I guess Java is indeed influencing my scripting style a bit :p
~RM
Eek, I would still say constants for in SRL. String cases are very slow, especially when you have a massive amount of options.
Java is win :)
_ChArMz
2009-11-19 14:52:31
I made a private guild miner a little bit ago and this is what i found/did:
No need for "smart" colors, just gather many from diff worlds, and find using the best CTS2 and HSL tol
Detect the MS angle of the rock you are about to click, because the viens of the rocks that are north will sometimes get covered by you/your pickaxe…then instead of just searching for a single FindColorSpiral(after updateing the coords), u can adapt a for do loop Findcolor then a wait
Use something similar to the old gas finder, that would determine the change in pixels around the rock, to check to see if there are other miners around the rock
Sir R. M8gic1an
2009-11-19 16:35:54
The SmartColors include is progresing well,
var
SCObjectsArray: Array of TMSObj;
Procedure MakeObj(MyName: string; MyColor, MyTol: integer; MyHue, MySat: extended; MyUpTexts, MyOptions: TStringArray);
var
L: integer;
begin
L := Length(SCObjectsArray);
SetLength(SCObjectsArray, L + 1);
with SCObjectsArray[L] do
begin
Name := MyName;
UpTexts := MyUpTexts;
Options := MyOptions;
Color := MyColor;
Tol := MyTol;
Hue := MyHue;
Sat := MySat;
end;
end;
Function GetObject(Which: string; var ObjID: integer): TMSObj;
var
i, L : integer;
MyName : string;
begin
L := High(SCObjectsArray);
MyName := lowercase(Which);
for i:= 0 to L do
if MyName = lowercase(SCObjectsArray[i].Name) then
begin
Result := SCObjectsArray[i];
ObjID := i;
break;
end;
end;
So far it compiles and theoretically works, haven't tested it in a real sitation yet, and there is still some functionality to add to it, however, the way to use it is already implemented and simple.
begin
MakeObj('mith', 3345532, 5, 3.0, 3.0, ['UpText'], ['ChooseOption']);
SmartColors('mith');
end.
@Charms: Although you are probably right and I dont NEED SmartColors, this is an include i've been wanting to get done for a very long time, and this was just the perfect opportunity. Also, I told myself this would be my best ever written script, so I'll be putting all my most advanced methods into it, and improving them.
~RM
mastaraymond
2009-11-19 18:32:41
From: Rasta Magician
The SmartColors include is progresing well,
var
SCObjectsArray: Array of TMSObj;
Procedure MakeObj(MyName: string; MyColor, MyTol: integer; MyHue, MySat: extended; MyUpTexts, MyOptions: TStringArray);
var
L: integer;
begin
L := Length(SCObjectsArray);
SetLength(SCObjectsArray, L + 1);
with SCObjectsArray[L] do
begin
Name := MyName;
UpTexts := MyUpTexts;
Options := MyOptions;
Color := MyColor;
Tol := MyTol;
Hue := MyHue;
Sat := MySat;
end;
end;
Function GetObject(Which: string; var ObjID: integer): TMSObj;
var
i, L : integer;
MyName : string;
begin
L := High(SCObjectsArray);
MyName := lowercase(Which);
for i:= 0 to L do
if MyName = lowercase(SCObjectsArray[i].Name) then
begin
Result := SCObjectsArray[i];
ObjID := i;
break;
end;
end;
So far it compiles and theoretically works, haven't tested it in a real sitation yet, and there is still some functionality to add to it, however, the way to use it is already implemented and simple.
begin
MakeObj('mith', 3345532, 5, 3.0, 3.0, ['UpText'], ['ChooseOption']);
SmartColors('mith');
end.
@Charms: Although you are probably right and I dont NEED SmartColors, this is an include i've been wanting to get done for a very long time, and this was just the perfect opportunity. Also, I told myself this would be my best ever written script, so I'll be putting all my most advanced methods into it, and improving them.
~RM
Still dislike the fact you're using strings :D.
Nava2
2009-11-19 20:46:29
Use an array and have it return an index which you can set to a variable..
Like DTMs and Bitmaps in SCAR. Strings are sillly for this.
Sir R. M8gic1an
2009-11-19 20:57:35
From: Nava2
Use an array and have it return an index which you can set to a variable..
Like DTMs and Bitmaps in SCAR. Strings are sillly for this.
you'd need a global var to use it if you are going to call it in several places if i make it return an index. I really don't want to approach it that way, as I want this to be stupidly simply to use.
~RM
Nava2
2009-11-19 21:01:30
From: Rasta Magician
you'd need a global var to use it if you are going to call it in several places if i make it return an index. I really don't want to approach it that way, as I want this to be stupidly simply to use.
~RM
Since when is stupidly simple the best option?
Sir R. M8gic1an
2009-11-20 03:48:30
From: Nava2
Since when is stupidly simple the best option?
Well, I can either choose to save 1 ms and make it complicated or make it really simple to use. Considering it's an include, I preffer simple.
~RM
marpis
2009-11-20 12:01:21
Isn't 50x50 a bit large area to search for rock colours? I'd suggest more like 15x15, cause the are doesn't need to cover the whole rock because you will take more colours everytime you mine (I assume?) so all the good rock colours would anyways get picked sooner or later.
Nice, I hope you can complete it, and have it working. Btw, do you think you can make a gold mining/banking script, with mining taking place in crafting guild to nearest bank?
Sir R. M8gic1an
2009-11-21 11:00:27
[PHP]
SRL Compiled in 46 msec
SC Array: 0
first finder
found text
gatheing colors
in color gatherer
Analyse 4293751: 7
Analyse 4819837: 8
Analyse 4952452: 11
Analyse 3767920: 33
Analyse 4359800: 17
Analyse 4818554: 30
Analyse 5543818: 7
Analyse 5212798: 30
Analyse 3633767: 8
Analyse 4093805: 30
Analyse 4425850: 24
Analyse 4291439: 16
Analyse 5543304: 6
Analyse 4424052: 11
Analyse 5084551: 10
Analyse 3832429: 16
Analyse 5543560: 12
Analyse 3899763: 37
Analyse 4293750: 16
Analyse 3568487: 10
Analyse 4620405: 30
Analyse 5806220: 7
Analyse 5213568: 10
Analyse 3964272: 30
Analyse 3967612: 5
Analyse 3966069: 25
Analyse 4030580: 30
Analyse 4555895: 13
Analyse 4558464: 9
Analyse 5411461: 8
Analyse 5674377: 5
Analyse 3504749: 5
Analyse 4032376: 56
Analyse 5083780: 11
Analyse 5807504: 13
Analyse 5610124: 8
Analyse 4884604: 30
Analyse 4558207: 10
Analyse 4161908: 15
Analyse 4883320: 30
Analyse 5477768: 10
Analyse 4033918: 12
Analyse 4623999: 37
Analyse 5084038: 7
Analyse 6070419: 17
Analyse 5345668: 9
Analyse 5213312: 6
Analyse 4687481: 11
Analyse 3965042: 73
Analyse 6202262: 30
Analyse 5609354: 18
Analyse 4161394: 8
Analyse 4754302: 5
Analyse 3635307: 10
Analyse 4228471: 9
Analyse 3833713: 34
Analyse 5808017: 11
Analyse 4557950: 13
Analyse 3831402: 7
Analyse 4426107: 16
Analyse 4558720: 8
Analyse 3701614: 34
Analyse 4886146: 8
Analyse 5081469: 7
Analyse 4687996: 9
Analyse 4028010: 11
Analyse 3699302: 19
Analyse 4621688: 18
Analyse 4756870: 88
Analyse 5348238: 22
Analyse 3898735: 12
Analyse 3767663: 30
Analyse 5411975: 9
Analyse 5015676: 8
Analyse 4489845: 20
Analyse 3900020: 27
Analyse 3766636: 32
Analyse 5018502: 7
Analyse 3835512: 9
Analyse 5477511: 14
Analyse 5477512: 5
Analyse 4420971: 30
Analyse 3634280: 6
Analyse 4887430: 30
Analyse 4558721: 10
Analyse 5085579: 5
Analyse 5872525: 30
Analyse 4227701: 7
Analyse 5279618: 30
Analyse 4096115: 9
Analyse 3437414: 12
Analyse 4030322: 30
Analyse 4159854: 9
Analyse 4624771: 14
Analyse 5675661: 14
Analyse 4294007: 9
Analyse 5872270: 30
Analyse 5081983: 7
Analyse 4883576: 5
Analyse 4948856: 30
Analyse 3964785: 15
Analyse 3898479: 33
Analyse 4951680: 17
Analyse 4358259: 7
Analyse 5609868: 11
Analyse 4952195: 24
Analyse 4556152: 8
Analyse 4225646: 11
Analyse 5609611: 16
Analyse 4227958: 20
Analyse 5213569: 17
Analyse 5278592: 30
Analyse 3897966: 8
Analyse 4421999: 30
Analyse 4690821: 6
Analyse 5873810: 5
Analyse 5282445: 7
Analyse 5151372: 30
Analyse 3833970: 23
Analyse 3635821: 8
Analyse 4423539: 5
Analyse 5476484: 30
Analyse 4357747: 5
Analyse 5212542: 8
Analyse 4224364: 30
Analyse 3964786: 34
Analyse 5348237: 7
Analyse 4358261: 30
Analyse 5279362: 7
Analyse 3637106: 30
Analyse 4029809: 7
Analyse 4291954: 30
Analyse 5741710: 11
Analyse 5543562: 5
Analyse 5019272: 30
Analyse 4819581: 7
Analyse 4754303: 6
Analyse 4356206: 30
Analyse 4953480: 30
Analyse 4360315: 11
Analyse 4161651: 30
Analyse 3635564: 24
Analyse 4753531: 8
Analyse 4094060: 6
Analyse 4228215: 8
Analyse 3372650: 30
Analyse 4487791: 30
Analyse 3700330: 12
Analyse 3569771: 13
Analyse 5014906: 30
Analyse 4093804: 30
Analyse 5279619: 14
Analyse 4949883: 11
Analyse 3897195: 30
Analyse 3699817: 30
Analyse 4619892: 30
Analyse 4882806: 30
Analyse 5939604: 26
Analyse 3766379: 15
Analyse 4492414: 11
Analyse 3568743: 18
Analyse 5344641: 30
Analyse 4491131: 30
Analyse 4619891: 6
Analyse 4027755: 6
Analyse 4360057: 23
Analyse 4160368: 30
Analyse 3829861: 30
Analyse 4158056: 5
Analyse 4097913: 103
Analyse 3835255: 7
Analyse 5018245: 16
Analyse 4094061: 30
Analyse 3372391: 43
Analyse 4624256: 101
Analyse 4885887: 27
Analyse 4559493: 30
Analyse 5214082: 30
Analyse 3571056: 8
Analyse 4224106: 7
Analyse 3897709: 10
Analyse 4553585: 30
Analyse 3830376: 30
Analyse 5280132: 9
Analyse 3964016: 30
Analyse 5348494: 39
Analyse 4030579: 121
Analyse 4487535: 30
Analyse 5014393: 30
Analyse 5939860: 30
Analyse 4823949: 30
Analyse 3634536: 15
Analyse 4159853: 30
Analyse 4756356: 9
Analyse 3768433: 30
Analyse 4949626: 5
Analyse 4355691: 30
Analyse 4029551: 26
Analyse 5807503: 26
Analyse 5674633: 9
Analyse 4027497: 8
Analyse 4096116: 5
Analyse 5015419: 30
Analyse 3764069: 30
Analyse 4554098: 6
Analyse 3701870: 20
Analyse 5415828: 10
Analyse 4489332: 5
Analyse 3700586: 23
Analyse 3901305: 30
Analyse 3634024: 30
Analyse 4360571: 8
Analyse 3568232: 30
Analyse 4688510: 10
Analyse 5807247: 27
Analyse 5148546: 41
Analyse 4030065: 30
Analyse 3895911: 30
Analyse 4092519: 30
Analyse 4622202: 40
Analyse 4294008: 12
Analyse 4488562: 30
Analyse 4489589: 18
Analyse 5215879: 95
Analyse 4031863: 24
Analyse 4033661: 7
Analyse 6004369: 11
Analyse 3966326: 21
Analyse 3634793: 9
Analyse 4162423: 13
Analyse 4558206: 15
Analyse 3963501: 10
Analyse 4690820: 14
Analyse 5411718: 5
Analyse 4492156: 20
Analyse 4099711: 17
Analyse 5544075: 8
Analyse 4227700: 12
Analyse 4095858: 13
Analyse 3898992: 28
Analyse 4690563: 8
Analyse 4360058: 7
Analyse 3569514: 27
Analyse 4095601: 12
Analyse 4295036: 30
Analyse 3829604: 9
Analyse 5149573: 19
Analyse 4424567: 30
Analyse 4229244: 30
Analyse 5015934: 6
Analyse 3832943: 19
Analyse 5150345: 19
Analyse 4885630: 10
Analyse 3963758: 21
Analyse 4688509: 30
Analyse 4951937: 11
Analyse 5282187: 11
Analyse 4162165: 11
Analyse 4621945: 8
Analyse 3832686: 23
Analyse 5147775: 5
Analyse 3897708: 8
Analyse 4292211: 30
Analyse 3569257: 17
Analyse 3765609: 6
Analyse 4292467: 30
Analyse 5345411: 5
Analyse 3895140: 30
Analyse 5543561: 7
Analyse 5147776: 6
Analyse 3766893: 16
Analyse 3960420: 30
Analyse 4030836: 30
Analyse 3964273: 30
Organizing colors
Done organizing
Gathered Colors
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 66
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 30
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 88
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 72
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 57
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 36
Found with color number: 0
[/php]
SmartColors is now going through testing phase.
The Color gathering, takes a bit of time, but is worth it.
The important part to notice is this:
[php]
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 57
Found with color number: 0
SC Array: 7
Using Tol: 0
Search for: 4359800
Found total: 36
Found with color number: 0
[/php]
Using 0 Tolerance, and only did one color search. This probably takes under 10 ms to find your object.
More accurate information on timing later on.
~RM
I really think what you have done is great. I just wanted to point out some things you should take into consideration.
If your algorithm works as intended or is used improperly, is it possible for this to be dangerous as it is drastically reducing the difference of colors clicked?
For example, we all know that j@gex will collect colors of clicks if the account is flagged. I am curious to know how your algorithm will avoid reducing the number of colors down to a dangerously low amount(such as one color). Or if you are going to make some mouse functions to create a box around the color area to increase click area size to reduce the unlikely chance of the bot repeatedly clicking on one color or one area?
You might also want to look into long term use of this algorithm. I haven't looked in depth of it personally and I'm sure you know the answer to these, but perhaps the overuse or long term use of this sort of color sorting could lead to such said problems.
mormonman
2009-11-24 20:35:46
From: ape
I really think what you have done is great. I just wanted to point out some things you should take into consideration.
If your algorithm works as intended or is used improperly, is it possible for this to be dangerous as it is drastically reducing the difference of colors clicked?
For example, we all know that j@gex will collect colors of clicks if the account is flagged. I am curious to know how your algorithm will avoid reducing the number of colors down to a dangerously low amount(such as one color). Or if you are going to make some mouse functions to create a box around the color area to increase click area size to reduce the unlikely chance of the bot repeatedly clicking on one color or one area?
You might also want to look into long term use of this algorithm. I haven't looked in depth of it personally and I'm sure you know the answer to these, but perhaps the overuse or long term use of this sort of color sorting could lead to such said problems.
The mouse function has variables for randomx and randomy in it. Using TPAs and ATPAs is color sorting also. I don't see how using SmartColors would be any more "detectable" than other popular object clicking methods.
Sir R. M8gic1an
2009-12-11 12:06:53
Today I had some times on my hand again (finally :) ) and so I developed a function that waits and checks while moving to the rock. This is not yet the function that will keep track of the rock, these are th funtions that let me know if I got to the rock, If ther rock has alreaby been mined, etc. And I'm proud to say they are working spectacularly well :D
I must also say that thanks to the miner my cahr has already gone from lvl 1 -> 68 mining :)
Function FindNeutralText(var text: string): integer;
var
str: string;
i: integer;
begin
for i := 8 DownTo 1 do
begin
text := lowercase(GetChatBoxText(i, clMessage));
if not (Pos(MSG_SWING_PICK, text) > 0 ) then
break;
end;
Result := i;
end;
Function InStrArrExPosReverse(S: String; StrArr: TStringArray; Var Where: Integer): Boolean;
Var
I, H: Integer;
Begin
H := High(StrArr);
For I := 0 To H Do
If (Pos(LowerCase(StrArr[i]), LowerCase(S)) > 0) Then
Begin
Where := i;
Result := True;
Break;
End;
End;
function CheckChat(PreviousMessage: string; CheckPlace, Stage, Time: integer): boolean;
var
ChatMessage: string;
PrevMsg, NewMsg, MyTime: integer;
begin
writeln('in check chat');
MyTime := GetSystemTime + Time;
ChatMessage := lowercase(GetChatBoxText(CheckPlace, clMessage));
while MyTime > GetSystemTime do
if PreviousMessage = ChatMessage then
begin
wait(50);
ChatMessage := lowercase(GetChatBoxText(CheckPlace, clMessage));
end else
break;
ChatMessage := lowercase(GetChatBoxText(8, clMessage)); // 8 = last line of chat box
if not InStrArrExPosReverse(ChatMessage, [MSG_SWING_PICK, MSG_MANAGE_MINE, MSG_NO_ORE], NewMsg) then
begin
writeln('New: unidentified chat; ' + ChatMessage);
exit;
end;
case Stage of
STAGE_TO_ROCK:
begin
case NewMsg of
SWING_PICK:
begin
Result := true;
exit;
end;
else
begin
Result := false;
exit;
end;
end;
end;
STAGE_WAIT_ROCK:
Result := not (ChatMessage = MSG_SWING_PICK);
end;
end;
~RM :)
Dervish
2009-12-13 16:56:22
From: Rasta Magician
Today I had some times on my hand again (finally :) ) and so I developed a function that waits and checks while moving to the rock. This is not yet the function that will keep track of the rock, these are th funtions that let me know if I got to the rock, If ther rock has alreaby been mined, etc. And I'm proud to say they are working spectacularly well :D
I must also say that thanks to the miner my cahr has already gone from lvl 1 -> 68 mining :)
Function FindNeutralText(var text: string): integer;
var
str: string;
i: integer;
begin
for i := 8 DownTo 1 do
begin
text := lowercase(GetChatBoxText(i, clMessage));
if not (Pos(MSG_SWING_PICK, text) > 0 ) then
break;
end;
Result := i;
end;
Function InStrArrExPosReverse(S: String; StrArr: TStringArray; Var Where: Integer): Boolean;
Var
I, H: Integer;
Begin
H := High(StrArr);
For I := 0 To H Do
If (Pos(LowerCase(StrArr[i]), LowerCase(S)) > 0) Then
Begin
Where := i;
Result := True;
Break;
End;
End;
function CheckChat(PreviousMessage: string; CheckPlace, Stage, Time: integer): boolean;
var
ChatMessage: string;
PrevMsg, NewMsg, MyTime: integer;
begin
writeln('in check chat');
MyTime := GetSystemTime + Time;
ChatMessage := lowercase(GetChatBoxText(CheckPlace, clMessage));
while MyTime > GetSystemTime do
if PreviousMessage = ChatMessage then
begin
wait(50);
ChatMessage := lowercase(GetChatBoxText(CheckPlace, clMessage));
end else
break;
ChatMessage := lowercase(GetChatBoxText(8, clMessage)); // 8 = last line of chat box
if not InStrArrExPosReverse(ChatMessage, [MSG_SWING_PICK, MSG_MANAGE_MINE, MSG_NO_ORE], NewMsg) then
begin
writeln('New: unidentified chat; ' + ChatMessage);
exit;
end;
case Stage of
STAGE_TO_ROCK:
begin
case NewMsg of
SWING_PICK:
begin
Result := true;
exit;
end;
else
begin
Result := false;
exit;
end;
end;
end;
STAGE_WAIT_ROCK:
Result := not (ChatMessage = MSG_SWING_PICK);
end;
end;
~RM :)
Wait what ? You can get in mine with -66 mining ?
Bionicle
2009-12-13 17:00:56
From: Dr D. Dervish
Wait what ? You can get in mine with -66 mining ?
ye. 60.
mrpickle
2009-12-13 18:46:14
Looks like Rasta can win any scripting competition xD.
I was actually thinking of using this for a powerpoint presentation =D. A bot to move the mouse around intelligently while I yap about.
So… Thanks :)!
Sir R. M8gic1an
2009-12-14 02:43:29
I am happy to announce… The basic walking is done! :D
I can't yet call it flawless, but it already has a walking method which will be released with the Beta version :)
const
SYMBOL_OUTLINE = 65536;
SYMBOL_FILL = 12632256;
SYMBOL_BANK = 0;
SYMBOL_ARROW = 1;
Function FindSymbolWithTPA(Which: integer; var Where: TPoint): boolean;
var
TPA : TPointArray;
ATPA: T2DPointArray;
TBArr : TBoxArray;
i, h, t, waste, UniqueColor, UniqueTol: integer;
TIA: TIntegerArray;
begin
if not FindColors(TPA, SYMBOL_OUTLINE, MMX1, MMY1, MMX2, MMY2) then
begin
srl_warn('FindSymbolThroughTPA', 'Could not find symbol', warn_AllVersions);
exit;
end;
ATPA := SplitTPA(TPA, 2);
t := 0;
h := High(ATPA);
SetLength(TIA, h + 1);
SetLength(TBArr, h + 1);
for i:= 0 to h do
begin
TBArr[i] := GetTPABounds(ATPA[i]);
if FindColor(waste, waste, SYMBOL_FILL, TBArr[i].x1, TBArr[i].y1, TBArr[i].x2, TBArr[i].y2) then
begin
TIA[t] := i;
Inc(t);
end;
end;
SetLength(TIA, t);
case which of
SYMBOL_BANK :
begin
UniqueColor := 3455440;
UniqueTol := 45;
end;
SYMBOL_ARROW:
begin
UniqueColor := 6645236;
UniqueTol := 84;
end;
end;
for i:= 0 to t do
begin
h := TIA[i];
if FindColorsTolerance(TPA, UniqueColor, TBArr[h].x1, TBArr[h].y1, TBArr[h].x2, TBArr[h].y2, UniqueTol) then
begin
Where := MiddleTPA(TPA);
Result := true;
exit;
end;
end;
end;
function Walk(Where: integer): boolean;
var
TP: TPoint;
begin
writeln('walking to ' + IntToStr(where));
if Where = SYMBOL_BANK then
TP := Point(610, 19)
else
TP := Point(639, 156);
if not FindSymbolWithTPA(Where, TP) then
begin
MouseMM(TP.x, TP.y, 3, 3);
Result := false;
end else begin
Mouse(TP.x, TP.y, 2, 2, true);
Result := true;
end;
if not Result then
if FindSymbolWithTPA(Where, TP) then
begin
Mouse(TP.x, TP.y, 2, 2, true);
Result := true;
end else
writeln('Unable to Symbol Walk');
if Result then
begin
FFlag(5);
while IsMoving do
FFlag(5);
end;
writeln('Walked: ' + BoolToStr(Result));
end;
Big kudos to marpis for IsMoving working so well!
walking to 1
Walked: True
walking to 0
Walked: True
walking to 1
Walked: True
walking to 0
Walked: True
walking to 1
Walked: True
walking to 0
Walked: True
walking to 1
Walked: True
walking to 0
Walked: True
A test run of the walk ^
~RM
Sir R. M8gic1an
2009-12-15 07:26:31
I am very proud to say this script has banked its first load! And is currently in the process of banking more!
Unfortunately the walking is still a bit edgy for me to release a Beta version just yet, but I suspect that it will be ready in the next few days!
The object finding procedures work extremely well, only being kinda slow the first time. After that they work as if it really were a human!
There are countless features I still want to add to this script, but due to the high demand for a guild miner I will release a basic beta version.
Some of the looping still needs improvement, (lots of improvement), however the basic structure of it is not bad at all already :)
There are still many AI things to add to all the moving around. As I've said before, I intend this script to be my best ever, so a lot of AI will be involved, to be sure it beats my Power Guild Crafter and my Smelter :)
It's on the way!!!
~RM
Gu3st...
2009-12-15 11:11:41
Awesome to hear, RM! :)
I hope you add a lot of anti-bans because I think I'll use this A LOT :p
YoHoJo
2009-12-15 11:48:17
Still using my PMS just for this! 10 of my miners are at 58/60 mining! I can't wait!
Bionicle
2009-12-15 18:55:35
From: YoHoJo
Still using my PMS just for this! 10 of my miners are at 58/60 mining! I can't wait!
Hmm, mebe i should try out ur script :p how many hours do u run it?
YoHoJo
2009-12-15 19:09:08
From: bionicle1800
Hmm, mebe i should try out ur script :p how many hours do u run it?
I can't even get long progress report with it for some reason, I don't use release version though, maybe I mad some bad tweaks to it. But there are about 3 progress reports of people who got it going for 5+ hours :).
Sir R. M8gic1an
2009-12-16 10:53:15
I left it this morning, watched it run for a while and it ran for 8 loads until bumping into a random it didn't solve. Not too sure if it detected it or not, however, I'd say it is now stable enough to release an initial beta stage :)
It has a small issue as sometimes it is unable to read the uptext when trying to get into the guild, but there's not much i can do about it right now.
Other than that, it's just a really smooth miner, although it is missing a lot of user friendlyness. Unfortunately, I won't bother to make a propper WhileMining function just yet, so if someone steals your rock it'll take up to 20 seconds to realize it. I think we can live with that at beta stage.
And Yohojo, sorry to disappoint you, but right now, you'll only be running it on one char :p
~RM
Sir R. M8gic1an
2009-12-16 11:05:16
Sir R. M8gic1an
2010-02-24 12:04:25
Ok guys, I picked up the script again.
I made it look way neater and cleaner.
The Mainloop is no longer a mess, I've broken it down to several functions.
Started fixing the "i get stuck near the top of the guild" problem, not done yet.
Wrote FindMMDoor, tested and works. We'll see how reliable it is.
AtGuildLoc will very likely be next. This is what will avoid it getting stuck and what will avoid it not finding the ladder.
RelocateGuild will be re-written once AtGuildLoc is done.
I'm making symbol finding much better :) No time to collect all the info right now unfortunately.
Some things still need to be changed to match SRL 5 standards.
And a lot of features still need to be written to call this a good script.
But it is well on the way of becoming a reliable one :)
~RM
Looks good when you adding support to not weild axe?
P.S.Triple post lol
Sir R. M8gic1an
2010-02-24 13:36:58
From: rya
Looks good when you adding support to not weild axe?
P.S.Triple post lol
Heh, that'll take quite a while. Very simple to implement, but not really a priority for the script to run :)
~RM
noidea
2010-02-24 17:59:05
Are there any events that take your pickaxe like they used to?
Sir R. M8gic1an
2010-02-24 21:39:56
From: noidea
Are there any events that take your pickaxe like they used to?
nope.
~RM
Sir R. M8gic1an
2010-02-26 19:15:24
Quite some work today :)
Updated SymbolFinding to use CTS 2 :)
The symbol walking now wors a lot better.
Failsafed the walking loops by using a counter. It won't any longer walk huge distances for nothing. It'll just log you out.
Added if not loggedIn then exit to all necessary functions.
It now logs you out for several reasons. Looping is better.
Next step: locating inside the guild. Although I just sidetracked a bit to get started on FollowRock and IsRockGone.
I'm really happy with how the script is coming along :) Both scriptwise and usagewise. It's now safe to run it, although not stable enough that it will run for several hours. Scriptwise I just find that it looks beautiful :p
~RM
Sir R. M8gic1an
2010-03-02 14:25:39
HAHA! EURECA!
Found a major flaw in SmartColors which had been screwing up my script.
When it does a Right-Click there is no 'Red cross' from the click. This had been returning false falses, making it waste tons of time AND my player was being set to false because it believed it couldn't find the bank.
I will now fix SmartColors, and hopefully the script will now be extremely stable :) It hasn't messed up the walking in ages, but this problem would always occur after a few loads, setting the player to false.
Hopefully, there will now be some very nice and long runs :)
~RM
Sir R. M8gic1an
2010-03-05 15:21:38
I just added mith mining :D It's sweet as hell :)
It'll only check for mith if it's in the mith area, so it doesn't waste time :)
You can choose how often (%) to look for mith if in mith area :)
~RM
Daniel
2010-03-07 02:31:49
From: Rasta Magician
HAHA! EURECA!
You spelt eureka wrong.
Sir R. M8gic1an
2010-03-08 05:27:50
Made a FollowRock function :) Seems to be fairly good after intensive testing and tweaking. Now working on IsRockHere.
This will allow the miner to be competitive :)
~RM
ashman26
2010-08-25 11:16:24
This is sounding really good! There used to be a great guild miner years ago but i'm assuming it has become outdated, I really hope that this one is ready soon, be sure to let me know! I'll run it for as long a possible for ya! keep up the good work!
Sir R. M8gic1an
2010-08-26 05:58:34
This is finished and outdated already.
~RM