Jump to content
Zum Start hinzufügen

Weitere Informationen

3D-Modellbahn Studio

Eine Vollbild-App auf Ihrem Startbildschirm mit Push-Benachrichtigungen und mehr.

So installieren Sie diese App auf iOS und iPadOS
  1. Tippen Sie auf das Teilen-Symbol in Safari
  2. Scrollen Sie durch das Menü und tippen Sie auf Zum Startbildschirm hinzufügen.
  3. Tippen Sie oben rechts auf Hinzufügen.
So installieren Sie diese App auf Android
  1. Tippen Sie auf das 3-Punkte-Menü (⋮) in der oberen rechten Ecke des Browsers.
  2. Tippen Sie auf Zum Startbildschirm hinzufügen oder App installieren.
  3. Bestätigen Sie durch Tippen auf Installieren.

Empfohlene Beiträge

Geschrieben

I am trying to find out the name of the vehicle stopped at a signal and then read a keyword from that vehicle.  Any help would be great.  Code would be preferred please.

 

Thanks

 

George

Geschrieben

Hello George,

if you're using V7 and the vehicle has stopped on a contact which belongs to the signal:

First, here's how to check for a keyword.
A keyword is a treated like a variable, with the actual word being the name of this variable.

That's why the condition may look like this:

900081242_keywordcondition1.jpg.0683a4be44cad2f3cf63f803766b7ab4.jpg

check if vehicle "MAK1202-1205" has a variable named "freighttrain"

To find the train sitting on the contact of a particular signal, you may use an iteration.
It will return a list of all vehicles on that contact. This may sound strange, because there shouldn't be more than one. But the same iteration is also used to get all vehicles on a particular track. And that may well be a larger number than 1.

Here is the iteration:

375889232_keywordcondition2.jpg.f671d5a636ee26ad58cec83ecdf15ee0.jpg

return all elements wich sit on the contact of signal "H/V main signal" - one by one - and give each one the temp name "Iter"

And here is how you enter each element from that iteration into the condition:

1451980535_keywordcondition3.jpg.9de65158531cd08df4257aa92e953eae.jpg

Click on the small cog wheel next to the object (where the train name was before) and selet "Iteration".

If you feel comfortable with Lua, use the small <> button to convert everything into a script.
In the script, you can eliminate the iteration and go straight for the first element of the returned list. That is the vehicle parked on that contact:

local t = layout:getVehiclesOn($("H/V main signal"))
if t[1].variables["freighttrain"] ~= nil then
-- enter tasks here
end

 

Kind regards
Goetz

Geschrieben

I hope this helps.

First, a keyword is a shortcut to name one or more objects in the Events Manager

keyword.thumb.jpg.36d57e77523750093e496e228d7c59ed.jpg

In this case there are more than seven track contacts, and I want to set an event that will work for any of them.  Vehicle (Trigger) refers to the Locomotive (any) that triggers a "Stop" contact.

Signal.thumb.jpg.f56ee5c645e2ab34cb5e1221ef2f2018.jpg

Here, I have used a track contact to trigger a track signal.  The rest of the event sets specific routes.

Locomotive.thumb.jpg.01bd4218687a4ac761db1ecb571ac04a.jpg

Each Locomotive has an object variable called Track that sets a specific track.

Toggle.thumb.jpg.443a04a61ddb9a9fc56e1fc483800832.jpg

Here, The Track for Loco 3 sets a series of three track switches for track3

Geschrieben
  • Autor

You are such a brilliant group of "helpers".   My interest in 3D Train studio would have lone been exhausted without the help from Goetz and Kurt.  Thanks a million.

 

George

 

Geschrieben
  • Autor

My next question is....Is it possible to display the time left on a timer (Nearest Second would be good).

 

George, Bramhall, Stockport, UK

Geschrieben
vor 11 Minuten schrieb Jud91:

Is it possible to display the time left on a timer

apparently not, George

The only timer property I can find is "active". Nothing beyond that.

1438982212_timeractive.thumb.jpg.50d4c138686907d415188a1bbf6bc1b1.jpg

Geschrieben
5 hours ago, Goetz said:

apparently not, George

The only timer property I can find is "active". Nothing beyond that.

1438982212_timeractive.thumb.jpg.50d4c138686907d415188a1bbf6bc1b1.jpg

timers.thumb.jpg.3d66a0bf6e4f00333a08f73723aa24b0.jpg

Geschrieben

Hello @Curt84328

the active state is the only property that I can access from within the event manager.
I cannot read and evaluate properties like the remaining time.

Kind regards
Göetz

Geschrieben

You can use the event tracer

Untitled.jpg.dbc3c2f343d5574a373f8bab3e6ddc0d.jpg

Capture.thumb.JPG.3d2484a21ae8116851213dfb3e514ec4.JPG

Click the + under timers and variables to add those you want to see.

Geschrieben

My apologies, @Curt84328

I just realised, I misunderstood Jud91.
He simply want's to keep an eye on the timer values.
And you, together with @simonjackson1964 gave the correct answer.

For some reason I was under the impression that he wanted to evaluate it, using the event manager.
THat he wanted to use the value as a condition or print it on a label.

Sorry about that ;)

Geschrieben

Well, we could still be wrong, we'll have to wait for a response from @Jud91 for that.

Geschrieben
  • Autor

Sorry to not be clear.  Both answers are of help BUT I wish to display a current clock on the layout.  This clock needs to show the simulation time.

(If in real time it will show real time like a clock on the layout somewhere.

 

Thanks for you help and apologies for not being very clear.

 

George

 

Geschrieben

Hello @Jud91,

in the Lua editor, press ctrl + spacebar to open a list of all available commands and parameters.
You may find that the simulation time is held in a variable named layout.time

2034901480_layouttime.jpg.01846209c183bb4289c84db262b94a14.jpg

 

Unfortunately, this value is only available from within a Lua script.

Here's how you give the time to the text property of a label item (called Label in this example):

$("Label").text = layout.time

You can use a timer (set to 60 seconds) to refresh the text once every minute.

1709405909_timelabel.jpg.99ae334f42159a9454e51887024f5a7a.jpg

 

Kind regards
Goetz

Geschrieben
vor 3 Minuten schrieb Goetz:

You can use a timer (set to 60 seconds) to refresh the text once every minute.

Small hint, you can use the event "Time is reached" to react on layout time changes without a timer.

Kind regards,

Neo

Geschrieben
  • Autor

Brilliant.  Many thanks

 

George

 

Geschrieben
  • Autor

Not related BUT.  I have lost my Pro version settings even though I am logged in correctly.   It will not save my work without buying professional again.   Can anyone suggest what I do please?

 

George

 

Geschrieben
  • Autor

Please ignore.  I have logged in again and all is well.

Geschrieben

Hi George,

it seems that you are using 2 accounts here, but your professional version is only linked to a single account. Should I merge both accounts into a single one?

Kind regards,

Neo

Geschrieben
  • Autor

Yes please.  Can you keep georgeb@*** and drop ms@***.  Thank you

George

 

Geschrieben

Hi George,

I have merged both accounts. If you like, you can change your username and/or mail in your account settings.

Kind regards,

Neo

Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren

Push-Benachrichtigungen konfigurieren

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.