PDA

View Full Version : why is findcolor and findbitmap malfunctioning



lardmaster
10-07-2006, 03:39 PM
not that they produce an error, but look at this script, it is supposed to find the arrow in the tutorial island after creating a random character. but, it just wont find those colors. if i pause the screen in the middle of it running and put the color picker over some of the colors in the arrow, they match up exactly with the ones in my program. plz help

(includes a gaussian distribution generator, and a modified login procedure, so put them in your includes folder.

Yakman
10-07-2006, 04:52 PM
the find color functions have parimiters which you choose a square to search the color in, make sure the color is in that square

"FindColor(var x,y:integer;color,Xs,Ys,Xe,Ye:integer)"

also make sure you drag the crosshair over the window

lardmaster
10-08-2006, 09:42 PM
i did, the square was the runescape window, do x1 and y1 have to be smaller than x2 and y2, respectively?

Yakman
10-08-2006, 10:20 PM
no, x2 and y2 are bigger


x1,y1-------------
[ ]
[ ]
[ ]
---------------x2,y2


also, is your screen settings on 32-bit True color?

Cheesehunk
10-09-2006, 01:02 AM
You left your password in the script, I changed it, and PM'ed you the new one. :)

lardmaster
10-09-2006, 03:35 AM
ok, so do y2 and x2 HAVE to be bigger?

ps thnks cheesehunk

Yakman
10-09-2006, 06:22 AM
yes they do, but i dont think thats the problem, is your screen set on 32-bit true color

find that out by going to start > control panal > display > settings

scar only works on 32-bit

lardmaster
10-15-2006, 04:40 PM
yup, it is 32 bit color, and i updated it to use global constants for the main screen. why isnt it working? for some reason it finds the color, but thinks its at 0,0.
WARNING: this will make the mouse click in the upper left hand corner 10 time AND THEN GO INSANE!. IT WILL BE GLUED TO ONE SPOT, benmouse has about a 50-50 percent chance of making an error report. even when the script is finished, the mouse will still be insane. YOU HAVE TO EXIT SCAR TO MAKE IT STOP.


{================================================= ========================]
[ SRL Empty Template. ]
[ ]
[ NAME : Lardmaster's tutorial master. ]
[ WRITER : Lardmaster ]
[ CATEGORY : Tutorial ]
[ DESCRIPTION : Does the tutorial for you ]
[ USAGE : Guess ]
[ AUTOCOLOR : Yes ]
[ NOTES : I dont know if it will work ]
[ CONTACT : WTFakawi@hotmail.com ]
[ ]
[ ]
[================================================== =======================]
[ This is a not empty Template for a Collecting Script ]
[================================================== =======================]
[ Instructions. ]
[================================================== =======================]
[ 1. USE Runescape with Low Detail, Very Bright. ]
[ 2. Set your Screen to 32 bit TRUE color. ]
[ 3. Set Playernames and Passwords in DeclarePlayers. ]
[ 4. SET HOWMANYPLAYERS inside DeclarePlayers ]
[ 5. Start script Logged Out! ]
[================================================== =======================}

program Tutorial;
{.include SRL/SRL.scar}
{.include SRL/SRL/core/LardLogin.scar}


//******************** Set These Constants if Needed *******************//

const StartPlayer = 0; // Determines who will play first

//**********************RuneScape Constants*******************************//


//************************************************** **********************//
const VersionNumber = '2'; // Compliant with Rev 568+
//************************************************** **********************//

Procedure DeclarePlayers;
begin
HowManyPlayers :=6; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:=StartPlayer; // CurrentPlayer = Array Index

Players[0].Name :='lardfriend55';
Players[0].Pass :='dontyouwishyouknewthepasstoalvl3atthebeginingof thetutorial?';
Players[0].Nick :='Lard';
Players[0].Loc :='tutorial island';
Players[0].Skill:='tut';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Loc :='Tutorial island';
Players[1].Skill:='';
Players[1].Active:=True;

Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Loc :='Tutorial island';
Players[2].Skill:='';
Players[2].Active:=True;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Loc :='Loc1';
Players[3].Skill:='';
Players[3].Active:=True;

Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Loc :='Loc1';
Players[4].Skill:='';
Players[4].Active:=True;

Players[5].Name :='';
Players[5].Pass :='';
Players[5].Nick :='';
Players[5].Loc :='Loc1';
Players[5].Skill:='';
Players[5].Active:=True;

writeln(inttostr(HowManyPlayers)+' Players');

end;

//************************************************** **********************//

procedure PlayerStats;

var Active: string;
var i: Integer;
begin
writeln('***************************************** *****');
writeln('Name : '+ Players[CurrentPlayer].Name);
writeln('Number : '+ inttostr(CurrentPlayer));
writeln('Worked for : '+ inttostr(Players[CurrentPlayer].Worked)+' minutes.');
if Players[CurrentPlayer].Active=True then Active:='True' else Active:='False';
writeln('Active : '+ Active);
writeln('Location : '+ Players[CurrentPlayer].loc);
writeln('***************************************** *****');

for i := 0 to HowManyPlayers-1 do
begin
if Players[i].Active=True then Active:='True' else Active:='False';
writeln( (inttostr(i))+' : '+Players[i].name+ ' = '+Active+'. - Lvl : '+inttostr(Players[i].Level[15])+
' - : '+IntToStr(Players[i].Worked)+' mins.'+' - Loc: '+Players[i].loc);
end
writeln('***************************************** *****');
end;

//************************************************** **********************//

procedure ProgressReport;
begin
begin
WriteLn(' ');
WriteLn('<============== -'+VersionNumber+'- Progress Report ===============>');
SRLRandomsReport;
Writeln('we did tutorial');
end;
PlayerStats;
end;


//************************************************** **********************//

Procedure SetUp;
begin
SetupSRL;
DeclarePlayers;
AntiBan;
BoredEvery(3);
end;


//************************************************** ***********************//
function makeChar():boolean;
var i, k : integer;
begin
if FindText(x,y, 'Accept', 1, 220,264,299,308) then
begin
k := random(15)+3;
for i:=1 to k do MouseBox(142,73,187,316,1);
k := random(15)+3;
for i:=1 to k do MouseBox(443,79,489,252,1);
if random(2)=1 then Mousebox(424,277,491,313,1);
Mousebox(218,261,300,310,1);
Mousebox(218,261,300,310,1);
Result:=True;
end
end;
//************************************************** ***********************//
function findArrow(xf,yf:integer): boolean;
var i,xtemp,ytemp:integer;
begin
for i:=1 to 5 do
begin
Result:=False;
if FindColor(xtemp,ytemp, 11795966, MSX1, MSY1, MSX2, MSY2) then
begin
Result:=True;
xf:=xtemp;
yf:=ytemp;
writeln('found it');
break;
end
if FindColor(xtemp,ytemp, 3799547, MSX1, MSY1, MSX2, MSY2) then
begin
Result:=True;
xf:=xtemp;
yf:=ytemp;
writeln('found it');
break;
end
if FindColor(xtemp,ytemp, 2291706, MSX1, MSY1, MSX2, MSY2) then
begin
Result:=True;
xf:=xtemp;
yf:=ytemp;
writeln('found it');
break;
end
if FindColor(xtemp,ytemp, 6224636, MSX1, MSY1, MSX2, MSY2) then
begin
Result:=True;
xf:=xtemp;
yf:=ytemp;
writeln('found it');
break;
end
if FindColor(xtemp,ytemp, 8125181, MSX1, MSY1, MSX2, MSY2) then
begin
Result:=True;
xf:=xtemp;
yf:=ytemp;
writeln('found it');
break;
end
writeln(inttostr(i))
sleep(500+random(200));
end
end;

//************************************************** ***********************//
procedure underArrow(text:string);
var i,xf,yf:integer;
begin
if findArrow(xf,yf) then
begin
i:=1;
repeat
writeln(inttostr(xf)+' '+inttostr(yf));
mmouse(xf,yf+20,20,20);
i:=i+1
until (isuptext(text) )or (i>=10)
getmousepos(xf,yf);
writeln(inttostr(xf)+' '+inttostr(yf)+inttostr(MSX1)+' '+inttostr(MSX2));
CMouse(xf,yf,3,3,True);
sleep(3000);
While ClickToContinue do sleep(random(2000)+2000);
writeln(inttostr(i));
end
end;

//************************************************** ***********************//
//
// Main EventLoop
//
//************************************************** ***********************//
begin
Setup;
if LoggedIn then Logout;
LoginPlayerNoWelcome;
sleep(5000);
if makeChar() then
begin
writeln('made a random character');
end else writeln('the character has already been made');
sleep(1000+random(2000));
underArrow('Talk');
end.