Jump to content
BryceTheCoder

How do i make a color more speciifc?

Recommended Posts

Hey guys, i am trying to click the color: 3881790

 

my code looks like this for the color:

 

if FindColor(x, y, 3881790, 0, 0, w - 1, h - 1) then

 

 

Buuut on the screen pretty close to the actual thing i want it to click, there is another object with exact, if not similar, color and it alllwwaayys click the one i DONT want. Soo how cani fix this or make the color more specific or something?

Link to comment
Share on other sites

Is the OpenFurnace in OSI broken?

 

program New;

{$DEFINE RS2}
{$DEFINE OSI_Color_Anti_Randoms}
//{$DEFINE SMART}                   // Comment out to disable SMART

{$I OSI\OSI.scar}
{$I OSI\RS2\Skill\Smithing.scar}

procedure ScriptTerminate;
begin
 FreeOSI;
end;

begin
 SetUpOSI;
 OpenFurnace(Furnace_Falador, ClickLeft);
end.

Actually when testing this I did find a bug in Smithing.scar that will have to be fixed. Line 82 should read dtmOre_Any and not dtmOre. Oops.

Link to comment
Share on other sites

im not using OSI. here.. tell me what i can do to fix my code into OSI so i can use what u gave me please.

 

MY CODE NOW:

 

////////////////////////////////////////////////////////////////////

//CREATED BY: Bryce Raney

// x = start here x

//Start West Fally Bank (far right 1) [ ][][][][]

////////////////////////////////////////////////////////////////////

program FallyCannonBalls;

 

 

procedure LogMeOut;

begin

ClickWindMouse(754, 10, 4, 4, True);

Wait(100 + Random(100));

ClickWindMouse(637, 406, 2, 2, True);

Wait(99999999999999999999999999999999999999999999);

end;

 

 

 

 

 

procedure OpenBank;

var

w, h: Integer;

x, y: Integer;

 

begin

GetClientDimensions(w, h);

Begin

 

if FindColor(x, y, 5991547, 0, 0, w - 1, h - 1) then

WriteLn('--- FOUND BANK COLOR ---');//bank color = 5140363

MoveWindMouse(x, y, 1, 1);

Wait(25 + Random(50));

ClickWindMouse(x, y, 1, 1, False);

Wait(80 + Random(100));

ClickWindMouse(x, y+44, 1, 1, True);

Wait(9999999 + Random(9000));

end;

end;

 

 

 

procedure MoveMouseRandom;

var x, y: Integer;

begin

x := Random(400);

Wait(250 + Random(150));

y := Random(300);

Wait(50);

MoveWindMouse(x, y, 25, 25);

Wait(450 + Random(350));

end;

 

 

 

procedure StartUp;

begin

Writeln('Starting Up...');

ClickWindMouse(543, 25, 8, 8, True);

Wait(100 + Random(150));

SendArrowWait(0, 2100 + Random(750));

Wait(200 + Random(250));

end;

 

procedure Walk2Furnace;

begin

Writeln('Walking to Furnace...');

ClickWindMouse(653, 41, 2, 2, True);

Wait(5300 + Random(1000));

ClickWindMouse(688, 91, 2, 2, True);

Wait(6000 + Random(1350));

ClickWindMouse(670, 121, 1, 1, True);

Wait(5000 + Random(1835));

//ClickWindMouse(AAA, AAA, 2, 2, True);

//Wait(AAAA + Random(AAAA));

Writeln('At Furnace.');

end;

 

 

 

 

procedure UseFurnace;

var

w, h: Integer;

x, y: Integer;

 

begin

GetClientDimensions(w, h);

Begin

if FindColor(x, y, 3815996, 0, 0, w - 1, h - 1) then

WriteLn('!FOUND FURNACE COLOR!');//furnace color

ClickWindMouse(621, 227, 2, 2, True);//click 2nd item slot

ClickWindMouse(x, y, 0, 0, True);//click furnace

Wait(900 + Random(800));

ClickWindMouse(259, 428, 5, 5, True);//click melt cannonballs

Wait(123 + Random(90));

MoveMouseRandom;

Wait(1000 + Random(5000));

MoveMouseRandom;

Wait(500 + Random(12000));

MoveMouseRandom;

Wait(90 + Random(120));

MoveMouseRandom;

Wait(150000 + Random(3555));//Long wait for smelting

MoveMouseRandom;

Wait(1000 + Random(1300));

end;

end;

 

 

procedure Walk2Bank;

begin

Writeln('Walking to Bank...');

//ClickWindMouse(AAA, AAA, 2, 2, True);

//Wait(999999999999 + Random(1500));

 

//ClickWindMouse(AAA, AAA, 1, 1, True);

