Keeping data between rounds

FYI, Here is my usage example of Global Variables

# Track round number for this session
var RoundNumberMap : weak_map(session, int) = map{}

OnBegin<override>()<suspends>:void=
        # Set round number for each session
        Session := GetSession()
        if(RoundNumber := RoundNumberMap[Session]):            
            if(set RoundNumberMap[Session] += 1):
                Print("Current Round Number: {RoundNumber+1}", ?Duration := 5.0)              
        else:
            if(set RoundNumberMap[Session] = 1):
                Print("Initialize Round Number to 1", ?Duration := 5.0)

However, you cannot save the player variable in the global variable. You will encounter Verse runtime error if you try to retrieve the player variable in the next round. That means there is no way to know which data belongs to which player. Hope this helps.

3 Likes