I've not been wanting to use lua since I came back to Civ 2 modding, I feel dizzy every time I look at it. Cause to take the Napoleon scenario, a lua event looks like this:
-- Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
It's actually worse in the file. For me to get anywhere near this, I'd need AT LEAST the events to look like this:
+++++
Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
And preferably like this:
Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
****
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
****
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
+++++++++
This way everything's pinned to the left side like old script and doesn't force my eyes to dance around the screen which overwhelms me and makes me sick. with the **** and the ++++ functioning as paragraphs and chapter creaks respectively, it makes the information digestible.
Can I do something like this? The third way, if it can work is WAY less nausea-inducing then the first.
-- Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
It's actually worse in the file. For me to get anywhere near this, I'd need AT LEAST the events to look like this:
+++++
Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
And preferably like this:
Napoléon administrative bonus
if activeUnit.type.name == "Napoléon I" then
local ParisLocation = civ.getTile(58,60,0)
if activeUnit.location == ParisLocation then
local dialog = civ.ui.createDialog()
dialog.title = "Select Administrative Bonus"
dialog.width = 535
dialog:addText("Please select the Napoléon administrative bonus you prefer:")
dialog:addOption("Add to the Treasury and increase scientific research", 1)
local unitCost = 500
if France.money >= unitCost then
dialog:addOption("Build two Régiment de Ligne units at a cost of " .. unitCost .. " Francs", 2)
else
civ.ui.text("If the treasury contains at least " .. unitCost .. " Francs, Napoléon will have an additional administrative bonus option of building two Régiment de Ligne units.")
end
dialog:addOption("Exit (do not utilize the administrative bonus)", 0)
local result = dialog:show()
****
if result == 1 then
local goldAmount = 200
local scienceAmount = 100
if state.napoleonMarriageMarieLouise == true then
goldAmount = 150
scienceAmount = 50
end
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^" .. goldAmount .. " Francs, " .. scienceAmount .. " research beakers"))
changeMoney(France, goldAmount)
France.researchProgress = France.researchProgress + scienceAmount
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
****
elseif result == 2 then
local unitTypeName = "Régiment de Ligne"
civ.ui.text(func.splitlines("Napoléon administrative bonus:\n^\r^2 " .. unitTypeName .. " units are recruited at a cost of " .. unitCost .. " Francs"))
changeMoney(France, unitCost * -1)
createUnitsByName("Régiment de Ligne", France, {{58,60,0}}, {count = 2, homeCity = NONE, veteran = true})
local administrativeUnit = findUnitTypeByName("Napoléon I");
activeUnit.moveSpent = administrativeUnit.move
end
else
civ.ui.text("In order for Napoléon to provide an administrative bonus, he must be located in Paris!")
end
end
+++++++++
This way everything's pinned to the left side like old script and doesn't force my eyes to dance around the screen which overwhelms me and makes me sick. with the **** and the ++++ functioning as paragraphs and chapter creaks respectively, it makes the information digestible.
Can I do something like this? The third way, if it can work is WAY less nausea-inducing then the first.