//Wait(AAAA + Random(AAAA));

end;

 

 

procedure Cycle;

begin

StartUp;

Walk2Furnace;

UseFurnace;

Walk2Bank;

OpenBank;

end;

 

 

 

begin

repeat

Cycle;

until(false)

end.

Link to comment
Share on other sites

Uh, this is gonna take a while. Let me get back to you.

 

Alternately you could just copy the code out of the OpenFurnace routine (with proper credit of course), but I highly recommend you spend some time getting used to OSI. That is its entire reason for being: To make writing scripts easier for you.

 

Protip: Use the CODE tags around your code in a post (button looks like a #) rather than enclosing in quotes.

Your code goes here

Edited by Bixby Sayz
Link to comment
Share on other sites

OMG my eyes! One word for you: Indenting.

 

I have made the bare minimum changes to make this using OSI. It does not even come close to using OSI to its full potential. This script has other issues anyway.

 

Note that using this script will get you banned. One of the things they check for is doing the exact same mouse clicks over and over with no variation.

////////////////////////////////////////////////////////////////////
//CREATED BY: Bryce Raney
// x = start here x
//Start West Fally Bank (far right 1) [ ][][][][]
////////////////////////////////////////////////////////////////////
program FallyCannonBalls;

{$DEFINE RS2}
{$DEFINE OSI_Color_Anti_Randoms}
//{$DEFINE SMART}                   // Comment out to disable SMART

{$I OSI\OSI.scar}
{$I OSI\RS2\Skill\Smithing.Scar}

procedure LogMeOut;
begin
 Logout;
end;

procedure MoveMouseRandom;
var
 x, y: Integer;
begin
 x := Random(400);
 Wait(250 + Random(150));
 y := Random(300);
 Wait(50);
 MoveWindMouse(x, y, 25, 25);
 Wait(450 + Random(350));
end;

procedure Startup;
begin
 // Set compass to north & camera to highest angle.
 ClickCompass(True);
end;

procedure Walk2Furnace;
begin
 Writeln('Walking to Furnace...');
 ClickWindMouse(653, 41, 2, 2, True);
 Wait(5300 + Random(1000));
 ClickWindMouse(688, 91, 2, 2, True);
 Wait(6000 + Random(1350));
 ClickWindMouse(670, 121, 1, 1, True);
 Wait(5000 + Random(1835));
//  ClickWindMouse(AAA, AAA, 2, 2, True);
//  Wait(AAAA + Random(AAAA));
 Writeln('At Furnace.');
end;

procedure UseFurnace;
var
 B: TBox;
begin
 // Use item slot 2 on furnace.
 B := GetItemBounds(1);
 MouseBox(B.X1, B.Y1, B.X2, B.Y2, ClickLeft);
 if OpenFurnace(Furnace_Falador, ClickLeft) then
 begin
   Wait(900 + Random(800));
   ClickWindMouse(259, 428, 5, 5, True);//click melt cannonballs
   Wait(123 + Random(90));
   MoveMouseRandom;
   Wait(1000 + Random(5000));
   MoveMouseRandom;
   Wait(500 + Random(12000));
   MoveMouseRandom;
   Wait(90 + Random(120));
   MoveMouseRandom;
   Wait(150000 + Random(3555));//Long wait for smelting
   MoveMouseRandom;
   Wait(1000 + Random(1300));
 end;
end;

procedure Walk2Bank;
begin
 Writeln('Walking to Bank...');
//  ClickWindMouse(AAA, AAA, 2, 2, True);
//  Wait(999999999999 + Random(1500));

//  ClickWindMouse(AAA, AAA, 1, 1, True);
//  Wait(AAAA + Random(AAAA));
end;

procedure OpenBank;
var
 w, h: Integer;
 x, y: Integer;
begin
 if FindColor(w, h, 5991547, MSX1, MSY1, MSX2, MSY2) then
 begin
   WriteLn('--- FOUND BANK COLOR ---');//bank color = 5140363
   MoveWindMouse(x, y, 1, 1);
   Wait(25 + Random(50));
   ClickWindMouse(x, y, 1, 1, False);
   Wait(80 + Random(100));
   ClickWindMouse(x, y+44, 1, 1, True);
   Wait(9999999 + Random(9000));
 end;
end;

procedure Cycle;
begin
 StartUp;
 Walk2Furnace;
 UseFurnace;
 Walk2Bank;
 OpenBank;
end;

procedure ScriptTerminate;
begin
 FreeOSI;
end;

begin
 ClearDebug;
 SetUpOSI;

 repeat
   Cycle;
 until False;
end.

[ATTACH]103[/ATTACH]

Link to comment
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...