Herman Geschrieben 22. März 2022 Geschrieben 22. März 2022 Hello Developers, hello members. Sorry I'm here again with something strange. I get this error with some script, the script is triggered by a track contact. It works fine, but not always local depotA = vehicle.variables["#AUa Depot"] vehicle.variables["#AUa Depot"]:add(vehicle) if depotA.count > 0 then depotA:release(0) end You can only see the error in the analyser, the result is that a car is not released from his local depot. Some help please. I will try to make a little .mbp with only this problem in it. Greetings Herman
Goetz Geschrieben 22. März 2022 Geschrieben 22. März 2022 Hello Herman, vor 5 Minuten schrieb Herman: Some help please. Judging by the error message, I'd guess that you attempted to send a car, with no valid depot address stored in #AUa Depot, to that very depot. And why don't you use the variable depotA in line 2? And why don't you post code in this form, please? local depotA = vehicle.variables["#AUa Depot"] depotA:add(vehicle) if depotA.count > 0 then depotA:release(0) end And what's with that hash tag at the beginning of the variable's name? You may want to check the stored information for validity, before you use it. And maybe print some error message when the variable doesn't hold anything useful. See if that helps to catch the culprit. Goetz
Herman Geschrieben 22. März 2022 Autor Geschrieben 22. März 2022 Hello @Goetz , thank you for your answer. Feedback. 32 minutes ago, Goetz said: And why don't you use the variable depotA in line 2? yes, but cannot generate the error, and this line is executed ok 34 minutes ago, Goetz said: And what's with that hash tag at the beginning of the variable's name? All my objects that are used somewhere in an event starts with a # and some unique identification + a name, ex: #AU Opel01. All the variables of that object do use the start ex: #AU Maxspeed. I have an own naming convention. Because I often use generic events I must be aware that keywords are unique. The rest is to easy find out wich variable is from a specific object. But that's my stuff. ( and yes I am aware that you can count the elements of a table with # ) 41 minutes ago, Goetz said: You may want to check the stored information for validity, before you use it. That's for sure. So I agree it can be a distraction. I'm now testing, and will report soon.
Herman Geschrieben 22. März 2022 Autor Geschrieben 22. März 2022 (bearbeitet) Hello, still testing and yet the "Bösewicht" is still here. If I send a car in with an empty name of the depot to come out I do not get that error message but this one. With an incorrect object name the next. Then the vehicle does not even go to the depot. In my case it goes to the depot, and mostly comes out correct. But sometimes we get the error. Still searching, sorry, Greetings, Herman Bearbeitet 22. März 2022 von Herman
Herman Geschrieben 22. März 2022 Autor Geschrieben 22. März 2022 (bearbeitet) Hello @Neo, developers, members, Goetz, For the moment I stop searching. There are only 4 cars running, and I triple checked their variable. The layout where the error occurs is this one : 5E7583EB-A086-47F5-891C-5172D0FB9BDE ( draft ). It is a starting layout with a lot of tracks and streets that demonstrates a specific crosspoint in my neighbourhood. But the code is minimal. Normally I get this : Sometimes but far not always the error haunts. So I cannot reproduce it in a very short time. However it appears frequently, and with different cars. You can notice the error outside the analyser because that depot has a vehicle in it, and it should release it immediately. ( below the base plate ) Greetings, Herman Bearbeitet 22. März 2022 von Herman
Goetz Geschrieben 22. März 2022 Geschrieben 22. März 2022 (bearbeitet) Hello Herman, It looks like the car is already counted, but not ready yet for retrieval. Anyway, now that I know what you're attempting, I have a suggestion: "car arrives at depot" is an event that you can respond to. That's the safe way to send out the car which has just arrived. Two commands in immediate succession for sending and retrieving the car leaves the studio no time to actually perform the transaction from contact to depot. Greets Goetz Bearbeitet 22. März 2022 von Goetz
Herman Geschrieben 23. März 2022 Autor Geschrieben 23. März 2022 12 hours ago, Goetz said: Two commands in immediate succession for sending and retrieving the car leaves the studio no time to actually perform the transaction from contact to depot. Yes, sometimes... , certainly not always... Hello @Goetz , that has probably caused the error, I was thinking in that direction, however, the advice of an expert here is always top. Thanks for your suggestion, a very good one ! Nevertheless I was looking primarily what caused the error. I 'm already working in another way. Just for the record, for what I want to do it is better to send the car directly to the depot where it belongs, without central depot, and a timer per depot can let them out randomly. ( let the car restart in the depot where he started before to maintain his target, just experimenting another street traffic ) For me this post can be closed, thank you very much @Goetz ! Kind regards, Herman
Herman Geschrieben 23. März 2022 Autor Geschrieben 23. März 2022 Hello everybody, For those that are interested. This is what left, pure EV. Kind regards, H.
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde dich an, um zu kommentieren
Du musst ein Benutzerkonto besitzen, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen.
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden