PDA

View Full Version : isSystemUpdating()



HKbotz
02-16-2015, 11:39 AM
[RS3]A function to tell if the popup box that says the system will update in XX:XX time is on the screen or not. I have had many scripts die because of it, so this is useful for telling if the update popup is the cause or not.

function isSystemUpdating(): boolean;
var
sysUpdateDTM: integer;
p: TPoint;
begin
result := false;
sysUpdateDTM := DTMFromString('mlwAAAHicY2dgYEhiZWDQBOIJQHwIiH+zMD CkAekUIN4ClN8IxJuBeBMUXwbiRUDcwc3P0A7E3TxADWhABAlz oWFGPBgKAMWyCwY=');
if (findDTM(sysUpdateDTM, p.x, p.y, getClientBounds())) then
begin
writeln('Found system update screen.');
result := true;
end;
freeDTM(sysUpdateDTM);
end;

Clarity
02-16-2015, 01:54 PM
Thank you for this! :) +Repped.

Flight
02-16-2015, 02:11 PM
I have a couple thoughts. First off, is this for RS3 or OSRS? Secondly, would it not be easier to use some OCR to check for the update text within a small area of the main screen? Also, don't forget to free your DTM before exiting the function!

HKbotz
02-16-2015, 03:18 PM
Thank you for this! :) +Repped.
No problem :)


I have a couple thoughts. First off, is this for RS3 or OSRS? Secondly, would it not be easier to use some OCR to check for the update text within a small area of the main screen? Also, don't forget to free your DTM before exiting the function!
This is for RS3. I was going to use OCR but I caught the update popup right before it updated so I didn't have time to mess with any OCR stuff. Next time I catch an update when I'm not afk I will try for it.
Thanks for the catch about freeing DTM, I added it.

Hoodz
02-16-2015, 04:43 PM
snip

mem leak still not fixed, this will fix it:
function isSystemUpdating(): boolean;
var
sysUpdateDTM: integer;
p: TPoint;
begin
result := false;
sysUpdateDTM := DTMFromString('mlwAAAHicY2dgYEhiZWDQBOIJQHwIiH+zMD CkAekUIN4ClN8IxJuBeBMUXwbiRUDcwc3P0A7E3TxADWhABAlz oWFGPBgKAMWyCwY=');
if (findDTM(sysUpdateDTM, p.x, p.y, getClientBounds())) then
result := true
freeDTM(sysUpdateDTM);
end;

HKbotz
02-17-2015, 02:00 AM
mem leak still not fixed, this will fix it:

Lol thanks. I guess I should stop doing these things at 7am after being up all night :p

The Mayor
02-17-2015, 02:09 AM
I have this is quite a few of my scripts:


function isUpdateComing(): Boolean;
var
TPA: TPointArray;
begin
findColors(TPA, 0, intToBox(300, 25, 499, 74));
result := ((TPA.getBounds().getWidth() = 200) and (TPA.getBounds().getHeight() = 50));
end;