SRL Archive - SRL Snippets

isSystemUpdating()


HKbotz

2015-02-16 06:39:44

[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+zMDCkAekUIN4ClN8IxJuBeBMUXwbiRUDcwc3P0A7E3TxADWhABAlzoWFGPBgKAMWyCwY=');
if (findDTM(sysUpdateDTM, p.x, p.y, getClientBounds())) then
begin
writeln('Found system update screen.');
result := true;
end;
freeDTM(sysUpdateDTM);
end;

Clarity

2015-02-16 08:54:52

Thank you for this! :) +Repped.

Flight

2015-02-16 09:11:46

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

2015-02-16 10:18:51

From: Clarity
Thank you for this! :) +Repped.

No problem :)

From: Flight
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

2015-02-16 11:43:07

From: HKbotz

snip


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

HKbotz

2015-02-16 21:00:49

From: hoodz
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

2015-02-16 21:09:10

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;