Jump to content
Er was een korte storing in het gebruik van Ideal. Dit probleem is opgelost! We faced an issue with our Ideal payments. This issue has been solved now. ×
  • 0

AutoDrop op V-IRM 4


stansim

Question

Dag mede-forumleden,

 

Ik zit hier een scenario te maken, waar de AutoDrop op een bepaald punt inslaat. Hierbij heb ik het volgende script, het event triggered wel, aangezien de trein een snelremming inschakelt.

function OnEvent(event)
	return _G["OnEvent" .. event]();
 end
 
function TestCondition(condition)
	return _G["TestCondition" .. event]();
 end

function OnEvent(event)
   _G["OnEvent" .. event]();
end

function OnEventAutoDrop()
  SysCall ("873687342349:SetControlValue", "PantographControl", 0, 0 )
  SysCall ("871781176175:SetControlValue", "PantographControl", 0, 0 )
  SysCall ("942783810812:SetControlValue", "PantographControl", 0, 0 )
  SysCall ("865586101101:SetControlValue", "PantographControl", 0, 0 )
end

Maar, de pantograaf gaat niet naar beneden. Weten jullie misschien de oplossing??

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

De aansturing methode van een pantograph is afhankelijk van de type trein/Locomotief.

De Traxx is een heel ander verhaal. Daar moet je veel handelingen voor verrichten. (Stuur dan een PM naar mij)

 

Voor de meeste CT treinen gebruik ik deze opdrachten.

Volgens mij hetzelfde al wat jij doet , alleen ik gebruik 'PlayerEngine' 

 

--

 --============================= Variabelen instellen =============================
-- true/false defnititie
FALSE = 0
TRUE  = 1
--
-- condition return values
CONDITION_NOT_YET_MET = 0
CONDITION_SUCCEEDED   = 1
CONDITION_FAILED      = 2

--

--

--====================================================
-- Test of aangeroepen functie/opdracht bestaat. Geeft melding als dat niet zo is 
--====================================================    
function SetControl ( engine, name, value )
    if SysCall ( engine .. ":ControlExists", name, 0 ) then
        SysCall ( engine .. ":SetControlValue", name, 0, value );
        Debugprint (engine .. ":SetControlValue");
        SysCall("ScenarioManager:ShowAlertMessageExt", "Set control ".. name , 10, "");
        return true
    else
    SysCall ("ScenarioManager:ShowAlertMessageExt", "Control bestaat niet ".. name , 10, "");
        return false
    end
    return CONDITION_NOT_YET_MET;
end --function SetControl ( engine, name, value )

-- =========================================================

--

function OnEvent ( event )

--

--

--=====================[ (5) Pantograph treinen CT]=====================
--
--=====================[ PantographDirectionSwitch ]=====================
-- Panto_x
-- x = 1   (voor)
-- x = -1  (achter)
if (string.sub(event, 1, 8 ) == "PantoSw_") then 
      aktie = (string.sub(event, 9, 10))
    SetControl("PlayerEngine", "PantographDirectionSwitch", aktie);
return TRUE;
end    
--
--=====================[ Pantograp up of down ]=====================
-- Panto_x
-- x = 1   (up)
-- x = 0   (down)

if (string.sub(event, 1, 11) == "PantoUpDwn_") then 
      aktie = (string.sub(event, 12, 12))
    SetControl("PlayerEngine", "PantographControl", aktie);
return TRUE;
end
--================================================================

--

--

return FALSE
end --function OnEvent ( event )

Edited by Sjef61
Link to comment
Share on other sites

  • 0
17 minuten geleden, Sjef61 zei:

--
--=====================[ Pantograp up of down ]=====================
-- Panto_x
-- x = 1   (up)
-- x = 0   (down)

if (string.sub(event, 1, 11) == "PantoUpDwn_") then 
      aktie = (string.sub(event, 12, 12))
    SetControl("PlayerEngine", "PantographControl", aktie);
return TRUE;
end
--================================================================

--

--

return FALSE
end --function OnEvent ( event )

 

Hey sjef! Bedankt voor je reactie alvast, helpt ongelofelijk veel!

Er staat hier wel een variable genaamd "actie" moet ik die ergens invullen of iets dergelijks? Ik ben slechts een beginner met Train Simulator Lua.

 

Nogmaals, bedankt!

Link to comment
Share on other sites

  • 0

if (string.sub(event, 1, 11) == "PantoUpDwn_") then     (Leest de opdracht uit, is dit 'PantoUpDwn_ ' dan voer functie uit

 aktie = (string.sub(event, 12, 12))                                   ( Leest uit of de panto op of neer moet en stop dat getal in de variabele aktie )

 

 

 

In je scenario geef je de opdracht :

 

PantoUpDwn_1

of

PantoUpDwn_0

 

1 = omhoog

0 = naar beneden

 

1980472162_Snap2020-04-10at19_32_27.jpg.7fcaae279a81529fd44d6980d056c6b6.jpg

Edited by Sjef61
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Home
Activities
Sign In

Sign In



×
    Search In
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Privacy Policy