SRL Archive - Outdated / Broken

P1ng's Guild Coal Miner


P1ng

2012-08-29 12:04:34

This script is still very much in the testing phase!

Everything is finished and in (theoretical) working order, just some minor fixes may be required to get a good run with it.

Didn't feel this should be released in the public section either way. I am essentially releasing it to get testers and as much feedback as possible so that I can improve it. This means - Please keep debug on! (LocationDebug not necessary unless having location detection errors).

Features:
- Location checking
- > Optional location debug
- > Will walk back to ores if stuck at gate/ladders

- In-depth debug
- > Turn on/off by commenting out $DEFINE DEBUG

- Accurate TPA ore finding + ladder finding
- > Doesnt move mouse to empty rocks

- FAST and accurate mining detection
- > PixelShift
- > BlackChatMessage x2
- > Ore vein present
- > Time
- > Inventory check

- Walking
- > DTM walking to and from bank
- > RadialWalking while in mine


Setup:
- Fill out DeclarePlayers
- Start Player in bank, at ladders, or in mine
- Axe equipped
- Hit run


To Do:

- Progress report
- Test


Known bugs/errors:


Progress Reports:

Runaway

2012-08-29 12:19:16

Nice release! Although,

From: P1ng
I am essentially releasing it to get testers and as much feedback as possible so that I can improve it.


Member's section is probably not the best place for loads of feedback :p I'm interested to see how well your mining detection works, you've employed every method in the book!

P1ng

2012-08-29 12:22:41

Yeah, the only thing slowing it down is the location checking after it detects that there is no ore/we aren't mining :(

I did want to release to public for testers, but I don't think it's a good idea for a public script.

Few bugs and ways I intend on fixing them at present -
1. Banker detection's super slow. Going to fix with a custom TPA function.
2. No failsafes for walking as of yet. Going to check into this one and see what I come up with.

Have no real measure of it's speed/ability yet without a proggy, but in theory it should work quite well once I've ironed out all these minor bugs.

omgnomorenames

2012-08-29 14:44:44

Testing currently.
Two Bugs found: If mining between two rocks (North South) and the North rock is depleted, it assumes the south rock is also depleted. This then goes on to repeatedly clicking the South rock until depletion.

If Flag Gets stuck (Picture Attached). Suggestion After it times out Break from loop and attempt to find Banker, then Log if Banker not Found.
[0:00:00]: SRL Compiled in 0 msec
[0:00:00]: Paired with SMART[4784]
[0:00:02]: Moving player from ladders to ores
[0:00:20]: Walking back to ladders
[0:00:56]: Failed DTMWalk2Bank
[0:00:58]: Failed DTMWalk2Bank
[0:01:00]: Failed DTMWalk2Bank
[0:01:02]: Failed DTMWalk2Bank
[0:01:04]: Failed DTMWalk2Bank
[0:01:05]: Failed DTMWalk2Bank
[0:01:07]: Failed DTMWalk2Bank
[0:01:09]: Failed DTMWalk2Bank
[0:01:12]: Failed DTMWalk2Bank
[0:01:14]: Failed DTMWalk2Bank
[0:01:15]: Failed DTMWalk2Bank
[0:01:17]: Failed DTMWalk2Bank
[0:01:19]: Failed DTMWalk2Bank
[0:01:21]: Failed DTMWalk2Bank
[0:01:23]: Failed DTMWalk2Bank
[0:01:25]: Failed DTMWalk2Bank
[0:01:27]: Failed DTMWalk2Bank
[0:01:29]: Failed DTMWalk2Bank
[0:01:31]: Failed DTMWalk2Bank
[0:01:33]: Failed DTMWalk2Bank
[0:01:34]: Failed DTMWalk2Bank
[0:01:36]: Failed DTMWalk2Bank
[0:01:38]: Failed DTMWalk2Bank
[0:01:41]: Failed DTMWalk2Bank
[0:01:42]: Failed DTMWalk2Bank
[0:01:44]: Failed DTMWalk2Bank
[0:01:47]: Failed DTMWalk2Bank
[0:01:49]: Failed DTMWalk2Bank
[0:01:50]: Failed DTMWalk2Bank
[0:01:52]: Failed DTMWalk2Bank
[0:01:54]: Failed DTMWalk2Bank
[0:01:56]: Failed DTMWalk2Bank
[0:01:57]: NextPlayer(False)
[0:01:57]: SwitchToPlayer(PlayerNo: 0, Active: False);
[0:01:57]: Player is not Active...
[0:01:57]: All players not active!
[0:01:57]: Successfully executed.

