Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

[Fixed] "Iron Hand" scenario Lua error

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> [Fixed] "Iron Hand" scenario Lua error Page: [1]
Login
Message << Older Topic   Newer Topic >>
[Fixed] "Iron Hand" scenario Lua error - 3/2/2021 7:33:37 PM   
Zahar00


Posts: 17
Joined: 8/29/2016
Status: offline
Hey,

I'm just starting to play it, and it generally works, but I got this error:



Lua script execution error: [string "Game_HourlyActions"]:2: attempt to call a nil value (global 'WeatherReportIsDue')

When I finish it, I will let you know if there are any other bugs...

< Message edited by WSBot -- 5/4/2021 6:08:37 PM >
Post #: 1
RE: "Iron Hand" scenario Lua error - 3/9/2021 5:52:14 AM   
WSBot

 

Posts: 182
Joined: 1/17/2021
Status: offline
0014443

(in reply to Zahar00)
Post #: 2
RE: "Iron Hand" scenario Lua error - 4/29/2021 8:27:38 PM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline
I've tried to reproduce this a few times without any success. Do you have a save file showing the issue?

_____________________________


(in reply to WSBot)
Post #: 3
RE: "Iron Hand" scenario Lua error - 5/1/2021 6:37:07 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
Rory, is it possible you have a version of Iron Hand that hasn't actually shipped with the game or an update yet?

I can repo it with my local copy last modified 9/18/2020 (attached).
If you let it run for an hour, at 17:00Z you should get the issue and the reported errors in the exception log and the message log.

Function WeatherReportIsDue does not exist as function in the scene setup code (nor in the \lua\iron hand\ files for the scene, not that they're used), so the hourly event (Game_HourlyActions) that runs that calls it fails, that error then causes WeatherReportRUS to not run as well, and there is also a line to call CleanUpIdleCivilianShips() that never runs cause of it - but it too would fail as there is no such function. Additionally in LuaInit there is a pointless call to ScenEdit_RunScript('DeveloperMode.lua'), a file which does not exist, it doesn't matter other then the error getting logged.

The follow appears to be missing from LuaInit Action (based on other scenes):
function WeatherReportIsDue()
	local result = false
	local hourZulu = TimeIs().hour
	local hourLocal = hourZulu + scenarioZuluOffset
	if hourLocal %6 == 0 then
			result = true
	end
	return result
end
function CleanUpIdleCivilianShips()
	local unitList = VP_GetSide({side='Civilian'}).units
	local numberOfCivilianUnits = #unitList
	local numberOfUnitsDeleted = 0
	for k,v in ipairs (unitList) do
		local unit = ScenEdit_GetUnit({guid=v.guid})
		if (unit.course[1] == nil or unit.speed == 0) and 
			unit.type == 'Ship' then
			ScenEdit_DeleteUnit({guid=v.guid})
			numberOfUnitsDeleted = numberOfUnitsDeleted + 1
		end
	end

	if DebugModeIsOn() and numberOfUnitsDeleted > 0 then
		ScenEdit_SpecialMessage('playerside','Civ_Cleanup fired. <BR>Initial civilian Units: 
'..numberOfCivilianUnits..' <BR>;Civilian units cleaned up: '..numberOfUnitsDeleted)
	end
end


I've tried adding the above and removing the developermode.lua call, and scene then runs without issue and you get the weather reports as intended.


Attachment (1)

< Message edited by KnightHawk75 -- 5/1/2021 6:39:09 PM >

(in reply to Rory Noonan)
Post #: 4
RE: "Iron Hand" scenario Lua error - 5/4/2021 6:08:56 PM   
Rory Noonan

 

Posts: 2816
Joined: 12/18/2014
From: Brooklyn, NY
Status: offline
Very possible! Save files save the back and forth, but there's no use hassling you about it

I've updated this file with the missing functions but have left the developer mode call in (it's there for a reason); when running outside of the console at scenario start this doesn't cause any practical issues but it does leave a trace in the error log.

The improvements to the Lua API mean I can actually do away with that DeveloperMode.lua file and just pass global variables before I open up the .scen files to work on them. The next major update will have this applied across all standalone scenarios.

Thanks for following up on this for Zahar00

Attachment (1)

_____________________________


(in reply to KnightHawk75)
Post #: 5
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> [Fixed] "Iron Hand" scenario Lua error Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.766