Chapter 4: Main loop: Second Game Data LoopsProgressing with the game data loop.
The next element is the game type. There are various options for a game. S(Standard), C(Terminator), A(Assassin), D(Doubles), T(Triples), Q(Quadruples), P(Polymorphic)
[spoiler=game type]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("game_type").Text
'game_type - S(Standard), C(Terminator), A(Assassin), D(Doubles), T(Triples), Q(Quadruples), P(Polymorphic)
Select Case strTemp
Case "S"
strTemp = "Standard"
Case "C"
strTemp = "Terminator"
Case "A"
strTemp = "Assassin"
Case "D"
strTemp = "Doubles"
Case "T"
strTemp = "Triples"
Case "Q"
strTemp = "Quadruples"
Case "P"
strTemp = "Polymorphic"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 9).Value = strTemp
[/spoiler]
The element initial troops holds the information about the manual or automatisch troop deployment.
[spoiler=initial troops]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("initial_troops").Text
'initial_troops - E(Automatic), M(Manual)
Select Case strTemp
Case "E"
strTemp = "Automatic"
Case "M"
strTemp = "Manual"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 10).Value = strTemp
[/spoiler]
The play order is the next element. S(Sequential), F(Freestyle)
[spoiler=play order]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("play_order").Text
'play_order - S(Sequential), F(Freestyle)
Select Case strTemp
Case "S"
strTemp = "Sequential"
Case "F"
strTemp = "Freestyle"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 11).Value = strTemp
[/spoiler]
The next element is the options to play the bonus cards; 2 (Escalating) , 3 (Flat Rate) , 1 (No Spoils), 4(Nuclear), 5(Zombie)
[spoiler=Bonus Cards]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("bonus_cards").Text
'bonus_cards - 2 (Escalating) , 3 (Flat Rate) , 1 (No Spoils), 4(Nuclear), 5(Zombie)
Select Case strTemp
Case "1"
strTemp = "No Spoils"
Case "2"
strTemp = "Escalating"
Case "3"
strTemp = "Flat Rate"
Case "4"
strTemp = "Nuclear"
Case "5"
strTemp = "Zombie"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 12).Value = strTemp
[/spoiler]
There are several options for the element Fortifications. C(Chained), O(Adjaecent), M(Unlimited), P(Parachute), N(None)
[spoiler=Fortifications]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("fortifications").Text
'fortifications - C(Chained), O(Adjaecent), M(Unlimited), P(Parachute), N(None)
Select Case strTemp
Case "C"
strTemp = "Chained"
Case "O"
strTemp = "Adjacent"
Case "M"
strTemp = "Unlimited"
Case "P"
strTemp = "Parachute"
Case "N"
strTemp = "None"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 13).Value = strTemp
[/spoiler]
The next element is Fog of War. There's only fog or no fog, so that's fairly simple.
[spoiler=Fog of War]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("war_fog").Text
'war_fog - N(No Fog) or Y(Fog)
Select Case strTemp
Case "N"
strTemp = "No Fog"
Case "Y"
strTemp = "Fog"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 14).Value = strTemp
[/spoiler]
The next element is Trench. Als simple, just the options yes or no

