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

Thinking I'm doing something incorrectly using variables with Trains/Cars.

See if I can explain ....

1.) I assign a variable to a Vehicles named Vehicle Type which is "TEXT"

2.) Lets say I assign Vehicle Type as a place to go at a junction ... for example "Yard", "Dock", "Warehouse"

3.) Vehicle gets to a "Contact" just before the Junction and an event using Vehicle on Track/Conctact True False ... do this, that or the other .... normal stuff.

OK what's my problem ... seems to work sometimes/sometimes not. So I run the F12 monitor. Some of the events give an error of empty variable.  Some events do not.

NOTE: Many Vehicles ... not all vehicles were assigned a "Vehicle Type", only the ones I wanted to go to a specific location.

So I started to use the condition "If Variable Exists" ... Then under True, I determine what the Vehicle Type is and act accordingly.

Sometimes that works, sometimes that generates an error and I remove the "If Variable Exist" ... and that Event works without error.

I'm doing something wrong I suspect ... don't have a clue what.

Hope I explained this well enough  !!!

Any Ideas ????

Geschrieben
vor 5 Minuten schrieb hmclay:

I started to use the condition "If Variable Exists" ... Then under True, I determine what the Vehicle Type is and act accordingly.

Sometimes that works, sometimes that generates an error

What's the error message in this particular case, hmclay?
It may hold that clue you're looking for. Without knowing what error you get when checking if the variable exists, it's difficult to guess what's going wrong.

Geschrieben
  • Autor

Not sure of error message, but is using "If Variable Exist", then checking for what TEXT is assigned the correct method.

I'm assuming that if a vehicle is not assigned a variable, and a check is made, that creates an error of "null" value, rather than just skip over that statement. So that is why I started to use the If Variable exist check. Why would that not work ... but in some some events, removing it does, even on cars without a Variable assigned.

In one event I need the If Variable Exists, in another it does not work ?????

What is the correct method of checking for an assigned Vehicle Variable,  ?  

Since I was getting inconsistent results, I thought using the Objects name may be a better option. Then assigning that name to every vehicle needing directed. 

Any thoughts ?

Bearbeitet von hmclay
RED highlight

Geschrieben
vor einer Stunde schrieb hmclay:

I'm assuming that if a vehicle is not assigned a variable, and a check is made, that creates an error of "null" value

Sorry, but your assumption is wrong.

The check if a variable exists looks like this (when converted to Lua):

if object["VariableName"] ~= nil then
  -- do something with the variable
end

The sole purpose of this check is to avoid the "nil value" error and only use the variable when it has content.

 

vor einer Stunde schrieb hmclay:

Why would that not work ... but in some some events, removing it does

If only I could see what you actually did.
Because whatever caused the error, it wasn't the check. It was something else. Like placing the command in the wrong field of the condition (the bottom half) or negating the check or god knows what!

Here is how it should look in graphical form:

vehiclerouteconditions.jpg.6eab68967c06634583eb30ead3babdf6.jpg

I hope this helps?
Goetz

Geschrieben
  • Autor

Is The attach valid technique

Screenshot 2025-06-25 211534.jpg

Geschrieben
vor 7 Stunden schrieb hmclay:

Is The attach valid technique

I doubt it very much, Howard

to clarify: Your condition (as is) assumes that the variable "Vehicle Type" in the triggering vehicle holds an object. It then looks for another variable by the name of "Truck - W10" in that object, assuming that that variable holds another vehicle. And then it checks if that other vehicle is on the track that your triggering vehicle just left. 

I'm quite certain that this is far from what you actually want to achieve.

Bearbeitet von Goetz
Ergänzungen

Geschrieben
  • Autor

Thought this may be a problem. I'm not using this action ( Vehicle is Located on Track/Contact) correctly. Most likely my core problem concerning this topic.

Thanks, I'll use the method(s) you provided.

Howard

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.