I am trying to add two safety valve emitters to a loco, but can't seem to get them to switch on.
They have been added as children(Safe1 & Safe2) to the engine.bin file and are initialised as follows :-
- Code: Select all
Call( "Safe1:SetEmitterActive", 0 );
Call( "Safe2:SetEmitterActive", 0 );
They are called during the update function as follows:-
- Code: Select all
-- Safety valves
local Pressure = Call( "*:GetControlValue", "BoilerPressureGaugePSI", 0 );
if Pressure >= 156.0 then
Call( "Safe1:SetEmitterActive", 1 );
else
Call( "Safe1:SetEmitterActive", 0 );
end
if Pressure >= 160.0 then
Call( "Safe2:SetEmitterActive", 1 );
else
Call( "Safe2:SetEmitterActive", 0 );
end
I thought I was missing and "end", but lua didn't like that, so my logic must be flawed somewhere.
Any ideas?