whoward69
DLL Minion
For a long time I've had the following code in one of my InGameUIAddin files
Which most of the time prints (when there are 8 majors in the game)
BUT every once in a while I get (when there are still 8 majors in the game)
So I changed the code a couple of weeks back to
Which most of the time prints
BUT again, every once in a while (eg, the last game I started) prints
So it looks like IsEverAlive() sometimes returns false if the capital hasn't been founded (or perhaps while another thread is still adding units - who knows!)
Anybody else seen this? Or is my machine just going
Code:
print("This is the 'My - Changes' mod script")
-- Add you own Lua code below here, and don't forget to check the log files for errors
for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local pPlayer = Players[iPlayer]
if (pPlayer:IsEverAlive()) then
print(string.format("Player: %i (%s) : %i (%s)", pPlayer:GetID(), pPlayer:GetName(), pPlayer:GetCivilizationType(), pPlayer:GetCivilizationDescription()))
end
end
print("-----")
Which most of the time prints (when there are 8 majors in the game)
Code:
[1223.515] MyLuaChanges: This is the 'My - Changes' mod script
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: Player: 1 (Augustus Caesar) : 14 (Roman Empire)
[1223.515] MyLuaChanges: Player: 2 (Shaka) : 44 (Zulu Kingdom)
[1223.515] MyLuaChanges: Player: 3 (Gandhi) : 9 (Indian Empire)
[1223.515] MyLuaChanges: Player: 4 (Pacal) : 33 (Mayan Empire)
[1223.515] MyLuaChanges: Player: 5 (Sejong) : 25 (Korean Empire)
[1223.515] MyLuaChanges: Player: 6 (Dido) : 29 (Carthaginian Empire)
[1223.515] MyLuaChanges: Player: 7 (Pedro II) : 37 (Brazilian Empire)
[1223.515] MyLuaChanges: -----
BUT every once in a while I get (when there are still 8 majors in the game)
Code:
[1223.515] MyLuaChanges: This is the 'My - Changes' mod script
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: -----
So I changed the code a couple of weeks back to
Code:
print("This is the 'My - Changes' mod script")
-- Add you own Lua code below here, and don't forget to check the log files for errors
for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local pPlayer = Players[iPlayer]
if (pPlayer:IsEverAlive()) then
print(string.format("Player: %i (%s) : %i (%s)", pPlayer:GetID(), pPlayer:GetName(), pPlayer:GetCivilizationType(), pPlayer:GetCivilizationDescription()))
end
end
print("-----")
for iSlot = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local iSlotStatus = PreGame.GetSlotStatus(iSlot)
if (iSlotStatus == SlotStatus.SS_TAKEN or iSlotStatus == SlotStatus.SS_COMPUTER) then
local pPlayer = Players[iSlot]
print(string.format("Player: %i (%s) : %i (%s)", pPlayer:GetID(), pPlayer:GetName(), pPlayer:GetCivilizationType(), pPlayer:GetCivilizationDescription()))
end
end
print("-----")
Which most of the time prints
Code:
[1223.515] MyLuaChanges: This is the 'My - Changes' mod script
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: Player: 1 (Augustus Caesar) : 14 (Roman Empire)
[1223.515] MyLuaChanges: Player: 2 (Shaka) : 44 (Zulu Kingdom)
[1223.515] MyLuaChanges: Player: 3 (Gandhi) : 9 (Indian Empire)
[1223.515] MyLuaChanges: Player: 4 (Pacal) : 33 (Mayan Empire)
[1223.515] MyLuaChanges: Player: 5 (Sejong) : 25 (Korean Empire)
[1223.515] MyLuaChanges: Player: 6 (Dido) : 29 (Carthaginian Empire)
[1223.515] MyLuaChanges: Player: 7 (Pedro II) : 37 (Brazilian Empire)
[1223.515] MyLuaChanges: -----
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: Player: 1 (Augustus Caesar) : 14 (Roman Empire)
[1223.515] MyLuaChanges: Player: 2 (Shaka) : 44 (Zulu Kingdom)
[1223.515] MyLuaChanges: Player: 3 (Gandhi) : 9 (Indian Empire)
[1223.515] MyLuaChanges: Player: 4 (Pacal) : 33 (Mayan Empire)
[1223.515] MyLuaChanges: Player: 5 (Sejong) : 25 (Korean Empire)
[1223.515] MyLuaChanges: Player: 6 (Dido) : 29 (Carthaginian Empire)
[1223.515] MyLuaChanges: Player: 7 (Pedro II) : 37 (Brazilian Empire)
[1223.515] MyLuaChanges: -----
BUT again, every once in a while (eg, the last game I started) prints
Code:
[1223.515] MyLuaChanges: This is the 'My - Changes' mod script
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: -----
[1223.515] MyLuaChanges: Player: 0 (Darius I) : 13 (Persian Empire)
[1223.515] MyLuaChanges: Player: 1 (Augustus Caesar) : 14 (Roman Empire)
[1223.515] MyLuaChanges: Player: 2 (Shaka) : 44 (Zulu Kingdom)
[1223.515] MyLuaChanges: Player: 3 (Gandhi) : 9 (Indian Empire)
[1223.515] MyLuaChanges: Player: 4 (Pacal) : 33 (Mayan Empire)
[1223.515] MyLuaChanges: Player: 5 (Sejong) : 25 (Korean Empire)
[1223.515] MyLuaChanges: Player: 6 (Dido) : 29 (Carthaginian Empire)
[1223.515] MyLuaChanges: Player: 7 (Pedro II) : 37 (Brazilian Empire)
[1223.515] MyLuaChanges: -----
So it looks like IsEverAlive() sometimes returns false if the capital hasn't been founded (or perhaps while another thread is still adding units - who knows!)
Anybody else seen this? Or is my machine just going
