Log in

View Full Version : [Help] Doing something wrong I assume.



Failure
11-20-2011, 08:34 PM
Hello there, I'm going to Script (atleast trying) with SCAR and to train, I do it on Private Servers. Though I have a problem, and I don't know how to solve.


program New;

var x,y:Integer;


const
TreeColor = 4819072;
TreeColor1 = 2848872;
TreeColor2 = 2719856;
LogColor = 2051414;
LoginScreen = 1810659;
BrokenTree = 3759718;




function Login : boolean; //Boolean because it results true or false;
begin
result := false;
If FindColor(x, y, LoginScreen, 677, 464, 677, 464)
then result := true
end;


function WoodCutter : boolean;
begin
result := false;
If FindColorTolerance(x, y, TreeColor, 200, 74, 251, 124, 2) or
FindColorTolerance(x, y, TreeColor1, 200, 74, 251, 124, 2) or
FindColorTolerance(x, y, TreeColor2, 200, 74, 251, 124, 2)
then result := true
end;

function TreeStump : boolean;
begin
result := false;
If FindColorTolerance(x, y, BrokenTree, 257, 140, 257, 140, 1)
then result := true
end;


Begin
Repeat
//Login Check
If (Login = True) then
begin
SendKeys(Chr(13));
Wait(10000);
end;


//Getting logs
If (WoodCutter = True) then
Begin
Repeat
MoveMouse(x, y);
Wait(100);
ClickMouse(x, y, True);
Wait(20000);
Until FindColorTolerance(x, y, LogColor, 706, 405, 706, 405, 5)
end;

If (TreeStump = True) then
Begin
Wait(10000);
end;

//Dropping
If FindColor(x, y, 2051414, 562, 241, 733, 420) then
begin
Repeat
MoveMouse(x, y);
Wait(20);
ClickMouse(x, y, False);
Wait(20);
MoveMouse(x, y+40);
Wait(20);
ClickMouse(x, y+40, True);
Until FindColor(x, y, 3226435, 706, 405, 706, 405)
end;



Until False;
end.

The inventory is full with logs, and it should drop but it doesn't, anyone knows what's wrong?

bevardis
11-20-2011, 09:00 PM
Did you make it to click "drop" option when menu pops up? I don't see it.

YoHoJo
11-20-2011, 09:32 PM
If FindColor(x, y, 2051414, 562, 241, 733, 420) then
begin
Repeat
MoveMouse(x, y);

At that part, change it to

If FindColor(x, y, 2051414, 562, 241, 733, 420) then
begin
Writeln('Found Logs')
Repeat
MoveMouse(x, y);

Assuming that findcolor finds logs, so that way we know if the script is at least finding the logs at all.

Failure
11-21-2011, 06:01 AM
If FindColor(x, y, 2051414, 562, 241, 733, 420) then
begin
Repeat
MoveMouse(x, y);

At that part, change it to

If FindColor(x, y, 2051414, 562, 241, 733, 420) then
begin
Writeln('Found Logs')
Repeat
MoveMouse(x, y);

Assuming that findcolor finds logs, so that way we know if the script is at least finding the logs at all.

Tried that, it doesn't give me that message somehow it's skipping that part, and I have no clue why... Anyone knows?

YoHoJo
11-21-2011, 06:09 AM
The reason is obvious! It's not finding the color!
So either the color is wrong/needs tolerance (not sure if colors on that private server change or not), or the search box is wrong.

Failure
11-21-2011, 06:11 AM
The reason is obvious! It's not finding the color!
So either the color is wrong/needs tolerance (not sure if colors on that private server change or not), or the search box is wrong.

Not obvious, they're correct it seems


//Getting logs
If (WoodCutter = True) then
Begin
Repeat
MoveMouse(x, y);
Wait(100);
ClickMouse(x, y, True);
Wait(20000);
Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
FindColor(x, y, LogColor1, 695, 391, 729, 422)
end;

Keeps repeating itself, even though there is a log there?
Oke... I did something, now it detects the logs, but it only drops the first one and keeps repeating at the same spot.



Did you make it to click "drop" option when menu pops up? I don't see it.

Would that be possible on a Private Server Client?

Silent
11-21-2011, 06:23 AM
Not obvious, they're correct it seems


//Getting logs
If (WoodCutter = True) then
Begin
Repeat
MoveMouse(x, y);
Wait(100);
ClickMouse(x, y, True);
Wait(20000);
Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
FindColor(x, y, LogColor1, 695, 391, 729, 422)
end;

Keeps repeating itself, even though there is a log there?
Oke... I did something, now it detects the logs, but it only drops the first one and keeps repeating at the same spot.




Would that be possible on a Private Server Client?

The way your loop is written, it would keep repeating it until it found it. So it would make sense that it kept repeating. As for why it only drops one, your loop probably doesn't update the x,y cords, meaning it doesn't look for the color again and is just repeating the function at that spot.

Failure
11-21-2011, 06:36 AM
The way your loop is written, it would keep repeating it until it found it. So it would make sense that it kept repeating. As for why it only drops one, your loop probably doesn't update the x,y cords, meaning it doesn't look for the color again and is just repeating the function at that spot.


//Getting logs
If (WoodCutter = True) then
Begin
Repeat
MoveMouse(x, y);
Wait(100);
ClickMouse(x, y, True);
Wait(20000);
Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
FindColor(x, y, LogColor1, 695, 391, 729, 422)
end;

It wouldn't make sense, since I told it to stop at the 20th spot with cutting logs after that, it should drops them



function FullInventory : boolean; //Boolean because it results true or false;
begin
result := false;
If FindColor(x, y, LogColor, 557, 243, 729, 422) or
FindColor(x, y, LogColor1, 557, 243, 729, 422)
then result := true
end;




//Dropping
If (FullInventory = True)
then
begin
Writeln('Found Logs')
Repeat
MoveMouse(x, y);
Wait(20);
ClickMouse(x, y, False);
Wait(20);
MoveMouse(x, y+40);
Wait(20);
ClickMouse(x, y+40, True);
Until FindColor(x, y, 3423816, 713, 405, 713, 405)
end;

From the first to the 20th spot it should find the LogColor(s), and drop them until it finds the Inventory color (If no log is on that spot for now, the 20th spot) but it keeps dropping the first one, even though it's dropped.

HyperSecret
11-21-2011, 06:47 AM
It usually isn't good to have a repeat loops condition be a findcolor, it could potentially get stuck in an infinite loop pretty easily. A usually practice is to have an if statement and then have it repeat checking an 'x' amount of times and then stop after that amount of checks....so like...



Repeat
If FindColor(...) then
...
A=A+1;
Until (A > 10);


or something to that effect.

Failure
11-21-2011, 07:22 AM
Somehow I managed to get it to work! :)


//Dropping
If (FullInventory = True)
then
begin
Writeln('Found Logs')
Repeat
If FindColorTolerance(x, y, LogColor, 564, 242, 735, 422, 1) or
FindColorTolerance(x, y, LogColor1, 564, 242, 735, 422, 1) then
MoveMouse(x, y);
Wait(20);
ClickMouse(x, y, False);
Wait(20);
MoveMouse(x, y+40);
Wait(20);
ClickMouse(x, y+40, True);
Until FindColor(x, y, Inventory, 707, 405, 715, 411) or
FindColor(x, y, Inventory1, 707, 405, 715, 411)
end;

I changed the Log colors to something more specific and it worked. :)
(Willow Logs)