Log in

View Full Version : stop pixel shift



zluo
06-11-2012, 06:59 AM
on a private server, their is an exp box. the numbers in it changes frequently, and i want a function that waits until the exp bar stays still for 10 seconds. I looked at pixel shift, but I dont get it. is it something like this?

repeat
wait(200)
until nopixelshift = 10000?

Justin
06-11-2012, 07:11 AM
Something like this SHOULD do


procedure WaitForNoXp;
begin
repeat
wait(10);
until ((AveragePixelShift(IntToBox(x1, y1, x2, y2), 250, 500) > 500));
end;


You will need to set your own x1, y1, x2, y2

zluo
06-11-2012, 08:30 AM
((AveragePixelShift(IntToBox(x1, y1, x2, y2), 250, 500) > 500));
what part of this is wait 10 seconds for no exp? i dont get it. what is the other numbers for? the 250 and 500.
thanks

edit: grats on 1k postcount?

riwu
06-11-2012, 08:44 AM
u will first need to determine a suitable no. to fill that parameter, Flight has a great tut here: http://villavu.com/forum/showthread.php?t=74090&highlight=averagepixelshift

Is the xpbar the same as the one in real RS? If thats the case u can just use GetXpBar, or if they are at different coordinates u can use GetTextAtExWarp etc.

Jakkle
06-11-2012, 09:00 AM
Gets the average pixel shift every 'waitPerLoop' ms over the time 'maxTime'

function AveragePixelShift(B: TBox(The area you want to search); waitPerloop (How long you want it to count the pixel shift), maxTime (Amount of time you want it to keep looping): Integer): Integer (It returns an integer of the average pixel shift for every (waitPerloop) over the max time given);

Say your Result from average pixel shift was 300 (while its doing something in the box) and you had entered 1000ms for the loop time.
You would know there have been 300 pixel movements in the 1000ms


v This is the time to wait to see how many pixels have moved 1000 ms = 1 second
if (PixelShift(TheBox, 1000) < 300) then
Result := True


Hope that helps :)

putonajonny
06-11-2012, 09:19 AM
ustin;1044707']Something like this SHOULD do


procedure WaitForNoXp;
begin
repeat
wait(10);
until ((AveragePixelShift(IntToBox(x1, y1, x2, y2), 250, 500) > 500));
end;


You will need to set your own x1, y1, x2, y2

Shouldn't that be:

procedure WaitForNoXp;
begin
repeat
wait(10);
until ((AveragePixelShift(IntToBox(x1, y1, x2, y2), 250, 500) < 500));
end;