SRL Archive - Reflection Help

Using Interfaces


Coolerthanauto

2009-08-17 11:10:54

Ok, So I have been browsing the forums because I want to learn how to use interfaces, however I have not been able to find anything (aside from the debugger for rsbot that I cannot get to work) I would really appreciate it if someone would tell me how to get interface id's and possibly how to use them a little too. Thanks.

Infantry001

2009-08-17 14:50:18

I think KBot has a good interface debugger.

Gu3st...

2009-08-17 15:41:11

From: Infintry001
I think KBot has a good interface debugger.

It is hard to understand.. I have tried to find the interface of a shop but none of the interfaces KBot found were the one I was looking for.

Infantry001

2009-08-17 15:45:38

Or maybe I used the OBot debugger… I'm not sure XD

Anyways, interfaces are terribly difficult for me to understand. Maybe someone will make a guide on them one day… ;)

n3ss3s

2009-08-17 17:01:50

There is the parent interface, and it's X and Y coordinates are calculated from the beginning of the RS screen, (0, 0). A parent has child interfaces, which's X and Y coordinates are calculated from the beginning of the parent interface, and their position on the RS screen is parentX + childX, parentY + childY. A child has components, for example in the magic tab there is a huge "frame" that has all the spell images in it, the frame is a child of the inventory interface and the spells are components of the child. The component's position is parentX + childX + componentX, parentY + childY + componentY.

Should give you an idea of the structure.

Coolerthanauto

2009-08-17 20:03:43

Thank you n3ss3s. Let me see if I've go this straight. So, if i opened the bank then that would be the parent, and the area in which everything is stored and the buttons would all be children, right? And the items would be objects? I know that I could just use the reflection banking tools in this example, but I actually want to use it for the account designing section of tutorial island.

Also which part of the interface is its coordinate? Is it the center? Or is it the bottom left since it is calculated from (0,0). Thanks for the general concepts though, I appreciate it.

Runescapian321

2009-08-17 20:10:28

From: Coolerthanauto
Thank you n3ss3s. Let me see if I've go this straight. So, if i opened the bank then that would be the parent, and the area in which everything is stored and the buttons would all be children, right? And the items would be objects? I know that I could just use the reflection banking tools in this example, but I actually want to use it for the account designing section of tutorial island.

Also which part of the interface is its coordinate? Is it the center? Or is it the bottom left since it is calculated from (0,0). Thanks for the general concepts though, I appreciate it.


(0,0) is the top left

X———–
————
————
————


X = (0,0)

Coolerthanauto

2009-08-17 20:36:22

Ok, So beginning of rs window is top left, (I was thinking like a coordinate plane start at lower left) but what I really need to know is if my bank example was correct and where the interface coordinates are in relation to the interface window/'box/whatever (Top left, center, bottom right?)

Method

2009-08-17 20:58:23

If you're planning on clicking on interfaces using their coordinates, it won't be possible with reflection. The offset x and y coordinates are passed as parameters to a method in the client and are not stored anywhere.

Infantry001

2009-08-17 21:03:22

So how did you guys develop all the interface work then?

Method

2009-08-17 21:10:09

From: Infintry001
So how did you guys develop all the interface work then?


I'm not sure I follow. Interfaces.scar doesn't need any coordinates to operate, but are you talking about something else?

Infantry001

2009-08-17 21:28:55

Such as the Inventory, Chatbox, MMLevels, etc. I believe those are "interfaces", right?

Method

2009-08-17 21:33:55

Yes, those are interfaces, and none of them require grabbing the offsets or coordinates.

Infantry001

2009-08-17 21:39:11

So how do you know where to click, or read information, or whatever you guys do? lol

Method

2009-08-17 21:43:44

Every location that needs to be clicked is either hard coded into the parameters of Mouse or calculated using base coordinates that are manipulated depending on certain factors.

You don't need any coordinates to access an interface's information.

Infantry001

2009-08-17 21:48:58

Haha ok. There's so much I don't really get about how Reflection works… 0_o

I'll leave it up to the professionals. =P

mormonman

2009-08-18 01:12:01

From: Method
If you're planning on clicking on interfaces using their coordinates, it won't be possible with reflection. The offset x and y coordinates are passed as parameters to a method in the client and are not stored anywhere.


Which is why we can't do reflection banking.

Infantry001

2009-08-18 01:19:53

From: mormonman
Which is why we can't do reflection banking.

We can't do it ever?

mormonman

2009-08-18 01:20:32

From: Infintry001
We can't do it ever?


Not with the current hooks/methods we use for reflection.

Infantry001

2009-08-18 01:39:04

From: mormonman
Not with the current hooks/methods we use for reflection.

But if Ben were to edit SMART, it'd be possible, right?

mormonman

2009-08-18 01:43:20

From: Infintry001
But if Ben were to edit SMART, it'd be possible, right?


If you mean edit it to add BCEL, then yes. But there is no chance of that.

Infantry001

2009-08-18 02:07:48

From: mormonman
If you mean edit it to add BCEL, then yes. But there is no chance of that.

Oh ok, didn't know that required BCEL.

:(

mormonman

2009-08-18 02:32:19

From: Infintry001
Oh ok, didn't know that required BCEL.

:(


AFAIK it does… Method correct me if I am wrong.

Method

2009-08-18 08:28:55

You'd need to edit the method using some sort of bytecode library (BCEL is one), yes. Plus you'd have to add variables to the "interface" class that would be set in the edited method.