Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Rooster

Doesn't perform a command doesn't give any errors?

Recommended Posts

Hi all,

 

I am writing a script for RS which cuts trees automatically - but that's not important now.

What is important is that the script doesn't execute a certain part.

 

I'll abbreviate the code:

 

While (condition) do;

begin;

wait();

If findcolor() then;

begin;

clickmouse();

end

end

 

 

It's the if then part he doesn't do...

 

Here's the full code:

program CutMapleBank;
var
x,y,a,b,c,d : integer ;
BmpBankIcon : TSCARBitmap;
begin
BmpBankIcon := TSCARBitmap.Create('deNoBiwB0/wUACQDEmSpxTxDCmBmFYRqRax2+k' +
   'yhmRRHPpikuDwU1FQfwuzPUpCm8kRUvDwQsDAXGmCvyuTL4vjXfri9cNhMyEgm' +
   'yhhmyhSPvsjTTni0yFAmshCVdOxO5hSjorTKufSaRZw1rRxHXnjDXnTDZnzHgp' +
   'jPhpjPXnTGebSV3TBuzgSWgcCR4TBw+Gg1EVzZU');
 repeat
   clickmouse(815,433,false)
   wait(5000)
     while findcolor(x,y,3548518,629,264,750,421) do
       begin
         wait(200)
         if findcolor(a,b,801626,1237,465,1265,491) then 
         begin
         findbitmap(c,d,BmpBankIcon,1183,85,1325,202)
         clickmouse(c,d,false)
         wait(15000)
         end;
       end;
   clickmouse(622,177,false)
   wait(5000)
     while findcolor(x,y,3548518,480,200,750,421) do
       begin
         wait(200)
         if findcolor(a,b,801626,1237,465,1265,491) then 
         begin
         findbitmap(c,d,BmpBankIcon,1183,85,1325,202)
         clickmouse(c,d,false)
         wait(15000)
         end;
       end;
   clickmouse(434,248,false)
   wait(5000)
     while findcolor(x,y,3548518,480,200,750,421) do
       begin
         wait(200)
         if findcolor(a,b,801626,1237,465,1265,491) then 
         begin
         findbitmap(c,d,BmpBankIcon,1183,85,1325,202)
         clickmouse(c,d,false)
         wait(15000)
         end;
       end;
   clickmouse(414,318,false)
   wait(5000)
     while findcolor(x,y,3548518,480,200,750,421) do
       begin
         wait(200)
         if findcolor(a,b,801626,1237,465,1265,491) then 
         begin
         findbitmap(c,d,BmpBankIcon,1183,85,1325,202)
         clickmouse(c,d,false)
         wait(15000)
         end;
       end;
   clickmouse(1028,735,false)
   wait(12000)
   clickmouse(693,654,false)
   wait(1000)
   clickmouse(812,101,false)
   wait(2000)
   clickmouse(777,249,false)
   wait(8000)    
 until(false)
  ;
end.

Share this post


Link to post
Share on other sites

{.include OSI\OSI.scar}

const
tree = 2179644;
tree1 = 2248260;
tree2 = 1984319;
tree3 = 3166546;
tree4 = 2570810;

MINWAITTIME = 4300; // 1000 = 1 second so 6300 = 5seconds 300 milliseconds 
MAXWAITTIME = 7000; // 1000 = 1 second so 9000 = 9seconds
//adjust to your needs.

procedure ScriptTerminate;
begin
 FreeOSI;
end;

procedure SpinCam;
begin
PressVKeyEx(VK_LEFT or VK_RIGHT, 25 + Random(1000));  
end;



procedure GetChopping;
var x, y, x1, y1: Integer;
begin
 If FindColorsSpiralTol(227, 159, x, y, [tree, tree1, tree2, tree3, tree4], 1, 1, 510, 334, 4) then
 begin
   MMouse(x, y, 0, 0);
     Wait(50);
       WriteLn('found a tree...');
   GetMousePos(x1, y1);
   MMouse(x, y, 10, 5);
   If FindColorTol(x, y, 14474496, 12, 12, 90, 19, 99) then
   begin
     Mouse(x1, y1, 0, 0, True);
       Wait(50);
         GetMousePos(x, y);
               Wait(50);
             Wait(RandomRange(MINWAITTIME, MAXWAITTIME)); // adjust this time for faster/slower switching speed between trees.
               FindColorsSpiralTol(227, 159, x, y, [tree, tree1, tree2, tree3, tree4], 1, 1, 510, 334, 14);

   end else ;
   If FindColorTol(x, y, 14474496, 12, 12, 90, 19, 99) = False then
   begin
   GetMousePos(x, y);
     MMouse(x, y, 30, 130);
       Wait(50 + Random(100));
     MMouse(x, y, 130, 30);
       Wait(50 + Random(100));
     MMouse(x, y, 30, 30);
       Wait(50 + Random(100));
   end;
   If GetKeyState(VK_F12) then
   begin
     TerminateScript;
   end;
 end;
end;



begin
SetUpOSI;
repeat
GetChopping;
If Random(5) = 0 then
begin
SpinCam;
end;
until GetKeyState(VK_F12);
end.

Share this post


Link to post
Share on other sites

OK wow i see you've put a lot of work in that...

 

So im using a spot with 4 trees. How should i adjust the constants?

And what other stuff should i adjust for me?

 

Thank you so much for helping me out with this

Share this post


Link to post
Share on other sites
OK wow i see you've put a lot of work in that...

 

So im using a spot with 4 trees. How should i adjust the constants?

And what other stuff should i adjust for me?

 

Thank you so much for helping me out with this

 

What kind of trees?

Make sure you adjust

tree = 2179644;
tree1 = 2248260;
tree2 = 1984319;
tree3 = 3166546;
tree4 = 2570810;

to the correct colours using the "color picker".

Again depending on tree type just adjust:

MINWAITTIME = 4300; // 1000 = 1 second so 6300 = 5seconds 300 milliseconds 
MAXWAITTIME = 7000; // 1000 = 1 second so 9000 = 9seconds
//adjust to your needs.

 

FYI this doesn't bank or anything.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...