So ive qucikly made a function of looking though the reflection inclued for my scirpt im making which is a mining guild.
So its meant to have the tile of a rock, and check if poeple are near it by checking the 4 tiles around it, N E S W cuz cant mine from top right and stuff. Then check it they are mining, then check if they are mining on that rock.
Any help to compile if it would work and the such would be great thanks.
Simba Code:
Function CheckRock(TileX:TTile):Boolean;
Var PlayerArray,PlayersNearRock:TPlayerArray;
I:Integer;
PointT :TPoint;
a,b,c,d:TTile;
Begin
If Not LoggedIn Then Exit;
writeln('Starting - CheckRock');
PointT := TileToPoint(TileX)
a := Tile((PointT.x+1),PointT.y)
b := Tile((PointT.x),(PointT.y+1))
c := Tile((PointT.x-1),PointT.y)
d := Tile(PointT.x,(PointT.y-1))
PlayerArray := GetAllPlayers
For I:=0 To High(PlayerArray) Do
Begin
If (PlayerArray[I].Tile = A) Or (PlayerArray[I].Tile = B) Or (PlayerArray[I].Tile = C) Or (PlayerArray[I].Tile = D) Then
Begin
PlayersNearRock := PlayersNearRock + PlayerArray[I]
writeln('CheckRock - Added player to an array');
End;
End;
//Not sure what it is :(
If High(PlayersNearRock) = 0 or -1 Then
Begin
Result := True
writeln('No players found near rock');
Exit;
End;
For I:= 0 To High(PlayersNearRock) Do
Begin
If (GetAnimation = -1) Then
PlayersNearRock := PlayersNearRock - PlayersNearRock[I]
End;
If High(PlayersNearRock < 0 ) Then
Begin
writeln('CheckRock - No players left in array');
Result := True
Exit;
End;
For I:= High(PlayersNearRock) DownTo 0 Do
Begin
If PlayersNearRock[I].Tile = a Then
If PlayersNearRock[I].Orientation = 90 Then
Begin
writeln('Player facing rock and animating dang :(');
Result := False
Exit;
End;
If PlayersNearRock[I].Tile = b Then
If PlayersNearRock[I].Orientation = 0 Then
Begin
writeln('Player facing rock and animating dang :(');
Result := False
Exit;
End;
If PlayersNearRock[I].Tile = c Then
If PlayersNearRock[I].Orientation = 270 Then
Begin
writeln('Player facing rock and animating dang :(');
Result := False
Exit;
End;
If PlayersNearRock[I].Tile = d Then
If PlayersNearRock[I].Orientation = 180 Then
Begin
writeln('Player facing rock and animating dang :(');
Result := False
Exit;
End;
End;
End;
Thanks