Le Jingle
2012-12-01 12:46:24
I made a snippet that collects fruit off the ground, however I'm having trouble thinking of ways to way back to the original tile.
Ex.
player tile = "x", other tiles = "-"
1. player standing still
All help appreciated :)
Cheers,
Lj
Oh almost forgot the snippet:
Ex.
player tile = "x", other tiles = "-"
1. player standing still
---
-x-
---
2. player walks to tile
x--
---
---
3. [How?] player walk back to standing still tile in #1 / original tile??
---
-x-
---
All help appreciated :)
Cheers,
Lj
Oh almost forgot the snippet:
program new;
{$DEFINE SMART}
{$i srl/srl.simba}
{$IFDEF SMART}
{$i srl/srl/misc/smartgraphics.simba}
{$ENDIF}
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;
with Players[0] do
begin
Name := '';
Pass := '';
Active := True;
end;
end;
function searchBoxs(): boolean; // testing still, on ground color : 4606025
var
hTxt, hTol, i, j, k, l, m, n: integer;
aBox, PlayerBox: TBox;
Col, tol: TIntegerArray;
SurroundingTiles: Array[0..7] of TBox;
Texts: TStringArray;
TPA: TPointArray;
options: Array of TOptions;
begin
result := false;
PlayerBox := IntToBox(243, 218-50, 272, 241-50);
cleardebug;
writeln('---------------- search Box -----------');
{$IFDEF SMART}
SMART_DrawBox(PlayerBox);
{$ENDIF}
Surroundingtiles[0] := IntToBox(220, 142, 240, 161); // top left
Surroundingtiles[1] := IntToBox(250, 142, 270, 162); // top mid
Surroundingtiles[2] := IntToBox(280, 142, 300, 163); // top right
Surroundingtiles[3] := IntToBox(217, 219-50, 239, 240-50); // mid left
Surroundingtiles[4] := IntToBox(280, 218-50, 303, 242-50); // mid right
Surroundingtiles[5] := IntToBox(215, 246-50, 238, 269-50); // bottom left
Surroundingtiles[6] := IntToBox(248, 245-50, 270, 270-50); // bottom mid
Surroundingtiles[7] := IntToBox(280, 247-50, 303, 270-50); // bottom right
{$IFDEF SMART}
SMART_DrawBoxes(true, false, Surroundingtiles, -1);
{$ENDIF}
Texts := ['Banana', 'Lemon', 'Lime', 'Orange', 'Papaya fruit', 'Pineapple'];
Col := [ 5553855, 4248007, 4494914, 4363989, 3716772, 1802173];
tol := [ 14, 27, 24, 23, 22, 72];
hTol := high(tol);
hTxt := high(Texts);
for i := 0 to 7 do // Boxes Surrounding Player Box...
for j := 0 to hTxt do // Number of items to search for...
for k := 0 to hTol do // Tolerance on color to use...
begin
aBox := SurroundingTiles[i];
writeln(abox);
if FindColorsTolerance(TPA, Col[j], aBox.x1, aBox.y1, aBox.x2, aBox.y2, tol[j]) then
begin
Mouse(MiddleTPA(TPA).x, MiddleTPA(TPA).y, 3, 3, mouse_right);
options := GetChooseOptions('all');
for l := 0 to high(options) do
for m := 0 to hTxt do
if (Pos(texts[m], options[l].str) > 0) then
begin
n := m;
break;
end;
if WaitOption(Texts[n], 2500) then
begin
writeln('Result = FOUND!');
result := true;
exit;
end;
end else
continue;
end;
end;
// ReturnGridColorsInBox(Box: TBox): T2DIntegerArray;
begin
{$IFDEF SMART}
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
SetupSRL;
DeclarePlayers;
LoginPlayer;
SetAngle(SRL_ANGLE_HIGH);
MakeCompass('n');
searchBoxs();
end.