SRL Archive - Reflection Development

Some functions


Gu3st...

2010-05-29 06:06:29

I just quickly made some procedures and functions for you guys

Bank.simba:
{*******************************************************************************
function R_DepositAllID(ID : Integer): Boolean;
By: Zyt3x
Description: Deposits all the items with the specified ID
*******************************************************************************}
function R_DepositAllID(ID : Integer): Boolean;
begin
Result := R_ClickItemID(ID, false, 'All');
end;

{*******************************************************************************
procedure R_DepositItemsButIDEx(IDs : TIntegerArray);
By: Zyt3x
Description: Deposits all items but the items with one of the specified IDs to the bank.
*******************************************************************************}
procedure R_DepositItemsButIDEx(IDs : TIntegerArray);
var
I : Integer;
Item : TInvItem;
begin
for I := 1 to 28 do
begin
Item := GetInvItemAt(I);
if(InIntArray(IDs, Item.ID))then Continue;
R_ClickItem(I, False, 'eposit');
end;
end;

{*******************************************************************************
procedure R_DepositItemsButID(ID : Integer);
By: Zyt3x
Description: Deposits all items but the items with the specified ID to the bank.
*******************************************************************************}
procedure R_DepositItemsButID(ID : Integer);
begin
R_DepositItemsButIDEx([ID]);
end;

{*******************************************************************************
function R_DepositAll: Boolean;
By: Zyt3x
Description: Deposits all items to bank.
*******************************************************************************}
function R_DepositAll: Boolean;
begin
DepositAll;
Result := R_InvEmpty;
end;

Iventory.simba:
{*******************************************************************************
function R_InvEmpty : Boolean;
By: Zyt3x
Description: Results true if the inventory is empty
*******************************************************************************}
function R_InvEmpty : Boolean;
begin
Result := R_InvCount = 0;
end;

{*******************************************************************************
function R_InvFull : Boolean;
By: Zyt3x
Description: Results true if the inventory is full
*******************************************************************************}
function R_InvFull : Boolean;
begin
Result := R_InvCount = 28;
end;

EDIT: Some more:
core.simba:
{*******************************************************************
Function LoginIndex: Integer;
By: Zyt3x
Description: Uses the LoginIndex hook.
2 = Logged Out, 4 = Logging Into Lobby, 6 = Lobbby,
8 = logging into game, 9 = Logged In. Reaches 10 at
some points, but with no significance.
********************************************************************}
function LoginIndex : Integer;
begin
Result := SmartGetFieldInt(0, hook_static_LoginIndex);
end;

{*******************************************************************
Function R_LoggedIn: Boolean;
By: Method / Drags111 / Zyt3x
Description: Uses LoginIndex to see if you're logged in.
********************************************************************}
function R_LoggedIn: Boolean;

begin
Result := LoginIndex = 9;
end;

{*******************************************************************
function R_InLobby : Boolean;
By: Zyt3x
Description: Uses LoginIndex to see if you're in lobby.
********************************************************************}
function R_InLobby : Boolean;
begin
Result := LoginIndex = 6;
end;

More Bank.simba:
{*******************************************************************************
procedure R_DepositItem(Slot: integer);
By: Zyt3x
Description: Deposits the item at the slot.
*******************************************************************************}
procedure R_DepositItem(Slot: integer);
var
mt, t: integer;
begin
MarkTime(mt);
while(R_ItemExists(slot) and (TimeFromMark(mt) < 5000))do
begin
MouseItem(slot, false);
R_ChooseOption('eposit');
MarkTime(t);
while(R_ItemExists(slot) and (TimeFromMark(t) < 1500))do
wait(25+Random(25));
end;
end;

{*******************************************************************************
function R_DepositAllID(ID : Integer): Boolean;
By: Zyt3x
Description: Deposits all the items with the specified ID
*******************************************************************************}
function R_DepositAllID(ID : Integer): Boolean;
begin
Result := R_ClickItemID(ID, false, 'All');
end;

{*******************************************************************************
procedure R_DepositAllItemsName(Name: String);
By: Zyt3x
Description: Deposits all the items with the specified Name
*******************************************************************************}
procedure R_DepositAllItemsName(Name: String);
var
i: integer;
item: TInvItem;
begin
for i := 1 to 28 do
begin
item := GetInvItemAt(i);
if(lowercase(item.Name) = lowercase(Name))then
R_DepositItem(i);
end;
end;

i luffs yeww

2010-05-29 06:20:11

DISREGARD THAT, I SUCK COCKS.

:) Good work, Zyt3x. ^^

masterBB

2010-05-29 07:08:43

