SRL Archive - OSR Help

How to make a Boolean argument?


Syntax

2013-03-09 08:44:16

I have this:
if FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6) then 
result := True;

If complied gives: Unknown identifier 'result'
Thank you :)

riwu

2013-03-09 08:47:57

Is this called in a function?
You should have something like

function FunctionName: Boolean;

Sjoe

2013-03-09 08:48:22


function Thecolor: Boolean;
var
TreeTPA: TpointArray;
begin
if FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6) then
result := True;
end;

Edit :ninja:'d

litoris

2013-03-09 08:52:27

From: Sjoekeloe

function Thecolor: Boolean;
var
TreeTPA: TpointArray;
begin
if FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6) then
result := True;
end;

Edit :ninja:'d

A simpler way would be:


function Thecolor: Boolean;
var
TreeTPA: TpointArray;
begin
result := FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6);
end;

Syntax

2013-03-09 09:20:59

From: litoris
A simpler way would be:


function Thecolor: Boolean;
var
TreeTPA: TpointArray;
begin
result := FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6);
end;

But then that could be false or true?

Runehack123

2013-03-09 09:24:12

From: Blakebn2011
But then that could be false or true?


No that means it returns true if FindColors.. etc..
Boolean function is false by default at the start.

Brid Mayhem

2013-03-09 15:12:03

From: litoris
A simpler way would be:


function Thecolor: Boolean;
var
TreeTPA: TpointArray;
begin
result := FindColorsTolerance(TreeTPA, 2649183, MSX1, MSY1, MSX2, MSY2, 6);
end;



Use this, what it's saying is that the result will be true if it finds it, false if not.