EEP Functions Reference Guide
EEP Functions Reference Guide
Camera functions...........................................................................................................................................30
EEPSetCamera, EEPSetPerspectiveCamera
Layout functions.............................................................................................................................................31
EEPLoadProject
page 1
Reference Guide to EEP functions
System variables
EEPVer EEPVer
type variable
EEPTime EEPTime
purpose EEPTime provides a variable that represents the current time within the EEP layout.
The value equals the seconds passed since midnight (EEP time).
page 2
Reference Guide to EEP functions
EEPTimeH EEPTimeH
type variable
used in script
print("The time now is: ",EEPTimeH,":",EEPTimeM)
source EEP
purpose Returns the hour component of EEPTime, expressed as a value between 0 and 23.
EEPTimeM EEPTimeM
type variable
used in script
print("The time now is: ",EEPTimeH,":",EEPTimeM)
source EEP
purpose Returns the minute component of EEPTime, expressed as a value between 0 and 59.
EEPTimeS EEPTimeS
type variable
if EEPTimeS == 15 then
used in script EEPSetSignal(1, 1) -- traffic light goes green
elseif EEPTimeS == 45 then
source EEP EEPSetSignal(1, 2) -- traffic light goes red
end
requires EEP 10.2 plug-in 2
purpose Returns the second component of EEPTime, expressed as a value between 0 and 59.
page 3
Reference Guide to EEP functions
System functions
clearlog() clearlog()
type function
caller script
defined in EEP
clearlog()
parameters none
returns none
type function
caller script
defined in EEP
print("The time now is: ",EEPTimeH,":",EEPTimeM)
parameters multiple
returns one
purpose Writes arguments to Lua event window (activate window in EEP properties)
EEPMain() EEPMain()
type function
caller EEP
returns one
purpose This function is called by EEP 5 times per second (i.e. every 200 milliseconds)
Useful for all actions that require constant repeats.
page 4
Reference Guide to EEP functions
Signal functions
type function
caller script
-- switch signal 0023 to 1 (aspect depends on signal)
defined in EEP EEPSetSignal(23, 1)
EEPGetSignal() EEPGetSignal(ID)
type function
currentAspect = EEPGetSignal(1)
caller script
if currentAspect == 0 then
print("Signal 1 doesn’t exist")
defined in EEP elseif currentAspect == 1 then
print("Signal 1 set to Danger")
parameters one elseif currentAspect == 2 then
print("Signal 1 set to Clear")
returns one end
page 5
Reference Guide to EEP functions
EEPRegisterSignal() EEPRegisterSignal(ID)
type function
caller script
EEPRegisterSignal(1)
defined in EEP
function EEPOnSignal_1(newAspect)
parameters one print("Signal 1 switched to ", newAspect)
end
returns one
notes The registration is mandatory for those signals which you want to trigger the
EEPOnSignal_x() function whenever the aspect changes.
Argument is the signal’s ID.
Return value is 1, if the signal exists or 0 if it doesn’t exist.
EEPOnSignal_x() EEPOnSignal_x(Aspect)
type function
caller EEP
EEPRegisterSignal(1)
defined in script
function EEPOnSignal_1(newAspect)
parameters one print("Signal 1 switched to ", newAspect)
end
returns none
purpose Every aspect change induced by a contact or by manual operation (directly or in a link
chain) triggers this callback function if the signal has been registerd for callbacks.
However: Changing this or a linked signal’s state by Lua function will not trigger the
callback, unless the third argument in that function was a 1.
notes The name of the function must not end in _x but with the signal’s ID. For signal 0012 the
correct name of the function would be EEPOnSignal_12().
Please note: The leading zeroes must be omitted in the function’s name!
The function is called with the new signal aspect as an argument. The number matches
the position in the signal’s aspect list as found in the signal’s properties. Use a variable of
your choosing to store this value.
EEP requires no return value when calling this function.
page 6
Reference Guide to EEP functions
type function
caller script
-- set switch point 0067 to 1 (main line)
defined in EEP EEPSetSwitch(67, 1)
parameters two or three -- set switch point 0089 to 1 and call EEPOnSwitch_89()
EEPSetSwitch(89, 1, 1)
returns one
notes First argument is a numeric value representing the switch point’s ID.
Second argument is the switch point’s aspect.
If a 1 is entered as a third (optional) argument, the EEPOnSwitch_x() function for this
switch is called when the direction of the switch has changed. Use with care! The switch
must be registerd and the corresponding function must be declared. (see next page).
Careless use of this function may result in infinite loops.
The function returns a 1 if the switch and the demanded direction exist. It returns a 0 if
either one of the two could not be found.
EEPGetSwitch() EEPGetSwitch(ID)
type function
currentDirection = EEPGetSwitch(1)
caller script if currentDirection == 0 then
page 7
Reference Guide to EEP functions
EEPRegisterSwitch() EEPRegisterSwitch(ID)
type function
caller script
EEPRegisterSwitch(1)
defined in EEP
function EEPOnSwitch_1(Direction)
parameters one print("switch point 1 changed to ", Direction)
end
returns one
notes The registration is mandatory for those switches which you want to trigger the
EEPOnSwitch_x() function whenever the direction changes.
Argument is the switch’s ID.
Return value is 1, if the switch exists or 0 if it doesn’t exist.
EEPOnSwitch_x() EEPOnSwitch_x(Direction)
type function
caller EEP
EEPRegisterSwitch(1)
defined in script
function EEPOnSwitch_1(Direction)
parameters one print("switch point 1 changed to ", Direction)
end
returns none
purpose Every aspect change induced by a contact or by manual operation (directly or in a link
chain) triggers this callback function if the switch has been registerd for callbacks.
However: Changing this or a linked switch’s state by Lua function will not trigger the
callback, unless the third argument in that function was a 1.
notes The name of the function must not end in _x but with the switch’s ID. For switch 0034 the
correct name of the function would be EEPOnSwitchl_34().
Please note: The leading zeroes must be omitted in the function’s name!
The function is called with the new switch direction as an argument. The number
matches the position in the switch’s direction list as found in the switch’s properties. Use
a variable of your choosing to store this value.
EEP requires no return value when calling this function.
page 8
Reference Guide to EEP functions
Storage functions
type function
EEPSaveData(1, 42) -- store value
caller script
EEPSaveData(2, "I am slot 2") -- store string
defined in EEP
EEPSaveData(3, true) -- store boolean
parameters two
EEPSaveData(4, nil) -- delete
returns one
notes Provides a means for the Lua code to store data in slots that are numbered 1 to 1000.
Each slot may contain a numeric, string or Boolean value. Strings must not contain
formatting characters (e.g. quotes).
First argument is the slot ID
Second argument is the data to be stored. Delete slot by assigning nil to it.
Return value is true when storing was successful (i.e. target slot found), else false.
Each slot is written to using the EEPSaveData() function and read from using the
EEPLoadData() function. The current value of each slot will also be saved with the user’s
Lua program when the layout is saved. This will maintain sync between layout condition
and data. The section of the script containing this data is not visible in EEP’s Lua editor.
EEPLoadData() EEPLoadData(Slot)
type function
notes Provides a means for the Lua code to read data from slots that are numbered 1 to 1000.
Each slot may contain a numeric, string or Boolean value. Strings must not contain
formatting characters (e.g. quotes).
Argument is the slot ID.
First return value is true, if the slot contains data, else false.
Second return value is the data contained in this slot.
Slot data is transferred from the script to memory when a layout is loaded.
page 9
Reference Guide to EEP functions
Train functions
type function
caller script
defined in EEP
EEPSetTrainSpeed("#Passenger train", 80)
parameters two
returns one
EEPGetTrainSpeed() EEPGetTrainSpeed("#Name")
type function
caller script
defined in EEP
hResult, hData = EEPGetTrainSpeed("#VT98;001")
parameters one
returns two
page 10
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPSetTrainRoute("#Passenger train", "Route")
parameters two
returns one
EEPGetTrainRoute() EEPGetTrainRoute("#Name")
type function
caller script
defined in EEP
hResult, hData = EEPGetTrainRoute("#Personenzug")
parameters one
returns two
page 11
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPSetTrainLight("#Passenger train", true)
parameters two
returns one
type function
caller script
defined in EEP
EEPSetTrainSmoke("#Passenger train", true)
parameters two
returns one
purpose Turns the smoke and steam of the specified train on or off.
type function
caller script
defined in EEP
EEPSetTrainHorn("#Passenger train", true)
parameters two
returns one
page 12
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPSetTrainCouplingFront("#Freight train", true)
parameters two
returns one
type function
caller script
defined in EEP
EEPSetTrainCouplingRear("#Freight train", true)
parameters two
returns one
EEPTrainLooseCoupling() EEPTrainLooseCoupling("#Name",true|false,Position)
type function
caller script
defined in EEP
EEPTrainLooseCoupling("#Freight train", true, 3)
parameters three
returns one
page 13
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPSetTrainHook("#Rail Crane", true)
parameters two
returns one
purpose Activates or deactivates the hook of the specified train for lifting goods.
type function
caller script
defined in EEP
EEPSetTrainAxis("#Rail Crane", "Drehung nach links”, 100)
parameters three
returns one
page 14
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPRollingstockSetCouplingFront("Castor 1;001", 1)
parameters two
returns one
purpose Activates or deactivates the front coupler of the specified rolling stock.
notes First argument is the entire name of the rolling stock as a string.
Second argument is the desired condition of the front coupler.
1 = activate coupler (couples on contact when opposing coupler is also active)
2 = deactivate coupler
Return value is true if the targeted rolling stock exists, else false.
EEPRollingstockGetCouplingFront() EEPRollingstockGetCouplingFront("Name")
type function
caller script
returns one
purpose Enquires the current condition of the front coupler of the specified rolling stock.
page 15
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPRollingstockSetCouplingRear("fals 175 Kalk", 1)
parameters two
returns one
purpose Activates or deactivates the rear coupler of the specified rolling stock.
notes First argument is the entire name of the rolling stock as a string.
Second argument is the desired condition of the rear coupler.
1 = activate coupler (couples on contact when opposing coupler is also active)
2 = deactivate coupler
Return value is true if the targeted rolling stock exists, else false.
EEPRollingstockGetCouplingRear() EEPRollingstockGetCouplingRear("Name")
type function
caller script
returns one
purpose Enquires the current condition of the rear coupler of the specified rolling stock.
page 16
Reference Guide to EEP functions
type function
caller script
Name = "Bekohlungskranbrücke 1"
defined in EEP Axis = "Drehung links"
parameters two EEPRollingstockSetAxis(Name, Axis, 50)
returns one
purpose Moves the specified axis of the specified rolling stock to the desired position.
notes First argument is the entire name of the rolling stock as a string.
Second argument is the entire name of the axis as a string.
Third argument is the target position for the axis.
Return value is true if the targeted rolling stock and axis exist, else false.
type function
caller script
Name = "Bekohlungskranbrücke 1"
defined in EEP Axis = "Drehung links"
parameters two hResult, hData = EEPRollingstockGetAxis(Name, Axis)
returns one
purpose Enquires the current position of the specified axis of the specified rolling stock.
notes First argument is the entire name of the rolling stock as a string.
Second argument is the entire name of the axis as a string.
First return value is true if the targeted rolling stock and axis exist, else false.
Second return value is the current position.
page 17
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPRollingstockSetSlot("Ladekran2 Greifer", 1)
parameters two
returns one
purpose Moves all axiis of the specified rolling stock to the position saved in a slot.
notes First set all axiis to the wanted position and store this condition in one of 16 slots (context
menu). Now you can use this Lua function to trigger an animation from the current setting
of all axiis to the stored position.
First argument is the entire name of the rolling stock as a string.
Second argument is the number of the slot in which the wanted position was stored.
Return value is true if the targeted rolling stock and the slot exist, else false.
It is not verified that slot actually contains any settings.
page 18
Reference Guide to EEP functions
Structure functions
type function
caller script
defined in EEP
EEPStructureSetSmoke("#1_Lauscha_train station", true)
parameters two
returns one
notes First argument is the Lua name of the structure as string. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is true to turn the smoke on or false to turn it off.
Return value is true if the targeted structure exists and has a smoke feature, else false.
EEPStructureGetSmoke() EEPStructureGetSmoke("Lua-Name")
type function
caller script
returns two
purpose Enquires if the smoke (e.g. chimney smoke) of a structure is currently turned on or off.
notes Argument is the Lua name of the structure as string. The significant differences are the
preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
First return value is true if the targeted structure exists and has a smoke feature, else
false.
Second return value is true if the smoke is turned on and false if it is off.
page 19
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPStructureSetLight("#1_Betriebsdienstgebaeude", true)
parameters two
returns one
notes First argument is the Lua name of the structure as string. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is true to turn the lights on or false to turn them off.
Return value is true if the targeted structure exists and has a smoke feature, else false.
EEPStructureGetLight() EEPStructureGetLight("Lua-Name")
type function
caller script
returns two
notes Argument is the Lua name of the structure as string. The significant differences are the
preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
First return value is true if the targeted structure exists and has a light feature, else false.
Second return value is true if the lights are turned on and false if they are off or in
automatic mode.
page 20
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPStructureSetFire("#1_Brandhaus_01_SB1", true)
parameters two
returns one
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is true to activate the fire or false to deactivate it.
Return value is true if the targeted structure exists and has a fire feature, else false.
EEPStructureGetFire() EEPStructureGetFire("Lua-Name")
type function
caller script
returns two
purpose Enquires if the smoke (e.g. chimney smoke) of a structure is currently turned on or off.
notes Argument is the Lua name of the structure as a string. The significant differences are the
preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
First return value is true if the targeted structure exists and has a fire feature, else false.
Second return value is true if the fire is turned on and false if it is off.
page 21
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPStructureAnimateAxis("#1_Windmühle", "Muehlrad", 1000)
parameters three
returns one
purpose Moves the specified axis of the specified structure or track-side object.
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the entire name of the axis as a string.
The third argument is the (positive or negative) number of steps the axis shall move. A
value of 1000 bzw. -1000 starts an endless motion if the model was built for it (e.g. sails
of a windmill). A value of 0 stops any motion.
Return value is true if the targeted structure and the targeted axis exist, else false.
type function
caller script
defined in EEP
EEPStructureSetAxis("#1_Drehscheibe", "Brücke", 50)
parameters three
returns one
purpose Sets the specified axis of the specified structure or track-side object to a new position.
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the entire name of the axis as a string.
Third argument is the new position of the specified axis.
Return value is true if the targeted structure and the targeted axis exist, else false.
page 22
Reference Guide to EEP functions
type function
caller script
returns two
purpose Enquires the position of the specified axis of the specified structure or track-side object.
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the entire name of the axis as a string.
First return value is true if the targeted structure and the targeted axis exist, else false.
Second return value is the current position of the specified axis.
page 23
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPStructureSetPosition("#1_Strohballen", 1, 2, 3)
parameters four
returns one
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the new x position of the structure.
Third argument is the new y position of the structure.
Fourth argument is the new z position of the structure.
Structures cannot be placed outside a layout’s boundaries.
Return value is true if the targeted structure exists and the new position is within the
layout’s boundaries, else false.
Function can also be used for landscape elements because both, structures and
landscape elements, share a common set of IDs.
type function
caller script
defined in EEP
EEPStructureSetRotation("#1_Strohballen", 0, 0, 25)
parameters four
returns one
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the new x rotation of the structure.
Third argument is the new y rotation of the structure.
Fourth argument is the new z rotation of the structure.
Return value is true if the targeted structure exists, else false.
Function can also be used for landscape elements because both, structures and
landscape elements, share a common set of IDs.
page 24
Reference Guide to EEP functions
Track functions
Rail tracks
EEPRegisterRailTrack() EEPRegisterRailTrack(ID)
type function
caller script
defined in EEP
EEPRegisterRailTrack(1)
parameters one
returns one
EEPIsRailTrackReserved() EEPIsRailTrackReserved(ID)
type function
caller script
defined in EEP
hResult, hData = EEPIsRailTrackReserved(1)
parameters one
returns two
purpose Enquires if the specified rail track element is occupied by any rolling stock.
page 25
Reference Guide to EEP functions
Roads
EEPRegisterRoadTrack() EEPRegisterRoadTrack(ID)
type function
caller script
defined in EEP
EEPRegisterRoadTrack(1)
parameters one
returns one
EEPIsRoadTrackReserved() EEPIsRoadTrackReserved(ID)
type function
caller script
defined in EEP
hResult, hData = EEPIsRoadTrackReserved(1)
parameters one
returns two
purpose Enquires if the specified road element is occupied by any rolling stock.
page 26
Reference Guide to EEP functions
Tram tracks
EEPRegisterTramTrack() EEPRegisterTramTrack(ID)
type function
caller script
defined in EEP
EEPRegisterTramTrack(1)
parameters one
returns one
EEPIsTramTrackReserved() EEPIsTramTrackReserved(ID)
type function
caller script
defined in EEP
hResult, hData = EEPIsTramTrackReserved(1)
parameters one
returns two
purpose Enquires if the specified tram track element is occupied by any rolling stock.
page 27
Reference Guide to EEP functions
EEPRegisterAuxiliaryTrack() EEPRegisterAuxiliaryTrack(ID)
type function
caller script
defined in EEP
EEPRegisterAuxiliaryTrack(1)
parameters one
returns one
EEPIsAuxiliaryTrackReserved() EEPIsAuxiliaryTrackReserved(ID)
type function
caller script
defined in EEP
hResult, hData = EEPIsAuxiliaryTrackReserved(1)
parameters one
returns two
purpose Enquires if the specified auxiliary track element is occupied by any rolling stock.
page 28
Reference Guide to EEP functions
Control tracks
EEPRegisterControlTrack() EEPRegisterControlTrack(ID)
type function
caller script
defined in EEP
EEPRegisterControlTrack(1)
parameters one
returns one
EEPIsControlTrackReserved() EEPIsControlTrackReserved(ID)
type function
caller script
defined in EEP
hResult, hData = EEPIsControlTrackReserved(1)
parameters one
returns two
purpose Enquires if the specified control track element is occupied by any rolling stock.
page 29
Reference Guide to EEP functions
Camera functions
type function
caller script
defined in EEP
EEPSetCamera(0,"Station")
parameters two
returns one
notes First argument is the type of camera: 0=static, 1=dynamic, 2= mobile camera
Second argument is the name of the camera as a string.
Return value is true if the targeted camera exists, else false.
type function
caller script
defined in EEP
EEPSetPerspectiveCamera(1,"#Passenger train")
parameters two
returns one
notes First argument is the relative position of the camera and matches selection 1 to 9 on your
keyboard (i.e. 1 = straight left, 2 = straight right, …, 8 = cockpit camera etc.).
Second argument is the train name as a string.
Return value is true, if the targeted train and camera exist, else false.
Calling this camera while it is already active turns off the follow mode.
page 30
Reference Guide to EEP functions
Layout functions
EEPLoadProject() EEPLoadProject("FileName")
type function
caller script
defined in EEP
EEPLoadProject("Tutorials\\Tutorial_54_LUA.anl3")
parameters two
returns one
notes Argument is the path (if needed) inside the folder “Anlagen” and the file name including
the .anl3 suffix.
Separating character between folder and file name is a double backslash.
Return value is true if the required layout exists, else false.
page 31
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPGetTrainFromTrainyard(1,"#Rheingold",1)
parameters three
returns one
purpose Sends a specified train from the specified virtual train depot.
notes First argument is the ID of the train depot. You can find the ID in the header of the
depot’s properties window.
Second argument is the entire train name as a string. If you enter an empty string as a
train name, the train is specified by the third argument.
Third argument is the position in the depot list. The train name in the second argument
takes precedence over this number and must be an empty string for this number to take
effect. However, a number must always be given. Enter 0 if you use the train’s name.
Return value is true if the targeted depot and train exist, regardless if the train is currently
in the depot and available or not! It is false if either the depot doesn’t exist or the
specified train is not listed in this depot.
page 32
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPChangeInfoStructure("#1", "Hallo")
parameters two
returns one
requires EEP 13
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is the new text. Use \n for line feeds.
Return value is true if the targeted structure exists, else false.
This function can also be used for landscape elements because both, structures and
landscape elements, share a common set of IDs.
type function
caller script
defined in EEP
EEPShowInfoStructure("#1", true)
parameters two
returns one
requires EEP 13
notes First argument is the Lua name of the structure as String. The significant differences are
the preceding hash sign and ID. These are sufficient as a Lua name and everything that
follows may be omitted.
Second argument is true for turning the tip text on and false for turning it off.
Return value is true if the targeted structure exists, else false.
This function can also be used for landscape elements because both, structures and
landscape elements, share a common set of IDs.
page 33
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPChangeInfoSignal(1, "Hallo")
parameters two
returns one
requires EEP 13
type function
caller script
defined in EEP
EEPShowInfoSignal(1, true)
parameters two
returns one
requires EEP 13
page 34
Reference Guide to EEP functions
type function
caller script
defined in EEP
EEPChangeInfoSwitch(1, "Hallo")
parameters two
returns one
requires EEP 13
type function
caller script
defined in EEP
EEPShowInfoSwitch(1, true)
parameters two
returns one
requires EEP 13
page 35