From: putonajonny
procedure GoToGold;
begin
SetRun(True);
MakeCompass('n');
Case Random(3) of//Random() generates a random number between 0 and 1 less than the number you put in brackets, so Random(3) generates a number between 0 and 2.
0 : ToGold := [];//Path 1 The case function checks these against these numbers and sets the path appropriately...
1 : ToGold := [];//Path 2
2 : ToGold := [];//Path 3
end;
SPS_WalkPath(ToGold);
end;
Wouldn't this only work if
ToGold was a variable declared as an integer? It wouldn't be difficult at all to change it, of course, but in my script
ToGold is a path and declared as a TPointArray.
Thank you for explaining how this works. I can definitely apply this in a lot of places now. :]
From: CephaXz
procedure GoToGold;
begin
SetRun(True);
MakeCompass('n');
case Random(3) of //Randoming 3 cases: 0, 1, 2
0: if SPS_WalkPath(ToGold) then
writeln('Walking path 1');
1: if SPS_WalkPath(ToGold2) then
writeln('Walking path 2');
2: if SPS_WalkPath(ToGold3) then
writeln('Walking path 3');
end; //case needs an end
end;
Thank you so much! I like the idea of posting the path in the debug, too.