Ticket #2516: gamereport-guide.txt

File gamereport-guide.txt, 1.1 KB (added by Josh, 10 years ago)

A brief guide on using the gamereport variable.

Line 
1###
2# Example gamereport declaration (excludes most non-critical stats).
3###
4gamereport =
5{
6 'playerStates':
7 {
8 'joshua@lobbydev.wildfiregames.com/0ad': 'defeated',
9 'josh@lobbydev.wildfiregames.com/0ad': 'won'
10 },
11 'civs':
12 {
13 'joshua@lobbydev.wildfiregames.com/0ad': 'ptol',
14 'josh@lobbydev.wildfiregames.com/0ad': 'iber'
15 },
16 'timeElapsed': '6000',
17 'teams':
18 {
19 'joshua@lobbydev.wildfiregames.com/0ad': '-1',
20 'josh@lobbydev.wildfiregames.com/0ad': '-1'
21 },
22}
23
24###
25# Example gamereport access (tested on lobbydev bot).
26###
27
28# Get a list of player JIDs to use as indicies.
29players = list(gamereport['teams'].keys())
30
31# We don't know their actual player number, but we use some for convinience.
32player1 = players[0]
33player2 = players[1]
34
35player1Team = gamereport['teams'][player1]
36player2Team = gamereport['teams'][player2]
37
38# Print some data. (Might be helpful to note that teams shown in the 0 A.D. GUI are actually one larger. Eg: Team 1 in the GUI is actually team 0)
39logging.info("Player JID: " + str(player1) + ", Team: " + str(player1Team) + ", Player JID: " + str(player2) + ", Team: " + str(player2Team))