SRL Archive - OSR Help

2 More Q's: How to Swivel When No Clicks, and how to find a Specific Item?


Mister Snow

2012-05-17 16:10:37

So, I am trying to make a woodcutter on my own.

I've found 2 major issues:

1: Sometimes the bot clicks in front if itself so many times, then is too far forward and all the trees are behind him… which he is missing.

Is there some way to swivel in these circumstances? Like if it doesn't find a chop option after a wait(10000) then it swivels the screen?


2: How do I do an invent check for a specific item? In this case, these silly wooden knots. I just want to drop them. Every time my invent is full, I'd like to just drop them. Their color is just a bit different than regular logs, so I think maybe just some sort of color check for 4088718?

Thank you for your wonderful help villavu! :)

Sin

2012-05-17 16:53:11

Post your code.

Runaway

2012-05-17 16:56:34

Hello,

for checking items and dropping, give this a try:


function CheckInvColor(Color, Tol, StartSlot, EndSlot: Integer): TBooleanArray;
var
i: Integer;
x, y: Integer;
Slot: Tbox;
begin
if not LoggedIn then
Exit;
SetArrayLength(Result, 28);
for i:= StartSlot to EndSlot do
begin
Result[i]:= False;
Slot:= InvBox(i);
if ExistsItem(i) then
Result[i]:= FindColorTolerance(x, y, Color, Slot.x1, Slot.y1, Slot.x2, Slot.y2, Tol);
end;
end;

^ That will create an array of booleans which will tell you if the item you are searching for is in each slot. Then use this:


var
ToDrop: TBooleanArray;
i: Integer;

...

if InvFull then
begin
ToDrop:= CheckInvColor(4088718, 3, 1, 28);
for i:= 1 to 28 do
begin
if ToDrop[i] then
DropItem(i);
end;
end;

^ That will drop the item if it's marked as found from the CheckInvColor function.

Sorry if it doesn't work, I can't test it right now :S

iBlank

2012-05-17 17:03:07

From: Mister Snow
So, I am trying to make a woodcutter on my own.

I've found 2 major issues:

1: Sometimes the bot clicks in front if itself so many times, then is too far forward and all the trees are behind him… which he is missing.

Is there some way to swivel in these circumstances? Like if it doesn't find a chop option after a wait(10000) then it swivels the screen?


2: How do I do an invent check for a specific item? In this case, these silly wooden knots. I just want to drop them. Every time my invent is full, I'd like to just drop them. Their color is just a bit different than regular logs, so I think maybe just some sort of color check for 4088718?

Thank you for your wonderful help villavu! :)


You can do MarkTime(T) at the start of your searching for tree procedure and somewhere in the loop put If TimeFromMark(T) >= 10000 Then MakeCompass('S')

Imagine

2012-05-17 22:12:38

From: alevere4
You can do MarkTime(T) at the start of your searching for tree procedure and somewhere in the loop put If TimeFromMark(T) >= 10000 Then MakeCompass('S')


You might not want to do that, because you could go too far south. You could try rotating the compass angle 180 degrees instead of always doing south :P

Subliment

2012-05-18 08:10:33

For the clicking too much part, maybe you should add a random wait after each click. As for the knots (even though I never ever saw them) you should make a DTM of it, then use the method Runaway posted.
Oh, and to add further "humanness", check if the player is animating before actually clicking. And if it is, then it is chopping, so you don't click.

jakegran

2012-05-18 13:48:57

For the 2nd problem i would suggest something like


if invfull then
if FindDTM(KnotDTM, x, y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
begin
mouse(X, Y, ?, ?, False)
waitoption('rop', 300)
end;

Something similar to that probably would work.