<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > OnLineScores > OnlineScores_GetHiScores |
This functionality is no longer supported.
Description
Try to retrieve online game scores from the thinBasic Online Gaming system
Syntax
sResult = OnlineScores_GetHiScores(GameGUID [, OnlyCount [, OnlyXTopScores]])
Returns
String. String can contains both string or a numeric values. The following is the list of possible returned data:
Value |
Equate |
Meaning |
-10 |
%OLS_Error_SomethingIncorrectInParams |
Something was wrong with the passed parameters. |
-9 |
%OLS_Error_GameGuidNotFound |
The game corresponding to the passed GUID was not found in the database |
-1 |
%OLS_Error_DBUpdatingProblems |
Error during data insert |
0 |
%OLS_Error_NoRecordsFound |
Means no records found |
Anything else |
Usually this means no problems were encountered See remarks below to understand how to parse returned values. |
Parameters
Name |
Type |
Optional |
Meaning |
GameGUID |
String |
No |
A string that uniquely identify the game for which the score has to be stored. It has the form of a GUID string. |
OnlyCount |
Number |
Yes |
If different from 0 (Zero) function will only return the number of records found |
OnlyXTopScores |
Number |
Yes |
If > 0 (Zero) it will be used to return only the first X top scores from the list |
Remarks
Every thinBasic game that will use the scoring system must be uniquely identified by a GUID string.
If you want a new GUID string for your game, please ask to thinBasic support community web site to apply for a new GUID.
In case you would like only to test, there are pre-configured GUID used for testing.
If no errors, function will return a $TAB / $CRLF delimited matrix having the following columns sequence:
"UserName", "Score", "Date", "Comment", "Obfuscated", "Game level", "Game total time".
Of course some data can be missing due to their optional nature. "Comments", "Game level", "Game total time" can all be missing.
The following equates can be used to better identify needed columns:
•%OLS_ScoreCol_UserName
•%OLS_ScoreCol_Score
•%OLS_ScoreCol_Date
•%OLS_ScoreCol_Comment
•%OLS_ScoreCol_Obfuscated
•%OLS_ScoreCol_Level
•%OLS_ScoreCol_TimeSec
Use PARSE function to load values into a matrix. See below example.
Restrictions
Computer must be connected to Internet in order this function to work.
See also
Examples
USES "Console"
USES "OnlineScores"
'---GUID for testing game
Dim sGameCode As String = "{00000000-0000-0000-0000-000000000000}"
Dim sResult As String
Dim sBuffer As String
Dim vResults() As String
Dim nResults As Long
Dim Counter As Long
Dim nTop As Long
nResults = OnlineScores_GetHiScores(sGameCode, %True )
PRINTL "Number of scores present: " & nResults
nTop = 30
sBuffer = OnlineScores_GetHiScores(sGameCode, 0, nTop)
If sBuffer <> "" Then
nResults = PARSE (sBuffer, vResults, $crlf, $Tab )
PRINTL nResults
PRINTL "We will return only the first " & nTop & ". They are: "
For Counter = 1 To nResults
PRINTL vResults(Counter, %OLS_ScoreCol_UserName) , _
vResults(Counter, %OLS_ScoreCol_Score) , _
vResults(Counter, %OLS_ScoreCol_Date) , _
vResults(Counter, %OLS_ScoreCol_Comment) , _
vResults(Counter, %OLS_ScoreCol_Level) , _
vResults(Counter, %OLS_ScoreCol_TimeSec) , _
""
Next
Else
PRINTL "No data from the server!"
End If
PRINTL "--- All done. Press akey to finish ---"
WAITKEY