SRL Archive - Jr. Member General Help and Discussion

Backpack.isLocked()


PheteyGee

2014-10-23 19:27:08

Hey homies,

Am implementing a cross check/fail safe for a part of my script and was trying to think of a unique way (tailored to my scripts situation) of doing this.
Currently when it gets to a point it locks the backpack… was hoping to be able to check if the backpack is locked and therefore I am at the position.

I've come across TRSTabBackpack.isLocked() : Boolean function in the SRL6 backpack include files

heres the code:
 function TRSTabBackpack.isLocked(): boolean;
begin
result := (getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35) = 1906963);
end;

That's pretty self explanatory right? Well… the thing is that the SRL6 backpack include doesn't have any comments or examples of this being used. Does this mean it is not currently working? I'm thinking the color needs updating as I ran through the getColor Function and it came up with a false result (even though my backpack was locked)… Anyone think of a work around? or a way in implementing a backpack locked check?

Thanks
PheteyGee.

Ashaman88

2014-10-23 19:35:11

if it ain't workin open up a bug report for me :)
https://villavu.com/forum/project.php

Justin

2014-10-23 19:57:59

This has been working for me, (Unless @NKN; noticed it was broken)


while(bankScreen.isOpen() or tabBackpack.isLocked()) do
begin
bankScreen.close();
wait(500+randomRange(220,290));
end;

This snippet was taken from a test script. (No fail-safe inside the while loop)

Sin

2014-10-23 20:00:18

I just honestly use tabBackpack.waitWhileLocked(), works really well.

PheteyGee

2014-10-24 02:52:01

Hmm I'll try again when I get home, but .waitwhilelocked doesn't meet my purpose… I can't be waiting I need to be doing while it's locked :P

The Mayor

2014-10-24 03:41:52


function TRSTabBackpack.isLocked(): boolean; override;
begin
writeLn(getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35));
result := (getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35) = 1906963);
end;

Copy and paste this override into your script and see if it prints 1906963 when it checks to see if it's locked.

PheteyGee

2014-10-24 21:53:22

Simba Code:
function TRSTabBackpack.isLocked(): boolean; override;
begin
writeLn(getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35));
result := (getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35) = 1906963);
end;

Copy and paste this override into your script and see if it prints 1906963 when it checks to see if it's locked.


Ran it 10 times while the backpack is locked
Prints:
591363 x10

While unlocked:
4669231 x10

Ran it again 10 times while backpack is locked with the while loop
while( not tabBackpack.isLocked()) do
begin
writeln(getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35));
wait(500+randomRange(220,290));
end;

Came up with:
722948 x10

I must just be scripting wrong :/

The Mayor

2014-10-24 22:42:13

From: PheteyGee
Ran it 10 times while the backpack is locked
Prints:
591363 x10

While unlocked:
4669231 x10

Ran it again 10 times while backpack is locked with the while loop
while( not tabBackpack.isLocked()) do
begin
writeln(getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35));
wait(500+randomRange(220,290));
end;

Came up with:
722948 x10

I must just be scripting wrong :/


Well then replace the colour you came up with, with the one in the function already, and see if it works.

result := (getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35) = 1906963);

to

result := (getColor(gameTabs.tabArea.x1 + 92, gameTabs.tabArea.y2 -35) = 591363);

PheteyGee

2014-10-26 08:11:17

Sorry it took so long to reply to the thread, work and other stuff on. Plugged in some numbers - all is working out. :)

Thanks heaps for your help :)