SRL Archive - OSR Help

Check necklace charges


GREEN GIANT

2013-07-22 11:21:01

Hi Guys,

I complied a quick Games necklace teleport charges checker (code below) but it doesn't seem to work. It will compile but isn't returning the planned results. Can anyone see the problem?

Procedure GNeckCheck;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 2, 2);
wait(200+ random (200));
if IsUpTextMultiCustom(['8', '7']) then
begin
writeln('has charges');
end else
begin
writeln('need new necklace')
end;
end;
FreeDTM(GNeck);
end;

Begin
setupsrl;
GneckCheck;
end.

rj

2013-07-22 11:23:42

Is stuff even working for RS3 atm? or is this for oldschool?

GREEN GIANT

2013-07-22 11:24:54

From: Officer Barbrady
Is stuff even working for RS3 atm? or is this for oldschool?


Sorry i always forget to mention this is for OSR :)

Kevin

2013-07-22 11:25:18

At what part does it fail? Does it even click the necklace? Try printing the uptext value. Would you prefer to have a single function that returned the charges as an integer like this?

function NeckCheck: integer;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 2, 2);
wait(200+ random (200));
Result:= GetNumbers(GetUpText);
FreeDTM(GNeck);
end;

GREEN GIANT

2013-07-22 11:29:18

From: Kevin
At what part does it fail? Does it even click the necklace? Try printing the uptext value. Would you prefer to have a single function that returned the charges as an integer like this?

function NeckCheck: integer;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 2, 2);
wait(200+ random (200));
Result:= GetNumbers(GetUpText);
FreeDTM(GNeck);
end;


Sorry, it doesn't fail, I'll explain in more depth.

Basically, i have a Games necklace (8) equipped, it successfully find the games necklace and should in theory return with 'Has charges' because i have it search for the '8' in uptext, but it keeps returning 'Need new necklace' I think the uptext is the problem.

rj

2013-07-22 11:30:33

From: GREEN GIANT
Sorry, it doesn't fail, I'll explain in more depth.

Basically, i have a Games necklace (8) equipped, it successfully find the games necklace and should in theory return with 'Has charges' because i have it search for the '8' in uptext, but it keeps returning 'Need new necklace' I think the uptext is the problem.


Try using waituptext:


{$I SRL/SRL.Simba}
Procedure GNeckCheck;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 5, 5);
if WaitUpTextMulti(['8','7'],400) then
begin
writeln('has charges');
end else
begin
writeln('need new necklace')
end;
end;
FreeDTM(GNeck);
end;
Begin
setupsrl;
GneckCheck;
end.

GREEN GIANT

2013-07-22 11:40:48

From: Officer Barbrady
Try using waituptext:


{$I SRL/SRL.Simba}
Procedure GNeckCheck;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 5, 5);
if WaitUpTextMulti(['8','7'],400) then
begin
writeln('has charges');
end else
begin
writeln('need new necklace')
end;
end;
FreeDTM(GNeck);
end;
Begin
setupsrl;
GneckCheck;
end.


Tried the above but it still returns 'Need new necklace' when it should be returning 'Has Charges'.

GREEN GIANT

2013-07-22 11:47:09

Its definitely something to do with detecting the '(8)', if i change the uptext to 'ames' or 'ace' it works fine, but fails if i use '8' or '(8)'

Kevin

2013-07-22 11:52:51

Time to test the results in that case:
procedure NeckCheck;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 2, 2);
wait(200+ random (200));
Writeln(GetUpText);
FreeDTM(GNeck);
end;

GREEN GIANT

2013-07-22 11:58:47

From: Kevin
Time to test the results in that case:
procedure NeckCheck;
Var
Gneck, x, y: integer;
begin
GNeck := DTMFromString('mwQAAAHic42RgYKhnYmBoAeJqIK4A4hoovwuI+6GYj5GBQQiIxRkhbDYg/ssAwUxANgcQc/LGA3mMeLERA2GA3wQIhgMAr0QHyA==');
If (FindDTM(GNeck, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
MMouse(x, y, 2, 2);
wait(200+ random (200));
Writeln(GetUpText);
FreeDTM(GNeck);
end;


Wow, how strange. The above UpTextCheck returns 'Remove Games necklr'. If that's the case how am i meant to check charges?

Kevin

2013-07-22 12:04:54

The font may require an update to detect non-alphanumeric symbols more accurately '('

GREEN GIANT

2013-07-22 12:07:24

From: Kevin
The font may require an update to detect non-alphanumeric symbols more accurately '('


Ahhh that may be the problem, my Simba says New Fonts Available: Current 13 Newest: 14.

I haven't the foggiest idea how to update fonts for OSR though…..

EDIT:

Managed to resolve the problem by using function 'OptionExists', it now right-clicks the games necklace and if its finds the '8' returns 'Has charges' or if it doesn't returns 'Need new necklace'.

Works quite well :)