Can it be done?
That is, can a function result in a TPoint, or is this not doable?
Thanks,
A83![]()
Can it be done?
That is, can a function result in a TPoint, or is this not doable?
Thanks,
A83![]()
Yes.
EX.
SCAR Code:Function FindAColor(Color: Integer): TPoint;
var
dx, dy : Integer;
begin
if FindColor(dx, dy, Color, MSX1, MSY1, MSX2, MSY2) then
begin
Result.x := dx;
Result.y := dy;
end;
end;
SCAR Code:Function IntToTP(X, Y: Integer): TPoint;
Begin
Result.X := X;
Result.Y := Y;
End;
Simple one![]()
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
Thanks for the quick answers.
(Both of ya)
SCAR Code:Point(X, Y: LongInt): TPoint;
IntToPoint(X, Y: LongInt): TPoint;
Those are built in to SCAR, the source probably looks something like this:
SCAR Code:function Point(X, Y: LongInt): TPoint;
begin
Result.X := X;
Result.Y := Y;
end;
SCAR Code:function IntToPoint(X, Y: LongInt): TPoint;
begin
Result := Point(X, Y);
end;
Oh dear... why does
THIS
SCAR Code:function TreeLoc(var Color1, Color2, Color3 : integer): TPoint;
var i : integer;
begin
for i := 1 to 5 do
begin
if FindColorSpiral(x,y,Color1,MSX1,MSY1,MSX2,MSY2) or
Findcolorspiral(x,y,Color2,MSX1,MSY1,MSX2,MSY2) or
Findcolorspiral(x,y,Color3,MSX1,MSY1,MSX2,MSY2) then
begin
MMouse(x,y,5,5);
if IsUpText('Willow') then
begin
Writeln('Found tree.');
Result.x := x;
Result.y := y;
Break;
end else
begin
Result.x := 0;
Result.y := 0;
Writeln('Did not find tree.');
end;
end else
begin
i := i + 1;
end;
end;
end;
function CheckTreeLoc : boolean;
var
TP : TPoint;
begin
TP := TreeLoc(TreeColor1, TreeColor2, TreeColor3);
if (TP.x = 0) and (TP.y = 0) then Result := False;
else
Result := True;
end;
Return Variable Expected?
"if (TP.x = 0) and (TP.y = 0) then Result := False;"
Delete ;.
I got Identifier expected on this procedureSCAR Code:function CheckTreeLoc : boolean;
var
TP: TPoint;
TreeColor1, TreeColor2, TreeColor3 : integer;
begin
TP := TreeLoc(TreeColor1, TreeColor2, TreeColor3);
if (TP.x = 0) and (TP.y = 0) then Result := False; //<- delete that
else
Result := True;
end;
but just cuz u had an extra semicolon =]
=) Thanks a lot, it was really bugging me!
Glad Derek and I could help![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)