SRL Archive - Test corner

searchscreen function (simple yet useful)


Dark_Sniper

2006-04-15 18:41:35

I hope you guys like what I made here it can be very usefull in some tough situations.

usage:



searchscreen(start_x, start_y, end_x, end_y, range, randomy, random_cordinates, timing: integer; obj:string; terminate, click, left:boolean)


start_x: the begining x cord you wish to start at.

start_y: the begining y cord you wish to start at.

end_x: the ending x cord you wish to end at.

end_y: the ending y cord you wish to end at.

range: how far apart each mouse movement is.

obj: the text of your obj.

terminate: if you wish to terminate and logout if obj is not found

click: if you wish to click your obj after found.

left: (if click is false this doesent matter just state true or false in the setup) if you want to click left or right... true being left.... false being right

randomy: makes it wait a little more randomly

timing: how long before each movement.

[B]newly updated[/B]


random_cordinates: now you control how random the cords are for each movement.








{.include Srl/SRL.scar}

function searchscreen(start_x, start_y, end_x, end_y, range, randomy, random_cordinates, timing: integer; obj:string; terminate, click, left:boolean):boolean;
var
a:integer;
begin
mmouse(start_x, start_y, 0, 0)
repeat
wait(timing+random(randomy-random(randomy)))
getmousepos(x, y)
CMMouse(x+random(random_cordinates-random(random_cordinates)), y+range+random(random_cordinates-random(random_cordinates)), 0, 0)
getmousepos(x, y)
if(y >= end_y+random(randomy-random(randomy)))then
begin
a:=a + range+random(randomy-random(randomy))
mmouse(start_x+a, 10, 0, 0)
end;
if(x >= end_x+random(randomy-random(randomy)))then
begin
if(terminate=true)then
begin
writeln('could not find... terminating and loging out.')
terminatescript;
if(terminate=false)then
exit;
end;
end;
if(isuptext(obj))then
result:=true
until(result=true)
if(click=true)then
begin
getmousepos(x, y)
holdmouse(x, y, left)
wait(50+random(25))
releasemouse(x, y, left)
end;
end;


XxKanexX

2006-04-15 19:17:23

The only problem is, if using on Runescape: Detectable. ;)

Pwnd

2006-04-15 19:19:15

Is this like FindObj without colors? xD

Dark_Sniper

2006-04-15 19:44:54

Is this like FindObj without colors? xD


basicly :p and it is a bit faster in most cases.

The only problem is, if using on Runescape: Detectable.

its for the tough cases.. ill make it more random :p even though it will be detectable.

Dark_Sniper

2006-04-22 01:10:53

updated so its a whole lot more random when mouse is moved and time is waited :p