SRL Archive - Reflection Help

Cast spells


TomTuff

2010-11-19 22:36:29

I need to cast the Teleport to Varrock spell via reflection. How do i go about this?

Thanks :)

Cstrike

2010-11-19 22:48:41

So far AFAIK there's not a set way to do this. What you can do is check with some textures to see if the texture ID is good when you want to teleport, then just throw a Mouse (x,y,…); at it :)

TomTuff

2010-11-20 00:09:29

From: cstrike
So far AFAIK there's not a set way to do this. What you can do is check with some textures to see if the texture ID is good when you want to teleport, then just throw a Mouse (x,y,…); at it :)


elaborate on textures?

Cstrike

2010-11-20 00:48:35

From: TomTuff
elaborate on textures?


Two ways of doing it are:

1) Grabbing texture ID (spell lit up will have a different ID than not being lit up, good failsafe)
2) Grabbing X/Y (I can make code for this), will get it's relative position on the magic interface, but not the absolute (ex: it could return Point(24, 95), when it's actual absolute position would be Point(534, 443)).

That would be one way, may be developed soon :)

Naike

2010-11-20 04:34:32

Things like these will be thrown in when we have some more manpower.
It's all coming, soon enough :)

NCDS

2010-11-20 22:20:22

With multiple non-reflection ways of doing this, why do you seek a way to do it with reflection?

Note: I'm not down talking anything, just curious.

Cstrike

2010-11-21 09:49:03

From: NCDS
With multiple non-reflection ways of doing this, why do you seek a way to do it with reflection?

Note: I'm not down talking anything, just curious.


Probably for the challenge of making it :)

EDIT: Though for now we need to see if the absolute position hooks are able to be found, or else there'll have to be a new way.

Bad Boy JH

2010-11-22 09:12:11

if we can get the position of main interface through that hook, then get the relative position in terms of that interface then add the X and Y values that would work, however I don't know if that hook could do that…

On a side note Naike, I would be more than willing to help you guys and provide some extra manpower, however I know absolutely no java…So I'm probably not much help at all…

Naike

2010-11-22 15:42:20

From: Bad Boy JH
if we can get the position of main interface through that hook, then get the relative position in terms of that interface then add the X and Y values that would work, however I don't know if that hook could do that…

On a side note Naike, I would be more than willing to help you guys and provide some extra manpower, however I know absolutely no java…So I'm probably not much help at all…


I have zero java knowledge.

pyroryan

2010-11-22 17:06:58

From: Naike
I have zero java knowledge.


I have zero knowledge. I have experiences that somehow let me do things.

Cstrike

2010-11-22 17:51:26

I have a really crap knowledge of java. Can make system.out.println('Hello World!'); (and its probably quotation marks), and some loops, but that's all

pyroryan

2010-11-22 17:56:22

From: cstrike
I have a really crap knowledge of java. Can make system.out.println('Hello World!'); (and its probably quotation marks), and some loops, but that's all


Experiences say Java likes caps.
System.out.println("Hello World!");

Bad Boy JH

2010-11-22 18:48:18

OK, I though all that hooks and stuff was java based, perhaps I can be of some assistance then…

pyroryan

2010-11-22 19:08:05

From: Bad Boy JH
OK, I though all that hooks and stuff was java based, perhaps I can be of some assistance then…


Well, the script calls a Smart method to utilize the hooks. So in a sense, it is java based.

weezy

2010-11-26 17:39:03

Why do you need it to be based on reflection, you need reflection for things such as character movement across the map, but using color for such thing would actually make it more viable as you wouldn't need to update hooks and colors stay the same for the most part.

Here is how I cast my spells…


procedure HighAlch();
begin
if MSHighAlch > 500 then
exit;
MSHighAlch := 2000;
if GetCurrentTab <> 28 then
GameTab(28);
ClickBox(HighAlchemy,true);
Sleep(300+random(150));
ClickBox(InvBox(AlchItem.slot),true);
end;

This method simply has a box for spell locations and uses ClickBox function to click it, you could also use things such as DTM's, color recognition…

Cstrike

2010-11-27 18:35:25

From: weezy
Why do you need it to be based on reflection, you need reflection for things such as character movement across the map, but using color for such thing would actually make it more viable as you wouldn't need to update hooks and colors stay the same for the most part.

Here is how I cast my spells…


procedure HighAlch();
begin
if MSHighAlch > 500 then
exit;
MSHighAlch := 2000;
if GetCurrentTab <> 28 then
GameTab(28);
ClickBox(HighAlchemy,true);
Sleep(300+random(150));
ClickBox(InvBox(AlchItem.slot),true);
end;

This method simply has a box for spell locations and uses ClickBox function to click it, you could also use things such as DTM's, color recognition…


If you can get the relative absolute root position of the magic interface (which is easy ;)), you could almost deal with any update change (excluding a huge overhaul) as reflection would be able to pinpoint the exact box to click by getting relative X and relative Y's of the magic spell to click. Same goes for if they change the symbols instead of location as well… or even both!