So then, I have some good news and some bad......
The good news is, when I go to place down my loco it very briefly flashes up the headcode 3210 (the primary number digits) before going blank. The reason it goes blank is because there are errors reported with the script from the Logmate. I shall post these below so somebody can help, hopefully, along with what I added to the script as well.
Errors:
Script Manager - Trace cScriptState.cpp : 386 = Lua Error: ...\RailVehicles\Diesel\Class55\MDP\Scripts\Class55HeadcodeEngineScript.lua:179: `end' expected (to close `function' at line 83) near `<eof>'
Content - Trace cScriptComponent.cpp : 201 = Error creating instance of script C:\Program Files (x86)\Steam\steamapps\common\RailWorks\Assets\Kuju\RailSimulator\RailVehicles\Diesel\Class55\MDP\Scripts\Class55HeadcodeEngineScript.lua
Now I am just guessing that the one of failure to create the instance of the script, is because it contains errors....
Anyway, now for what I have added to the script.
- Code: Select all
fullNumber = Call("GetRVNumber")
headcode = string.sub(fullNumber, 1, 4) -- from first character to just before the 4th
engineNumber = string.sub(fullNumber, 4, 9) -- from 4th to the 9th
nameplate = string.sub(fullNumber, 10) -- 10th digit only
At the very top
- Code: Select all
function Update ( time )
--Headcode and dynamic numbering/naming script.
Call("Headcode_A:SetText", headcode, 0)
Call("Headcode_B:SetText", headcode, 0)
Call("Nameplate_L:SetText", nameplate, 0)
Call("Nameplate_R:SetText", nameplate, 0)
Call("Bodyside_Engine_Number:SetText", engineNumber, 0)
-- Check for player train.
I have added the section between function Update (time) and --Check for player train.
Thanks in advance
*NOTE - at this point I want to ask a question that may be a case of function working over good convention. If I want both headcode objects to display the same headcode at both ends, would having them share the same child object name which is referenced in the script work, or would this break things? I ask because obviously this would be the same question for the nameplates and the bodyside numbers as some have up to 4 bodyside numbers.