[spoiler=Trench Warfare]
Code: Select all
strTemp = .SelectSingleNode("trench_warfare").Text
'trench_warfare - (Y)es, (N)o
Select Case strTemp
Case "Y"
strTemp = "Trench"
Case "N"
strTemp = "No Trench"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 15).Value = strTemp
[/spoiler]
After that comes the element round limit. The options are a bit more varied; round_limit - 0, 20, 30, 50, 100 rounds. 0 rounds is the same ad umlimited.
[spoiler=Round limit]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("round_limit").Text
'round_limit - 0, 20, 30, 50, 100
Select Case strTemp
Case "0"
strTemp = "No limit"
Case "20"
strTemp = "20 rounds"
Case "30"
strTemp = "30 rounds"
Case "50"
strTemp = "50 rounds"
Case "100"
strTemp = "100 rounds"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 16).Value = strTemp
[/spoiler]
Then there are two simple nodes. The element round, which indicates which round the game is in or is finished and the element Poly slots. This returns the number of ploy slots you have played.
[spoiler=Round and Poly Slots]
Code: Select all
'-------------------- -------------------- --------------------
Cells(h, 17).Value = .SelectSingleNode("round").Text
'-------------------- -------------------- --------------------
Cells(h, 18).Value = .SelectSingleNode("poly_slots").Text
'-------------------- -------------------- --------------------
[/spoiler]
Then there is time remaining as an element. For finished games it's obious that there is no more time. Later on (in the future) we might need it to convert. After this element, we skip one column to enter the date of the game.
[spoiler=Final Macro]
Code: Select all
'-------------------- -------------------- --------------------
strDate = .SelectSingleNode("time_remaining").Text
If strDate = 0 And Cells(h, 4).Value = "Finished" Then
Cells(h, 18).Value = Finished
Else
'calculate later
End If
'-------------------- -------------------- --------------------
'skip one for date
[/spoiler]
So the macro now looks like
[spoiler=Final Macro]
Code: Select all
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("game_type").Text
'game_type - S(Standard), C(Terminator), A(Assassin), D(Doubles), T(Triples), Q(Quadruples), P(Polymorphic)
Select Case strTemp
Case "S"
strTemp = "Standard"
Case "C"
strTemp = "Terminator"
Case "A"
strTemp = "Assassin"
Case "D"
strTemp = "Doubles"
Case "T"
strTemp = "Triples"
Case "Q"
strTemp = "Quadruples"
Case "P"
strTemp = "Polymorphic"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 9).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("initial_troops").Text
'initial_troops - E(Automatic), M(Manual)
Select Case strTemp
Case "E"
strTemp = "Automatic"
Case "M"
strTemp = "Manual"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 10).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("play_order").Text
'play_order - S(Sequential), F(Freestyle)
Select Case strTemp
Case "S"
strTemp = "Sequential"
Case "F"
strTemp = "Freestyle"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 11).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("bonus_cards").Text
'bonus_cards - 2 (Escalating) , 3 (Flat Rate) , 1 (No Spoils), 4(Nuclear), 5(Zombie)
Select Case strTemp
Case "1"
strTemp = "No Spoils"
Case "2"
strTemp = "Escalating"
Case "3"
strTemp = "Flat Rate"
Case "4"
strTemp = "Nuclear"
Case "5"
strTemp = "Zombie"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 12).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("fortifications").Text
'fortifications - C(Chained), O(Adjaecent), M(Unlimited), P(Parachute), N(None)
Select Case strTemp
Case "C"
strTemp = "Chained"
Case "O"
strTemp = "Adjacent"
Case "M"
strTemp = "Unlimited"
Case "P"
strTemp = "Parachute"
Case "N"
strTemp = "None"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 13).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("war_fog").Text
'war_fog - N(No Fog) or Y(Fog)
Select Case strTemp
Case "N"
strTemp = "No Fog"
Case "Y"
strTemp = "Fog"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 14).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("trench_warfare").Text
'trench_warfare - (Y)es, (N)o
Select Case strTemp
Case "Y"
strTemp = "Trench"
Case "N"
strTemp = "No Trench"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 15).Value = strTemp
'-------------------- -------------------- --------------------
strTemp = .SelectSingleNode("round_limit").Text
'round_limit - 0, 20, 30, 50, 100
Select Case strTemp
Case "0"
strTemp = "No limit"
Case "20"
strTemp = "20 rounds"
Case "30"
strTemp = "30 rounds"
Case "50"
strTemp = "50 rounds"
Case "100"
strTemp = "100 rounds"
Case Else
strTemp = "Unknown"
End Select
Cells(h, 16).Value = strTemp
'-------------------- -------------------- --------------------
Cells(h, 17).Value = .SelectSingleNode("round").Text
'-------------------- -------------------- --------------------
Cells(h, 18).Value = .SelectSingleNode("poly_slots").Text
'-------------------- -------------------- --------------------
strDate = .SelectSingleNode("time_remaining").Text
If strDate = 0 And Cells(h, 4).Value = "Finished" Then
Cells(h, 18).Value = Finished
Else
'calculate later
End If
'-------------------- -------------------- --------------------
'skip one for date
[/spoiler]
Happy coding!!
