SRL Archive - RS3 Help

Help me find my mistake please.


Sawyer

2015-06-03 21:43:54

Hey, it's Sawyer. I have just returned after a long hiatus. I am getting back into scripting, (lape is new 0.0) and I am having trouble with this function. It keeps returning an error. Where is my mistake? Thank you.
EDIT: I see a few mistakes :p Getting back into the swing of things. Thanks in advance for your help though.

Procedure AttackYellowDot;
var
x, y, i, z:integer;
dot, mmdot:TPointArray;
atpa: array of Tpointarray;
box:tbox;
begin
dot := minimap.getDots(MM_DOT_NPC, minimap.getBounds());
mmdot := minimap.pointsToMainscreen(dot);

if length(mmdot) < 2 then
writeln('No NPCs Found to attack.');

for i := 0 to high(mmdot) do
begin
SortTPAFrom(mmdot[i], mainscreen.getCenterPoint());
box := GetTPABounds(mmdot[i]);
MouseBox(box, MOUSE_RIGHT);
if ChooseOption.select(['Attack', 'ttack', 'ack'], Random(200)) then
begin
writeln('Found an NPC to kill.');
Exit;
end else
Writeln('Did not find an NPC to kill.')
end;
end;

yourule97

2015-06-03 21:53:02

What error is returned and on what line?

Sawyer

2015-06-03 21:54:57

Error: Expected variable of type "array of record [0]Int32; [4]Int32; end", got "record [0]Int32; [4]Int32; end" at line 19

It is the SortTPAFrom(mmdot, mainscreen.getCenterPoint()); line.

yourule97

2015-06-03 22:08:49

I'm not entirely sure, but I looking at the Simba documentation, it seems that SortTPAFrom should be passed an array + a point, not two points as I think you did in your script.

Citrus

2015-06-03 22:09:29

get rid of the . You're trying to sort a single point.

Ian

2015-06-03 22:10:59

From: Sawyer
Error: Expected variable of type "array of record [0]Int32; [4]Int32; end", got "record [0]Int32; [4]Int32; end" at line 19

It is the SortTPAFrom(mmdot, mainscreen.getCenterPoint()); line.


SortTPAFrom's first parameter is a TPointArray and you're giving it a TPoint

Edit: Double ninja'd ;)

Sawyer

2015-06-03 22:12:35

From: evilcitrus
get rid of the . You're trying to sort a single point.


From: BMWxi
SortTPAFrom's first parameter is a TPointArray and you're giving it a TPoint

Edit: Double ninja'd ;)


Thanks! I was very much confuzzled.
EDIT:

I am making another procedure using Bonsai's fighter include, and I am running into some trouble. Here is the code:

Procedure MotionAttack;
var
x, y, i:integer;
TPA:Tpointarray;
ATPA:array of Tpointarray;
begin
TPA := MotionTPA(mainscreen.getbounds(), 1, false, 75);
TPAtoATPAWrap(TPA, 40, ATPA);
SortATPASize(ATPA, True);
for i := 0 to High(ATPA) do
mouse(ATPA[i].getMiddle, MOUSE_MOVE, MOUSE_HUMAN);
if isMouseOverText(['Attack', 'ttack', 'orcher', 'avager', 'awler', 'inner','filer'], 500) then
begin
fastClick(MOUSE_RIGHT);
ChooseOption._select(['ttack']);
end;
end;

I am receiving a
Error: Don't know which overloaded method to call with params ((array of record [0]Int32; [4]Int32; end).function():record [0]Int32; [4]Int32; end of object, Int32, Int32) at line 48
Compiling failed.
at the line that reads
mouse(ATPA[i].getMiddle, MOUSE_MOVE, MOUSE_HUMAN);

Any help is greatly appreciated!