SRL Archive - Reflection Discussion

Is reachable?


ZaSz

2009-04-09 17:52:24

I think it would be an awsome reflection failsafe…

usage

If npcisreachable(888) then  // 888 = id
begin
walktotile(...);
end;

I know there isnt isnt anything built into the game for this but cant we use our surroundings to figure it out?

edit: I would like even more something like this

If findnearestreachble(888) then  // 888 = id
begin
walktotile(...);
end;

Frt

2009-04-09 17:57:11

You could just get the Tile of the NPC and check if it's on the MM.

function NPCInReach(ID: Integer; var NPC: TNPC): Boolean;
begin
if FindNPC(ID, NPC) then
if TileOnMM(NPC.Tile) then
Result := True;
end;

Haven't tested but should compile.

EDIT: Oh, you might have meant reachable like in a house with door closed.

lordsaturn

2009-04-09 18:05:01

That is very possible. There are hooks dedicated to whether or not an area is reachable. It just has yet to be coded and implemented, which is a very complex task for this specific scenario.

ZaSz

2009-04-09 18:22:51

From: Frt

EDIT: Oh, you might have meant reachable like in a house with door closed.


thats what i want

ruler

2009-04-14 01:43:22

Color could be used.

Example:

algorithm above runs about 10ms thou is a handcoded alogthrim pure color.


Reflection can also be used.

Reflection to do something like this in SCAR would probably take 100ms but be accurate.

I will be reflection based soon.

Drakan

2009-04-14 17:33:20

daaaanng ruler! Thats nice :) U been hangin around srl lately xD. But ya, thats really sexy looking.

ruler

2009-04-14 19:19:58

From: drags111
daaaanng ruler! Thats nice :) U been hangin around srl lately xD. But ya, thats really sexy looking.

I been reading.

Also they should rename this place to valhalla.

Drakan

2009-04-14 22:09:19

rofl :P Can u give me a a synopsis of what to do to do that? Like what is the approach?

Bobarkinator

2009-04-15 16:56:13

From: drags111
rofl :P Can u give me a a synopsis of what to do to do that? Like what is the approach?


Looks like he checks all around the minimap for doors and those are his boundaries, he then just converts those coordinates to main screen coordinates when needed.

That's my guess.

Nava2

2009-04-16 07:13:03

Probably gets all the doors and walls. Then compares the slope of the doors with the slop of the attached walls. If they match, impassible. Then get the color around the character and created an array an the wall and door boundries. If the point to walk in in the new array of the ground then it is walkable.

I'm considering writing this up..

alar82

2009-08-29 02:43:52

public boolean canReach(final Object obj, final boolean isObject) {
if (obj instanceof RSCharacter) {
return Calculations.canReach(((RSCharacter) obj).getLocation(),
isObject);
} else if (obj instanceof RSTile) {
return Calculations.canReach((RSTile) obj, isObject);
} else if (obj instanceof RSObject) {
return Calculations.canReach(((RSObject) obj).getLocation(),
isObject);
} else if (obj instanceof Point) {
return Calculations.canReach(new RSTile(((Point) obj).x,
((Point) obj).y), isObject);
}
return false; // Couldn't recognize object


Its method from rsbot source, some lumbyflaxer used it to checks if door is open and spinner reachable.
Its possible as you can see.
And I Have no idea how to implant it to smart/reflection:D

link to rsbot methods:http://rsbotsvn.googlecode.com/svn/trunk/src/com/speljohan/rsbot/script/Methods.java
Link to calculations wich are used as seen:http://rsbotsvn.googlecode.com/svn/trunk/src/com/speljohan/rsbot/script/Calculations.java

Rich

2009-08-29 15:18:56

This thread is 4 months old. Look at the last post date before you post, so you don't gravedig threads. I won't report you though since what you posted is on-topic.

Richard.

Sir R. M8gic1an

2009-08-29 15:39:33

From: R1ch
This thread is 4 months old. Look at the last post date before you post, so you don't gravedig threads. I won't report you though since what you posted is on-topic.

Richard.


Don't be an ass. His post was interesting, and completly new in relation to the others.

However, alar, Rich is right, usually we avoid posting in threads older than 3 months as the subject is dead by then.

~RM

Rich

2009-08-29 15:51:29

I reminded him of the rules nicely, some people would flame him straight away, and I get called an ass? :mad:

Bobarkinator

2009-08-29 19:13:42

I don't think alar did anything wrong. This topic was still relatively open seeing as how we never came to a conclusion. His new information will be helpful to what this thread is trying to achieve.

n3ss3s

2009-08-30 14:35:44

Just translate the canReach of RSBot to SCAR… Will take a while as it's a huge chunk… Remember that to access the Blocks array you have to use SmartGetFieldArray2D -functions, instead of [ ]'s…