OnlineScores_AddResult

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > OnLineScores >

OnlineScores_AddResult

 

This functionality is no longer supported.

 

Description

 

Try to store a new game score into the thinBasic Online Gaming system

 

Syntax

 

sResult = OnlineScores_AddResult(GameGUID, UserName, Score [, Comment [, sLevel [, nTimeSecs]]])

 

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

Anything else


Usually this means no problems were encountered.

 

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.

UserName

String

No

User name to assign score to

Score

String

No

Score value

Comment

String

Yes

Optional comment. Comments with more than 128 chars will be truncated.

sLevel

String

Yes

Up to 32 chars where to indicate game level info

nTimeSecs

Number

Yes

Number of seconds the game lasted

 

Remarks

 

Every thinBasic game that will use the scoring system must be uniquely identified by a GUID string.

If you need 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.

 

Restrictions

 

Computer must be connected to Internet in order this function to work.

 

See also

 

Examples

 

USES "Console"

USES "OnlineScores"

 

RANDOMIZE

 

'---GUID for testing game

Dim sGameCode   As String = "{00000000-0000-0000-0000-000000000000}"

Dim sUserName   As String

Dim sResult     As String

Dim sComment    As String

Dim sLevel      As String

Dim nDuration   As Long

 

Dim sBuffer     As String

Dim vResults()  As String

Dim nResults    As Long

Dim Counter     As Long

Dim nTop        As Long

Dim sReturn     As String

 

'---Syntax is  : GameCode, Gamer name, score (as string)

'---Return code: if 0 all ok

PRINTL "Adding a new score ... "

sUserName = "Testing " & TIMER

sResult   = RND(12345, 423456)

sComment  = "Auto generated comment at " & str$(TIMER)

sLevel    = "Level 1: level name"

nDuration = 25

 

PRINTL "Adding the folllowing result:"

PRINTL "  User name   :", sUserName

PRINTL "  Result value:", sResult

sReturn = OnlineScores_AddResult(sGameCode, sUserName, sResult, sComment, sLevel, nDuration)

PRINTL "Result of adding a score value (negative numbers indicate error):", sReturn

 

PRINTL "--- All done. Press akey to finish ---"

WAITKEY