View Full Version : Object Finding.. Out of Memory :(
Brandon
03-11-2011, 07:33 AM
Why does this give me Out of Memory error... It makes me have to restart simba in order to run the script again... It runs out of memory after 3 rocks :S
Procedure FindRock1;
var
RockObj : TRSObject;
Rock: TTile;
RockLoc: TTile;
Me:TMe;
begin
Me := GetMe;
RockObj := GetObjectByID (3803, OBJECT_TYPE_INTERACTABLE, 52);
If(FindRSObjectSimple(RockObj) = True) then
begin
Repeat
Writeln('The First rock is found!');
wait(500);
Mouse(RockObj.Tile.x, RockObj.Tile.y, 2, 2, True);
Writeln('Clicked the first rock.');
writeln ('Climbed down the First Rock!');
Until((Me.Animation = 740) or (Me.Animation = 739));
end else
begin
wait(500);
RockLoc := Tile(2885, 3683); //Rock Position Tile
Rock := TileToMS (RockLoc, 0);
Mouse (Rock.x, Rock.y, 2, 2, false);
if R_ChooseOption ('Climb Rocks') then
begin
writeln ('Climbed down the First Rock!');
end else
writeln('Cannot Find the First Rock!');
end;
end;
And can someone explain why this doesnt work?
Procedure TrollHeimWalk2;
var
TTroll2: TTileArray;
Me: TTile;
begin
Me:= GetMyPos; //(2884,3683)
//Repeat
TTroll2 := [Tile(2881,3686), Tile(2874,3677), Tile(2874,3669), Tile(2872,3671)];
WalkPath(TTroll2);
//Until((Me.x = 2872) and (Me.y = 3671));
end;
i luffs yeww
03-11-2011, 07:35 AM
Reflection has memory leaks. I'd suggest restarting and trying again. You may not have enough memory anyway, though. Dunno.
Specs?
Train
03-11-2011, 07:37 AM
Try out RRL! :)
Brandon
03-11-2011, 07:46 AM
Reflection has memory leaks. I'd suggest restarting and trying again. You may not have enough memory anyway, though. Dunno.
Specs?
3GB Ram DDR3, 64bit, Dual Core 500gb HDD.. :S
So nothing is wrong with my functions right??
i luffs yeww
03-11-2011, 07:53 AM
Try restarting and see if it gives the out of memory error. And are you using a vm?
And from a quick glance I don't see anything really "wrong." I'm pretty tired and haven't done any srl/reflection stuff in awhile though, so don't trust me. :p
What do you mean by it doesn't work? Does it not click? Does it just end? Does it walk the wrong way?
And are you sure you picked the tiles correctly?
Brandon
03-11-2011, 07:59 AM
Try restarting and see if it gives the out of memory error. And are you using a vm?
And from a quick glance I don't see anything really "wrong." I'm pretty tired and haven't done any srl/reflection stuff in awhile though, so don't trust me. :p
What do you mean by it doesn't work? Does it not click? Does it just end? Does it walk the wrong way?
And are you sure you picked the tiles correctly?
Nope.. Just one operating system.. Windows 7.. And as for the walk function not working, It doesnt move the character at all... It stays there forever..
Harry
03-11-2011, 08:04 AM
Yes, Reflection's objects leak pretty bad. For now, if the object is in a static location, try using TileToMS?
Brandon
03-11-2011, 09:15 AM
Yes, Reflection's objects leak pretty bad. For now, if the object is in a static location, try using TileToMS?
KK ty alot.. And Harry, How would I then Detect if a door is open or closed if its leaking like that..
P.S. I learned a lot of coding from reading your scripts.
Harry
03-11-2011, 09:52 AM
Doors are tricky. You could solve it like color does (Reflection and color can be combined easily). Glad my scripts help :P
Is there anyway you can detect whether a door is open or closed? If so what is the best way to open/close it?
Floor66
03-13-2011, 10:10 AM
With reflection I believe the door just has a diff. ID? And with colour you might be able to check whether the option is "Open" (so the door is closed) or "Close" (so it's open).
Flight
03-13-2011, 11:06 AM
Doors can be done via color as well if you're using an exact door location every time in your script and if your camera is facing a certain angle, then you can search for the brown'ish colors and if they're in a certain position (where they'd be if it was closed) AND if the uptext is "Open" then the door is closed and we call to click it for opening, and if the brown colors are slightly to the left/right of the close position AND the uptext is "Close", then we're fine. Just have to use a little imagination.
Doors are pretty easy. Just use OpenDoor in Reflection folder ( Of course modification is needed, because mostly Doors are NOT Interactable Object. )
Just use Other kind of Object type ( WALL_OBJECT )
~Home
EDIT: Get the ids From PowerBöt.
Flight
03-13-2011, 11:26 AM
Here's a simple object finding script for Simba, I forget who wrote this but if I remember the name I'll post it here. Basically run this and stand next to the object you want to get the ID of and it'll give you the object's ID and the X/Y tile, it must be directly North/East/South/West of your position, for example not NE/SW.
program ObjectFinder;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
const
{---SMART Setup Constants---}
WORLD = 32;
MEMBERS = false;
SIGNED = true;
{---------------------------}
var
NPCs: TNPCArray;
i, ii, x, y: Integer;
FishTP : TPoint;
Me: TMe;
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] Do
Begin
Name := '';
Pass := '';
Nick := '';
Active := True;
Integers[0] := 0;
Pin := '';
End;
End;
// Get objects near you
//function GetInteractObjIDAdjacent (Tile : TTile) : Integer;
procedure FindObjNear;
var myObj : TRSObject;
myTile, newTile : TTile;
i : Integer;
begin
if not LoggedIn then exit;
myTile := GetMyPos;
writeln ('[--Objects--]');
newTile := Tile((myTile.x-1),myTile.y);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(W)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.T ile.y)+')');
end;
newTile := Tile((myTile.x),myTile.y-1);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(S)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.T ile.y)+')');
end;
newTile := Tile((myTile.x+1),myTile.y);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(E)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.T ile.y)+')');
end;
newTile := Tile((myTile.x),myTile.y+1);
MyObj := GetObjectAt(newTile, OBJECT_TYPE_INTERACTABLE);
if MyObj.ID > 0 then
begin
writeln ('(N)');
writeln ('ID: '+inttostr(MyObj.ID)+', Tile('+inttostr(MyObj.Tile.x)+','+inttostr(MyObj.T ile.y)+')');
end;
end;
procedure MainLoop;
begin
if not LoggedIn then exit;
SetAngle (true);
MakeCompass ('n');
SetRun (true);
wait (random(500));
repeat
FindObjNear;
wait (1000);
cleardebug;
until (false)
end;
begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;
SetupSRL;
DeclarePlayers;
LoginPlayer;
cleardebug;
MainLoop;
end.
Echo_
03-13-2011, 12:54 PM
I think it was either Cstrike or Naike who wrote that program. Anyways, I still think this is a problem with the "secondlevelobject_GetID" hook. Have you tried using the debugging version of Simba to see what was going on?
Flight
03-13-2011, 01:53 PM
I think you might be right Echo, "secondlevelobject_GetID" is in the 'D' file I guess you call it? And it just so happens my most common error involved with crashing Simba/Smart was "Field not found: d". I get swarmed with this and eventually "formWriteln: Error: Exception: Out of memory at line 83" which crashes Smart and so on...
Echo_
03-13-2011, 03:04 PM
I think you might be right Echo, "secondlevelobject_GetID" is in the 'D' file I guess you call it? And it just so happens my most common error involved with crashing Simba/Smart was "Field not found: d". I get swarmed with this and eventually "formWriteln: Error: Exception: Out of memory at line 83" which crashes Smart and so on...
Well its in the jh class, but the field name is int d. I have been fooling around with it a little, changing the name of the hook in hooks.simba, but the memory issue is still there. Isn't it convenient that when a double xp weekend comes around, all of a sudden we have issues reading object IDs from the client? Damn Jagex.
Wizzup?
03-13-2011, 05:49 PM
We (Harry, Ben, I) fixed a memory leak, I'll merge it to srl-reflection soon.
pyroryan
03-13-2011, 05:53 PM
We (Harry, Ben, I) fixed a memory leak, I'll merge it to srl-reflection soon.
Beat you to it :P
Wizzup?
03-13-2011, 07:11 PM
Beat you to it :P
Cool. :)
Yeah... Ive been wondering about FindRsObjectSimple... everytime I try using it ... it doesnt find the object but when I use getobjectbyid its successful.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.