SRL Archive - SRL Bugs

Something Very Weird Happening with InvEmpty();


putonajonny

2012-04-12 18:40:04

I have this procedure:
  if(InvEmpty)then
begin
WriteLn('Inventory is empty')
NoMoreFood := True;
end;

In the debug box I am getting:
Inventory is empty
which causes my script to run off to the bank
when my invent looks like this:
This causes my script to bank every 2 mins :S

The Weird Part:
The code for InvEmpty is
function InvEmpty: Boolean;
var
X, Y: Integer;
begin
GameTab(tab_Inv);
Result := (not FindColor(X, Y, srl_outline_black, MIX1, MIY1, MIX2, MIY2));
end;

//From Globals:
const
MIX1 = 547;
MIY1 = 202;
MIX2 = 737;
MIY2 = 466;

srl_outline_black = 131072;

and when I use the colour picker:
Picked colour: 131072 at (619, 228)

:confused: :confused: :confused: :confused: :confused: :confused: :confused:

edit:
My only guess is lag from pressing the inventory tab before it actually shows it which wouldn't be unheard of for my internet connection:

PatDuffy

2012-04-12 18:45:40

YES I FINALLY FOUND SOMEONE WITH A WORSE CONNECTION THAN ME!!!!!

On Topic: I had that exact problem with eating procedures (also with swordfish) in my Aviansie script when I was making it, the only solution I had was to modify the FindColor to look for the purple instead of the black outline. In your case, maybe have it double-check? Like…

if foodNotFound then
LookForFood;

or something like that just to do a double-check if the inventory is truly empty.

Coh3n

2012-04-12 19:52:18

Try adding a wait in between the GameTab call and the Result setting. See if that helps.

Abu

2012-04-12 20:07:10

Maybe make your own function with InvEmpty in it?

function IsInvEmpty: Boolean;
begin
Wait(600 + Random(500)); //in case of lag
Result := InvEmpty
end;

//later on in your other function
if(IsInvEmpty)then //use here
begin
WriteLn('Inventory is empty')
NoMoreFood := True;
end;

hoopla

2012-04-12 20:25:35

Yes a small wait and check should alleviate your issue…I had the same problem with a script I edited from checkinginvfull to invempty…

weequ

2012-04-12 20:48:14

I've had similar lag issues in the past. Just double check, triple check or check in a loop with a timeout ;)

Yago

2012-04-12 21:16:40

From: weequ
I've had similar lag issues in the past. Just double check, triple check or check in a loop with a timeout ;)


This is what I do…

Also, are you using SMART? If SMART(actually just runescape) gains focus then I get a black screen for 0.4 - 2seconds… So, my scripts checks if loggedin every 50ms and it returns false upon focusing on SMART. Maybe the same thing is happening for you.

Flight

2012-04-12 21:43:28

From: Coh3n
Try adding a wait in between the GameTab call and the Result setting. See if that helps.


This is what happened to me in the past, but for spell-casting.

Try this:

if GameTab(tab_Inv) then
begin
if InvEmpty then
begin
WriteLn('Inventory is empty')
NoMoreFood := True;
end;
end;

Edit:
If it's still not working you might try "if (InvCount < 1) then". I know it follows the same routines of counting blacklines, but 'tis worth a shot if worst comes to worst.