Sub ShowPlayerList(side As String) As Int
Dim I As Int
Dim A As Int
Dim Index() As Int
Dim PlayerList As List
Dim Players() As String
PlayerList.Initialize
A = 0
For I = 0 To 14 Step 1
If side = "home" Then
If PlayerOnCourtHome(I) > 0 Then
Index(A) = I
Players(A) = PlayerNumberHome(I) & " - " & PlayerNameHome(I)
A = A + 1
End If
Else
If PlayerOnCourtGuest(I) > 0 Then
Index(A) = I
Players(A) = PlayerNumberGuest(I) & " - " & PlayerNameGuest(I)
A = A + 1
End If
End If
Next
If Players.Length = 0 Then Return 999 'No On-Court Players were found.
PlayerList.AddAll(Players)
InputListAsync(PlayerList, "Select a Player", -1, False)
Wait For InputList_Result (Ret As Int)
If Ret <> DialogResponse.CANCEL Then
If side = "home" Then
I = PlayerNumberHome(Index(Ret))
Return I
Else
I = PlayerNumberGuest(Index(Ret))
End If
Else
Return 888 'User didn't select a player, or canceled.
End If
End Sub