SRL Archive - RS3 Help

Function problem


Amichie

2014-09-07 10:46:27

Main loop:

result := findPapaya();
writeLn(result);

findPapaya:

function findPapaya(): boolean;
var
x, y: integer;
begin
if mainscreen.findObject(x, y, 2341762, 15, ['Take Papaya fruit'], MOUSE_MOVE) then
begin
Result := true;
writeLn('We found a papaya!');
writeLn(Result);
end else
writeLn('Failed to find another papaya.');
Result := false;
end;

The problem is: inside the findPapaya function Result is TRUE, but in the main loop the writeLn writes FALSE in the debug box.

riwu

2014-09-07 10:50:51

add a begin and end for your last 2 statements:

end else
begin
writeLn('Failed to find another papaya.');
Result := false;
end;

Amichie

2014-09-07 10:55:44

Worked, thanks! :=)