Killzerslaul
Chieftain
despite my best efforts, I cannot find a way to stop getting this error which seems to be stopping a function in my mod loading properly.
I have checked my script repeatedly and I don't see any places where an 'end' could be missing.
this is the entire file & function that seems to be causing the issue:
does anyone know what the problem is? am I missing something important or doing something completely wrong? Is my syntax so awful that your eyes bleed? I'm pretty new to lua and would greatly appreciate help.
thanks.
(also, if that code looks familiar, it is because I heavily relied on parts of Gedemon's WW2 mod as a reference. hopefully that's not an issue with anyone, since I'm not actually distributing this mod right now, or claiming it to be entirely original. ^^)
Code:
Syntax Error: [string "C:\Users\Michael Kellett\Documents\My Games\Sid Meier's Civiliz..."]:61: 'end' expected (to close 'function' at line 9) near 'print'
this is the entire file & function that seems to be causing the issue:
Code:
-- SE_EquipmentFunctions
-- Author: Hashashiyyin
-- DateCreated: 22/7/2012 5:22:00 PM
--------------------------------------------------------------
print( "EquipmentFunctionsIncluded!" )
-- works out the income in equipment type "eEquipment" of player "pPlayer"
function GetEquipment( pPlayer, eEquipment )
local player = Players[pPlayer]
local fromBuilding, fromSpecialist, fromTrade, fromResource, fromFood = 0, 0, 0, 0
print("Getting Equipment Income...")
local strtext = ""
strtext = "Getting Equipment Income for Equipment id " .. eEquipment .. " for civ " .. player:GetName() .. "!";
print(strtext);
-- direct income from Specialists and Buildings
if g_EquipmentValues[eEquipment].buildings or g_EquipmentValues[eEquipment].specialists then
for city in player:Cities() do
local ratio = 100
if city:IsResistance() then ratio = 0; end
-- if there is a table for buildings check for buildings
if g_EquipmentValues[eEquipment].buildings then
for k, v in pairs( g_EquipmentValues[eEquipment].buildings ) do
if city:IsHasBuilding( v.id ) then fromBuilding = fromBuilding + math.ceil( v.bonus * ratio / 100 ); end
end
end
-- if there is a table for specialists check for specialists
if g_EquipmentValues[eEquipment].specialists then
for k, v in pairs( g_EquipmentValues[eEquipment].specialists ) do
fromSpecialist = fromSpecialist + math.ceil( city:GetSpecialistCount( v.id ) * v.bonus * ratio / 100 )
end
end
end
end
-- if there is a table for direct resource income, apply the direct resource income
if g_EquipmentValues[eEquipment].resources then
for k, v in pairs( g_EquipmentValues[eEquipment].resources ) do
fromResource = math.ceil( player:GetNumResourceAvailable( v.resource, true ) * v.multiplier )
end
end
-- Direct Income from Food
if g_EquipmentValues[eEquipment].food then
fromFood = math.ceil( player:CalculateTotalYield(YieldTypes.YIELD_FOOD) * g_EquipmentValues[eEquipment].food.multiplier )
end
-- Trade (to be added)
--debugging report to livetuner
local total = fromBuilding + fromSpecialist + fromTrade + fromResource + fromFood
strtext = "Equipment Income of " .. total .. " calculated! (B" .. fromBuilding .. ", S" .. fromSpecialist .. ", T" .. fromTrade .. ", R" .. fromResource .. ", F" .. fromFood .. " )";
print( strtext )
return total, fromBuilding, fromSpecialist, fromTrade, fromResource, fromFood
print( "Completed!" )
print("-------------------------------------")
end
thanks.

(also, if that code looks familiar, it is because I heavily relied on parts of Gedemon's WW2 mod as a reference. hopefully that's not an issue with anyone, since I'm not actually distributing this mod right now, or claiming it to be entirely original. ^^)