SRL Archive - Reflection Help

GroundItems


kitchenrange

2011-01-05 20:53:57

I have been having trouble finding items on the ground using reflection.

When i asked about it in the IRC they said that Items were broken.

I'm not sure who is in charge of something like this so I am posting it here.

**BANNED The Man

2011-01-06 03:08:54

I shall take a peek tonight see if i can do anything :)

-Boom

Capricorn

2011-01-06 18:04:36

Just to bring some activity in this thread, I was the one that told him that GroundItems doesn't work.

ItemsNearMe never returns an array (or maybe it does, it just has a length of zero)

Can any reflection dev's confirm that GroundItems are not working, or if anybody is working on it? Would be nice to have.

Naike

2011-01-06 18:22:40

Let me check the obvious, give me 5 mins!

It's broken, and is not being worked on atm!
Pyroryan will get to it when he can, until then, <3

tarajunky

2011-01-06 19:50:35

Yes, disappointing. After years waiting for reflection to do something well that color struggles with, this may be it. Finding items in a stack is very inefficient with color, because lower items can be completely obscured by what's on top.

pyroryan

2011-01-06 20:49:32

Try it again after update. And someone needs to post more of these things. Not leave them on secret PMs and IRC D:

tarajunky

2011-01-06 22:45:10

Working.

pyroryan

2011-01-06 23:16:46

From: tarajunky
Working.


Cool.

kitchenrange

2011-01-07 13:43:29

Thanks for the hard work I'm assuming tarajunky put in. If not thanks goes to who did it. Finding ground items with color is inefficient at best, especially when jagex puts a bunch of convieniently colored flowers that match that cowhides…

I'm surprised GroundItems was broken as it seems like one of the best things about reflection, and could be used in lots of scripts.

3Garrett3

2011-01-07 13:53:25

From: kitchenrange
Thanks for the hard work I'm assuming tarajunky put in. If not thanks goes to who did it. Finding ground items with color is inefficient at best, especially when jagex puts a bunch of convieniently colored flowers that match that cowhides…

I'm surprised GroundItems was broken as it seems like one of the best things about reflection, and could be used in lots of scripts.


Pyroryan did it. Tara confirmed it was working, I think.

Method

2011-01-07 13:54:13

From: kitchenrange
Thanks for the hard work I'm assuming tarajunky put in. If not thanks goes to who did it. Finding ground items with color is inefficient at best, especially when jagex puts a bunch of convieniently colored flowers that match that cowhides…

I'm surprised GroundItems was broken as it seems like one of the best things about reflection, and could be used in lots of scripts.


As far as I can tell from the recent changes made to the reflection svn repository, there was just a simple mix-up with the fields in the Node class that caused the error.

pyroryan

2011-01-07 15:00:21

My updater:

node.Next = 'j';
node.GetID = 'g';
node.Previous = 'k';
Simba's file

hook_node_Next = 'j'; //634
hook_node_Previous = 'g'; //634
hook_node_GetID = 'k'; //634

Notice how the position of Previous and GetID are switched for the two. I didn't switch the field names. Smart I know.

hook_node_Next = 'j'; //634
hook_node_GetID = 'g'; //634
hook_node_Previous = 'k'; //634
…So in the latest reflection hooks file, Previous and GetID match up with my updater so hopefully I won't be doing that again -.-

kitchenrange

2011-01-07 15:01:43

Hey pyro, it is still having problems for me. GetItemsNear still returns 0 items.

E: Unless this function is somehow causing it.

function PickupHide : boolean;
var
GroundItems : TGroundItemArray;
HideTile : TTile;
i : integer;
begin
GroundItems := [];
GroundItems := GetItemsNear(3);
WriteLn('Searching for hides.');
for i := 0 to High(GroundItems) do
begin
WriteLn('One Ground Item');
if GroundItems[i].ID = Inv_Hide then
begin
WriteLn('there is hide on the ground');
HideTile := TileToMS(GroundItems[i].Tile, 0);
MMouse(HideTile.x, HideTile.y, 2, 2);
if OptionExists('ake Cow') then
begin
if R_IsUpText('ake Cow') then
begin
ClickMouse2(True);
Result := True;
Exit;
end else
begin
ClickMouse2(False);
R_ChooseOption('ake Cow');
Result := True;
Exit;
end
end else
begin
Result := False;
Exit;
end;
end;
inc(i);
end;
end;

tarajunky

2011-01-07 22:22:58

It's definitely working for me, with a very similar function. My guess is that your ID may be wrong.

You can add a few lines for debugging to see if the function is working AT ALL.


function PickupHide : boolean;
var
GroundItems : TGroundItemArray;
HideTile : TTile;
i : integer;
begin
GroundItems := [];
GroundItems := GetItemsNear(3);
WriteLn('Searching for hides.');
for i := 0 to High(GroundItems) do
begin
WriteLn('One Ground Item');
[b]Writeln(GroundItems[i].ID);
Writeln(GroundItems[i].Stack);[/b]
if GroundItems[i].ID = Inv_Hide then
begin
WriteLn('there is hide on the ground');
HideTile := TileToMS(GroundItems[i].Tile, 0);
MMouse(HideTile.x, HideTile.y, 2, 2);
if OptionExists('ake Cow') then
begin
if R_IsUpText('ake Cow') then
begin
ClickMouse2(True);
Result := True;
Exit;
end else
begin
ClickMouse2(False);
R_ChooseOption('ake Cow');
Result := True;
Exit;
end
end else
begin
Result := False;
Exit;
end;
end;
inc(i);
end;
end;

If there's anything at all around you, it should tell you the ID and the number in the stack for each item in the array, until one matches the ID for a cowhide anyway.

kitchenrange

2011-01-07 22:57:47

WriteLn('One Ground Item');

That was never once debugged for me. That is at the exact same step that you have your debugs placed so it seems it would have the exact same result. No debugging.

I will add those two lines and run a few tests and report back.

E: Same result. Is everyone that is checking on it using the developers svn or the public?

pyroryan

2011-01-08 01:09:07

Changed status back to Bug since it isn't solved for kitchenrange.
Anyways, I believe the only reflection SVN used is simbareflection.googlecode.com

tarajunky

2011-01-08 01:17:31

I'm just using the SRL.sex and Reflection.sex updaters for Simba. Nothing fancy.

And it was -not- working for me before the fix. It had the same type of bug that kitchenrange is getting, where there was no debug output at all, but now it is working fine.

Capricorn

2011-01-08 10:22:26

Works fine for me too.

Bad Boy JH

2011-01-08 19:25:51

just a tiny question, are there ground items near you?

kitchenrange

2011-01-08 19:30:45

So, I've got it to detect ground items, but unless I'm running a bad function, it only detects the first 2? in the stack. If a few people could test on their machines, it seems that is what is happening to me.

E: An update has been committed. This is no longer an issue.

E2: It seems that it is still a problem. It is spotty and works on some stacks but it seems certain items mess it up. It is easy to see killing cows. When the stack is 4 high is usually a problem.

tarajunky

2011-02-13 01:08:27

It's BAAAAACK.

Broken for me again.

KingKong

2011-02-13 05:13:37

Me too :(

pyroryan

2011-02-13 11:42:25


item.getID = 'kaa.p';
item.getStack = 'kaa.r';
Is that whats in your hooks (after properly formatted)?

tarajunky

2011-02-13 18:35:00


class_Item = 'kaa'; //637
hook_item_GetID = 'p'; //637
hook_item_GetStack = 'r'; //637

pyroryan

2011-02-13 18:48:23

Update and run your script again please.

tarajunky

2011-02-13 19:24:01

Fixed, thanks.