From: i luffs yeww
Couldn't R_DepositItemsButIDEx simply be..


{*******************************************************************************
procedure DepositAll;
By: Zyt3x
Description: Deposits all items.
*******************************************************************************}
procedure DepositAll;
var
i: Integer;
begin
for i := Low(IDs) to High(IDs) do
R_DepositAllID(IDs[i]);
end;


This won't work anyway. You used an array called IDs, but you never created it nor filled it with data.

Gu3st...

2010-05-29 07:10:35

Actually, there is one R_DepositAll; function, but I think it's a waste to have it like it is right now :p

i luffs yeww

2010-05-29 07:25:06

:p MasterBB, don't even pay attention to me most of the time. x] I tend to be high.

Drakan

2010-05-29 07:52:40

Thanks for your input! :) However we ran into a problem with banking. For SOME reason, the inventory interface will NOT update until you close the bank, so at the moment, we are having to use color substitutes while the bank is open.

Gu3st...

2010-05-29 08:30:09

Oh.. That's weird :confused:
Well.. you'll figure it out :)

EDIT: What about R_InvFull and R_InvEmpty?

Drakan

2010-05-29 08:38:56

From: Zyt3x
Oh.. That's weird :confused:
Well.. you'll figure it out :)

EDIT: What about R_InvFull and R_InvEmpty?


You're right, I figured it out :P I found there is a different interface they use for the inventory while the bank is open. I'm just implementing it in Inventory.simba and i'll commit. And I'll add these functions of yours :) Thank you for your input zyt3x! It's so much better when people POST some code instead of telling me how much they hate what i have *cough narcle cough*

Gu3st...

2010-05-29 08:40:57

Lol hehe, I just made some real fast as I was bored… :p
It didn't take long.. I could make some more if you want :)

Drakan

2010-05-29 08:42:08

From: Zyt3x
Lol hehe, I just made some real fast as I was bored… :p
It didn't take long.. I could make some more if you want :)


that would be great tbh :) Once ben wakes up I can have him add you to the svn too.

Gu3st...

2010-05-29 08:53:20

Thanks! :D
Heh, I didn't really aim for this but yeah.. That would make things easier :P

Wanted

2010-05-29 12:52:31

What's the point of making completely stable functions in color, into reflection?

Sir R. M8gic1an

2010-05-29 13:25:42

From: IceFire908
What's the point of making completely stable functions in color, into reflection?


Different methods.

What's the point of having FindObject and R_FindObject?

Different methods.

~RM

Narcle

2010-05-29 14:02:46

From: drags111
You're right, I figured it out :P I found there is a different interface they use for the inventory while the bank is open. I'm just implementing it in Inventory.simba and i'll commit. And I'll add these functions of yours :) Thank you for your input zyt3x! It's so much better when people POST some code instead of telling me how much they hate what i have *cough narcle cough*


Pff, hey I called that new inventory interface while bank is up. :P

From: IceFire908
What's the point of making completely stable functions in color, into reflection?


Why is there Sleep() when there is a Wait()????

Wanted

2010-05-29 15:58:25

From: Rasta Magician
Different methods.

What's the point of having FindObject and R_FindObject?

Different methods.

~RM


FindObject reflection is a 100xs more reliable than FindObject.scar (lmao) why do we need a R_BankScreen? Seems pointless imo

From: Narcle

Why is there Sleep() when there is a Wait()????


Sleep and wait are not the same thing

MylesMadness

2010-05-29 15:59:22

From: IceFire908
Sleep and wait are not the same thing
Oh really?

Drakan

2010-05-29 16:19:06

From: MylesMadness
Oh really?


Yah, one takes a nap, the other just stares at the clock. :)

Sir R. M8gic1an

2010-05-30 08:27:25

From: IceFire908
FindObject reflection is a 100xs more reliable than FindObject.scar (lmao) why do we need a R_BankScreen? Seems pointless imo


Because Jagex likes to change pixels around.

~RM

Wizzup?

2010-05-30 12:15:55

From: IceFire908
Sleep and wait are not the same thing


Reflection is used only in Simba AFAIK, and in Simba they are the same, AFAIK (again). It's rather pointless to make different ones anyway.

TBH I don't see the good of R_BankScreen either, RM… Jagex likes to change their client hooks too. Unless you want to replace the non-reflection core of SRL, I don't see why you would write core functions in Reflection?

Sir R. M8gic1an

2010-05-30 17:34:18

I see no reason to discourage the making of such functions. If it gets someone to script, why not?

Also, reflection and color get fixed at different times and broken at different times. If one falls, the other can do the job. Some may never even break - but having a backup doesn't hurt at all.

~RM