Sometimes fails to click ladder. Try waiting for Uptext, or maybe look for the mysterious entrance if found attempt to climb ladder again.

Mjordan

2012-08-29 21:10:54

How is the mining guild for bots nowadays? I know it was a 99% ban not long ago…

P1ng

2012-08-29 23:54:01

1. With a rock both immediately north and south I am not quite sure how to make it detect specifically the one that you are mining. At present it just checks for the presence of ore in the closest rock. This is an issue I have faced but yet to establish a way around it.

2. I have added the Exit from the walking function and am currently testing it.

In response to the bans - Idk, it looks to me like everyone in there is botting, but I have been watching my screen like a hawk if legits come in. Still isn't up to scratch to have a nice long run just yet but I'm not sure what the ban-rate will be like when it gets to that stage.

Le Jingle

2012-08-30 00:24:52

For:
FireOre({...params...}): boolean;
Wouldn't you want to set the starting x, y coords later on? I only ask because later in the MineCoal function - x and y are declared as variables, but you never assign them any integer value, so by default -I think/assume-, they're either undefined or they start searching from the MSCX, MSCY every time – which might cause the top ore always being checked on first, creating a false positive, whereas it never makes it to the south rock?

I'm probably not making any sense and well it's just my input.
Cheers,
Lj

Edit: Had this open in another tab and figured it might be useful for future reference;
http://villavu.com/forum/showpost.php?p=55970&postcount=5

P1ng

2012-08-30 00:30:24

You're correct, that x and y co-ords were superfluous, thank-you for pointing that out :)

Runaway

2012-08-30 01:32:03

From: P1ng
1. With a rock both immediately north and south I am not quite sure how to make it detect specifically the one that you are mining. At present it just checks for the presence of ore in the closest rock. This is an issue I have faced but yet to establish a way around it.


I've been thinking about this too :p Do you keep your compass set to north at all times? If so, you can tell which rock to check via the mouse position before/after clicking the rock:


function GetMouseDirection(Center: TPoint; North: Boolean): String;
var
Direction: TStringArray;
Angle: Extended;
x, y: Integer;
begin
Result := '';
Direction := ['n', 'e', 's', 'w'];
if North then
ClickNorth(SRL_ANGLE_HIGH);
GetMousePos(x, y);
Angle := Degrees(FixRad((ArcTan2(Center.y - y, Center.x - x) + Radians(90)) - Pi));
if not InRange(Round(Angle), 0, 360) then
Exit;
if (Angle >= 315) then
Angle := 360 - Angle;
Result := Direction[Round(Angle / 90.0)];
end;

And then compare the MiddleTPA's, etc. to find out which rock to monitor. That's the only thing I could think of :blink:

P1ng

2012-08-30 01:44:00

I was thinking about checking the first two TPA's closest to the player and then choosing the one closer to the mouse position. But if you are far south of the two rocks then click the south of the two when you reach the rock your mouse will be far north and it will still choose the above one.

Or if you are far to the east and you choose the south one it's still kind of 50/50 which rock is closer to the mouse.

litoris

2012-08-30 02:14:09

I will test this in the following hours.

Runaway

2012-08-30 02:38:40

From: P1ng
I was thinking about checking the first two TPA's closest to the player and then choosing the one closer to the mouse position. But if you are far south of the two rocks then click the south of the two when you reach the rock your mouse will be far north and it will still choose the above one.

