Im Editor!
Jetzt hab ichs
Und jetzt soll ich überall dort eine 0 setzten, wo gDynoCoupled steht, um die beiden Bremsen seperat anzusteuern?
Code
------------------------------------------------------------
-- Simulation file for the BR101
--
-- (c) Railsimulator.com 2011
--
-- Simulates coupled train brake/dynamic brake.
-- Copies absolute current to cab ammeter.
--
------------------------------------------------------------
-- Setup
------------------------------------------------------------
-- Called when the engine script is initialised
------------------------------------------------------------
function Setup ()
-- For remembering last position of brake handles.
gLastBrake = 0
gLastDyno = 0
-- For coupling dynamic brake.
gDynoCoupled = 1
end
------------------------------------------------------------
-- Update
------------------------------------------------------------
-- Called every frame to update the simulation
------------------------------------------------------------
-- Parameters:
-- inteval = time since last update
------------------------------------------------------------
function Update (inteval)
if Call( "*:GetControlValue", "Active", 0 ) == 1 then -- lead engine.
-- Get control values.
Amps = math.abs ( Call( "*:GetControlValue", "Ammeter", 0 ) )
BrakeHandle = Call( "*:GetControlValue", "VirtualBrake", 0 )
DynoHandle = Call( "*:GetControlValue", "DynamicBrake", 0 )
Emergency = Call( "*:GetControlValue", "EmergencyBrake", 0 )
-- Set cab ammeter.
Call( "*:SetControlValue", "CabAmmeter", 0, Amps )
-- Check if dynamic handle has been moved.
if DynoHandle ~= gLastDyno then
gDynoCoupled = 0
end
-- Set train brake. Couple dynamic brake as well.
if Emergency ~= 1 then
if BrakeHandle == 0 then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0 )
end
elseif (BrakeHandle >= 0.219) and (BrakeHandle <= 0.221) then
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0 )
end
elseif (BrakeHandle >= 0.349) and (BrakeHandle <= 0.351) then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.2 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0.3 )
end
elseif (BrakeHandle >= 0.479) and (BrakeHandle <= 0.481) then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.39 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0.5 )
end
elseif (BrakeHandle >= 0.609) and (BrakeHandle <= 0.611) then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.5 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0.6 )
end
elseif (BrakeHandle >= 0.739) and (BrakeHandle <= 0.741) then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.61 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0.7 )
end
elseif (BrakeHandle >= 0.869) and (BrakeHandle <= 0.871) then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.7 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 0.85 )
end
elseif BrakeHandle == 1 then
Call( "*:SetControlValue", "TrainBrakeControl", 0, 0.85 )
if gDynoCoupled == 1 then
Call( "*:SetControlValue", "DynamicBrake", 0, 1 )
end
end
end
-- Reset dynamic coupling if both handles are off.
if (BrakeHandle == 0) and (DynoHandle == 0) then
gDynoCoupled = 1
end
-- Save handle positions.
gLastBrake = BrakeHandle
gLastDyno = Call( "*:GetControlValue", "DynamicBrake", 0 )
else -- trail engine.
end
end
Alles anzeigen