SRL Archive - OSR Help

Any way to create an isChopping Boolean?


hedfun2

2013-06-07 16:22:56

I want a boolean or something that says when chopping do this. How would I make this?

Ian

2013-06-07 16:43:23

Check out Flight's tutorial on using Pixelshift: http://villavu.com/forum/showthread.php?t=74090 :)

denart5

2013-06-07 16:45:23

You could make the time between clicking the tree and a log added to your inv as isChopping and then just if(isChopping) then (…)

Rich

2013-06-07 16:54:06

From: denart5
You could make the time between clicking the tree and a log added to your inv as isChopping and then just if(isChopping) then (…)
The problem with that is is that the times always vary, so you'll get false negative.

@OP, I'd definitely follow BMWxi's advice :)

Sawyer

2013-06-07 17:17:13

If it is EOC, you could count the xp bar total, have a wait, and if it gains xp in that amount of time, it returns a true. if not, it returns a false. I have used this method a few times.

denart5

2013-06-07 17:18:04

From: Rich
The problem with that is is that the times always vary, so you'll get false negative.

@OP, I'd definitely follow BMWxi's advice :)

Yes the time varies but I mean that it returns true untill the log is added to the inv.

Rich

2013-06-07 17:33:28

From: denart5
Yes the time varies but I mean that it returns true untill the log is added to the inv.
What about when the tree has been cut? It would return true because it would be waiting for a log to be added, but that wouldn't happen because there's no tree.

denart5

2013-06-07 17:41:27

From: Rich
What about when the tree has been cut? It would return true because it would be waiting for a log to be added, but that wouldn't happen because there's no tree.

It could check if the tree is still there every x secs but what Sawyer suggested is way better I guess.

Awkwardsaw

2013-06-09 21:44:49

pixelshift is the only way to go, there's an entire include file just for checking if your player is animating.

bob_dole

2013-06-12 14:18:31

An effective method is to like as everyone said use pixelshift. This is function I use:


Function isChopping: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(MSCX - 20, MSCY - 35, MSCX + 20, MSCY + 10);;
Result := (AveragePixelShift(PBox, 250, 500) > 90);
Report(true);
SMART_DrawBoxEx(false, false, PBox, clRed);
//writeln(IntToStr(AveragePixelShift(PBox, 250, 500)));
end;

Directly jacked from INeedBot's AIOChopper.


There HAVE been false positives caused by people around you, but for the most part is a effective and reliable.

Another method off the top of my head is to click the tree and while having your cursor over the tree wait for the uptext to change. When the uptext disappears it means the tree has been cut down.

The only issue to this is how you are going to get your cursor over the tree. If you click it from a few squares away, the position of the tree on the page changes and it may come out from under the cursor. You could then use say findobj to find it, but if there are multiple trees then it may move the cursor over the wrong one.

A combination of both methods can be utilized for damn near 100% accuracy.

If you are working on a magic tree chopper, you may need to teach your cursor to move slightly every 3 minutes to prevent being logged out. Only if you are in one of the few areas without several other people.

<Offtopic>

I am assuming you are making a woodcutter so I am going to post my ent detection code here for you.

The Function


Procedure FindEnt;
begin

if (not (IsUpText('hop'))) then
begin
writeln ('Error: Cursor must be on the tree!');
Exit;
end;

if (CountColorTolerance(65535,82, 5, 110, 23, 55) > 20) then
begin
writeln ('An ent has been detected, getting off...');
Mmouse(643, 84, 3, 3);
Clickmouse2(mouse_left);
writeln ('Waiting a moment for the ent to go away...');
wait(randomrange(20000,25000));
end;

end;

Function Usage (please don't use findobj. just an example.)

if ((not(isuptext('Mag'))) AND (FindObjCustom (x, y, ['Mag', 'agic'], [6130056, 3692372, 1988429], 3))) then
begin
writeln ('Moving cursor to the active magic tree...');
MMouse(x, y, 3, 3);
end;

FindEnt;

</Offtopic>