Or if you are far to the east and you choose the south one it's still kind of 50/50 which rock is closer to the mouse.


Yeah, the actual mouse position definitely won't work. But the angle will!


type
TRadial = record
Length: Integer;
Angle: Extended;
Direction: String;
end;

function GetRadial(A, B: TPoint): TRadial;
var
Direction: TStringArray;
Angle: Extended;
begin
Direction := ['n', 'e', 's', 'w'];
Angle := Degrees(FixRad((ArcTan2(A.y - B.y, A.x - B.x) + Radians(90)) - Pi));
if not InRange(Round(Angle), 0, 360) then
Exit;
Result.Length := Distance(A.x, A.y, B.x, B.y);
Result.Angle := Angle;
if (Angle >= 315) then
Angle := 360 - Angle;
Result.Direction := Direction[Round(Angle / 90.0)];
end;

function rs_GetMouseDirection(Center: TPoint; North: Boolean): String;
var
Radial: TRadial;
x, y: Integer;
begin
//if not LoggedIn then Exit;
if North then
MakeCompass('n');
GetMousePos(x, y);
Radial := GetRadial(Center, Point(x, y));
if (Radial.Direction = '') then
Exit;
Result := Radial.Direction;
end;


Too tired to give any explanation of the above code… hopefully it isn't necessary :p

litoris

2012-08-30 04:49:42

Walking is pretty buggy, rock finding is awesome, but it sometimes searches for colors while walking(probably because of my low FPS, you check for ismoving all the time). You need to add tons of walking failsafes, consider SPS as one of them.
On my first run, it misclicked the ladder and thought that it was on the surface. I suggest that instead of a step-by-step mainloop, you make it determine what to do by doing some checks.(ie. if near the stairs without full inventory, go down, if with full inventory, go to bank) I did that with my miner and worked pretty well. Saves you from doing lots of failsafes.
You should add coal bag support once everything else is flawless.

P1ng

2012-08-30 07:23:17

Yeah, I'm not thrilled about the walking. SPS wasn't working well for me at all, it was going to be my primary walking method with the use of a custom SPS map but even with the custom map it was far too inaccurate for my liking.

I'd love for someone really skilled with walking to have a look at this and make a recommendation as I must say walking has never been my forte and would love to learn to walk without SPS/objDTMs.

Runaway, just had a quick read-through of that code you posted and will check to see how I can fit it in with my current ore detection to make that a tiny bit more accurate.

PS - Loving all the member's feedback! It's far more in-depth than anything you recieve from the public section (perhaps because most of us don't check there often/anymore).

E:
1. Changed the entire location detection system. Now uses a combination of CountColorTolerance and MiniMap DTMs.
This is proving to be much more accurate than the previous system.

2. Removed the DTM walking which was proving quite inaccurate and replaced it with RadialWalkTolerance. Seems to be working quite well thus far, am able to complete full runs now instead of having the walking kill all my hard work on the mining procedure :)

3. Added IFDEF's for all the painting so it won't throw an error when being used without SMART.

4. Location specific main-loop.

5. More efficient bank-finding with a custom TPA procedure.

6. Simplified and made the WaitTillFinished procedure more efficient.

7. Removed ClaimSOF function

Still tinkering with detecting the correct rock when there are a couple nearby, but should get that finished sometime tomorrow or after the weekend.

Jakkle

2012-08-30 09:36:13

Very nice release. I haven't use a guild miner in a long time but I will be giving this a try some time over the weekend as I only have one account with the ability to mine down there and that char is busy atm :p
I will leave some feedback once I've tried it out :)

P1ng

2012-08-30 09:55:02

Great, would love some feedback on the new changes I've just made. It still needs a fair amount of tweaking before you can get a run with it but it's getting closer. :)

Check out the OP for download link to new version.

litoris

2012-08-30 11:16:37

Didn't try it with the recent changes but I think ODTM's could work well around the stairs in the guild.(the icon on the surface would kill it most likely) You could at least use it to make sure it went down. Abu has a nice short guide here.
Will try the new version in a while.